conciergesite.blogg.se

Cmake set variable from command line
Cmake set variable from command line












cmake set variable from command line

Second is that I think I know what is happening now. I did not expect it to be used in subsequent runs unless I enable more languages. On first run, toolchain file is executed twice, while on subsequent runs it executes only once. Findings are a bit surprising to me.įirst interesting thing is that toolchain file is also read on subsequent configure runs, even if they were triggered due to changes in CMakeLists.txt and not manually from command line.

cmake set variable from command line

I added a message() call to toolchain file and CMakeLists.txt to both see what the value of CMAKE_STANDARD_LIBRARIES is and to see whether toolchain is indeed only read once. True, they should only be read on the first configure, but I also saw the value of that variable stored in the CMakeCache.txt which gives access to it in subsequent runs.īut now that you’ve brought it up, I experimented with it a little more. This produces the same value of LINK_LIBRARIES in build.ninja for first and also subsequent runs, even though the process of arriving at that value is different. We have noticed this because in our toolchain file we set CMAKE_STANDARD_LIBRARIES to contain these default libraries: set(CMAKE_C_STANDARD_LIBRARIES This is generally not a problem, as link.exe will include those libraries in default libraries set by default, so as long as they are found using library search paths, things work and nothing needs to be mentioned on the command line. Note, I have manully removed all variables except LINK_LIBRARIES, as they remain the same after regeneration and would just get in the way. However, when build directory is regenerated, LINK_LIBRARIES variable setting disappears. LINK_LIBRARIES = kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib Hi, we are writing a custom MSVC toolchain (specifically for Visual Studio 2017) and while doing so, we’ve run into a problem where generated build.ninja file is different on first cmake run compared to subsequent runs.Īfter first run it generates following (stripped down for readability) build statement: build test.exe: CXX_EXECUTABLE_LINKER_test_Debug CMakeFiles\test.dir\














Cmake set variable from command line