[CMake] CMake 3.0 and Visual Studio 2013 peculiarities

Nagy-Egri Máté Ferenc nagymatef at freemail.hu
Tue Aug 5 07:30:57 EDT 2014


Hi!




I have been using CMake for quite some time now, but there are a few things I don’t understand or I just don’t know how to accomplish.


1) Some time ago I posted about Unicode paths inside generated project files do not work properly. The issue has been fixed. Though this issue is only a cosmetic one, when I genetate anything with CMake under such a path I see


-- Build files have been written to: C:/Users/MßtÚFerenc/OneDrive/Develop/Active/GridRipper/VS2013


in the command line, where the actual path should contain “MátéFerenc”. I don’t know if the displayed string internally is stored this way, or the encoding gets messed at the very last moment when printed to the console. Inspecting which is the case might uncover some bugs.


2) For some reason Visual Studio does not find certain files it should. This might not even be a CMake bug, but related to Visual Studio, although there might be someone on the list that knows the solution to the problem. #include <> paths are set up by CMake seemingly correctly by using absolute paths. I have


set (CMAKE_USE_RELATIVE_PATHS “true”)


option set, and inside my projects I have statements such as


include_directories (${PROJECT_SOURCE_DIR}/inc/)
include_directories (${Gripper_ADDITIONAL_INCLUDE_DIRS})


at other places I use


include_directories ("${PROJECT_SOURCE_DIR}/inc/")
include_directories (${Gripper_ADDITIONAL_INCLUDE_DIRS})


Both seem to work (though I would be curious which is the better one), even the generated project file seems right, in which I can see parts that read


<AdditionalIncludeDirectories>C:\GridRipper\tests\STL-Test4-Plotter\inc;C:\GridRipper\Gripper\inc;C:\Kellekek\GSL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>


So indeed my project correctly sets it’s own include dir and that of the libraries that it will link (plus GSL as a dependancy. The application compiles fine, intellisense parses the files properly, however when I right click inside the IDE, and say Open File, it brings up a dialog saying it cannot find the file. It lists all the directories it is looking inside, and none of the AdditionalIncludeDirectories entries are among the paths it is trying to find the file.


Why is this? Is this a bug in CMake or VS messes up something?


3) How can I create a makefile that forces a certain platform toolset to be used? I have seen in a Makefile of another project that


set(CMAKE_GENERATOR_TOOLSET "CTP_Nov2013" CACHE STRING "Platform Toolset" FORCE) 
set(CMAKE_VS_PLATFORM_TOOLSET "CTP_Nov2013" CACHE STRING "Platform Toolset" FORCE)


should do the trick, however for the initial makefile/project generation, this does not work. I issue the command


cmake -G"Visual Studio 12 2013 Win64" -DBUILD_EXAMPLES:BOOL=ON -DBUILD_TESTS:BOOL=ON ..\


but all projects use the regular vs120 platform toolset. If I immediately issue


cmake ..\


after this, then everything will go as expected. What is the canonical way of obtaining a 64-bit project file with a given toolset without having to do multipass generation? My project uses automatic return type deduction, thus I need the CTP_Nov2013 toolset, otherwise my app won’t compile.




Thanks in advance,

Máté
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140805/123f4332/attachment.html>


More information about the CMake mailing list