I´m trying to run CMake from a Windows machine to generate an Android NDK project with a specific toolchain file. There is a tutorial on how to generate Android projects with CMake by google. Anyway I need the project to be an Eclipse project because its the only way to import it into ADT bundle. Now on the CMake UI there are more option for that:
Eclipse CDT4 - MinGW
Eclipse CDT4 - NMake
Eclipse CDT4 - Unix
Eclipse CDT4 - Ninja
The 2nd one (Eclipse CDT - NMake) is the right choice for this configuration, when i start CMake then it fail generating throwing following error:
CMake Warning at CMakeLists.txt:3 (project):
To use the NMake generator, cmake must be run from a shell that can use the
compiler cl from the command line. This environment does not contain
INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
work.
any ideas?
You need to initialize the environment with vcsvarsall.bat(shipped with Visual Studio).
E.g. for Microsoft Visual Studio 2010 - run this "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" in the same console instance where you intend to execute your cmake command:
...>"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Or find in Start Menu "Visual Studio Command Prompt (2010)" ("Developer Command Prompt for VS20XX" for recent versions of VS) which does this initialization for you and run cmake there.
Related
I am developing C/C++ with Visual Studio Code using cmake and so CMake Tools extension of Visual Studio Code.
When I run cmake command manually (from build dir, just doing cmake ..), cmake configuration works but when I use CMake Tools, it fails.
I have looked at traces and the failure of CMake Tools is because of this difference:
Manually:
set(CMAKE_C_COMPILER_ARG1 -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/opt/mydev/1.1.2/sysroots/cortexa7hf-vfp-neon-mydev-linux-gnueabi CACHE STRING Arguments to C compiler )
CMake Tools:
set(CMAKE_C_COMPILER_ARG1 /opt/mydev/1.1.2/sysroots/i686-mydevsdk-linux/usr/bin/arm-mydev-linux-gnueabi/arm-mydev-linux-gnueabi-gcc )
If I explicitly give this argument to CMake Tools, okay, it would work, but, why do I have to do that?
Why cmake just works (getting CMAKE_C_COMPILER_ARG1 from exported CC environment variable) but CMake Tools does not? If it would just execute cmake, it would work, but apparently it does not do that.
So, what is the thing that makes CMake Tools set CMAKE_C_COMPILER_ARG1 wrongly?
Is there anyway to make CMake Tools just work as cmake?
Remote-SSH resulted in an error command opensshremote.openEmptyWindow not found.
I am on Arch Linux, vscode-oss from community repository package code version 1.64.
How to fix?
> pacman -Ss vscode
community/code 1.64.0-1 [installed]
The Open Source build of Visual Studio Code (vscode) editor
I am trying to create a simple helloworld Eclipse CDT project using the CMake GUI. The CMake file looks like this:
cmake_minimum_required(VERSION "3.11.1")
project("HelloWorld")
add_executable("HelloWorldMain" "Main.cpp")
install(TARGETS "${PROJECT_NAME}" DESTINATION bin)
install(FILES "Main.cpp" DESTINATION src)
The only c/c++ compiler I have is MSVC so I set that as the CMAKE_CXX_COMPILER but I get an error when configuring as shown here:
I know this file exists, but how do I get it to find it?
I ended up not using the GUI. Instead I used the VS x64 Native Tools Command Prompt then ran the cmake command:
cmake -G "Eclipse CDT4 - NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 ../
For some reason it forces -G Ninja when I try to build within eclipse. I would prefer Eclipse just not specify the -G option to cmake, but I can't figure out how to configure Eclipse to do that.
For exampe, this in my console window:
Building in: /home/bgass/eclipse-workspace/scomlib/build/default
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/bgass/eclipse-workspace/scomlib
CMake Error: Error: generator : Ninja
Does not match the generator used previously: Unix Makefiles
Either remove the CMakeCache.txt file or choose a different binary directory.
cmake --build . -- -v
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Build complete (0 errors, 0 warnings): /home/bgass/eclipse-workspace/scomlib/build/default
In a terminal it works just fine without the generator specified.
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/bgass/eclipse-workspace/scomlib
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bgass/eclipse-workspace/scomlib/build/default
I always execute cmake outside eclipse and open the generated eclipse project in Eclipse.
use -G "Eclipse CDT4 - Unix Makefiles" to specify Eclipse as the generator.
Following are the full set of Eclipse generators.
Eclipse CDT4 - NMake Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - MinGW Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
Type in cmake --help to see what generators are supported by your specific cmake version.
I'm new to ionic framework and getting error when im trying to install ionic.
I have installed apache-ant, nodejs, cordova but when i was trying to install ionic then it throws error as follows.
OS windows 8.1 64 bit.
Please guide me to install this ionic.
\node-sass\build\binding.sln" (default target) (1) ->
(_src_\libsass target) ->
..\..\src\libsass\include\sass/base.h(18): fatal error C1083: Cannot open inc
lude file: 'stdbool.h': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
..\..\src\libsass\include\sass/base.h(18): fatal error C1083: Cannot open inc
lude file: 'stdbool.h': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
c:\users\guru.ramachandran\appdata\roaming\npm\node_modules\ionic\node_module
s\node-sass\src\libsass\src\units.hpp(10): error C2668: 'acos' : ambiguous call
to overloaded function [C:\Users\guru.ramachandran\AppData\Roaming\npm\node_mo
dules\ionic\node_modules\node-sass\build\binding.sln]
c:\users\guru.ramachandran\appdata\roaming\npm\node_modules\ionic\node_module
s\node-sass\src\libsass\src\ast.hpp(12): fatal error C1083: Cannot open include
file: 'unordered_map': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
c:\users\guru.ramachandran\appdata\roaming\npm\node_modules\ionic\node_module
s\node-sass\src\libsass\src\ast.hpp(12): fatal error C1083: Cannot open include
file: 'unordered_map': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
..\..\src\libsass\include\sass/values.h(5): fatal error C1083: Cannot open in
clude file: 'stdbool.h': No such file or directory [C:\Users\guru.ramachandran\
AppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln
The issue is about node-gyp module, which requires VS2013-VS2015 to build components at this time, in their README file, they say
Option 1
Install all the required tools and configurations using Microsoft's
windows-build-tools using
npm install --global --production windows-build-tools
from an elevated PowerShell or CMD.exe (run as
Administrator).
Option 2
Install tools and configuration manually:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install
option.
Option 2: Install Visual Studio 2015 (or modify an existing
installation) and select Common Tools for Visual C++ during setup.
This also works with the free Community and Express for Desktop
editions.
[Windows Vista / 7 only] requires .NET Framework 4.5.1 Install
Python 2.7 (v3.x.x is not supported), and run npm config set python
python2.7 (or see below for further instructions on specifying the
proper Python version and path.)
Launch cmd, npm config set msvs_version 2015
Source: https://github.com/nodejs/node-gyp