[CMake] Broken Cmake Behavior using --build VS2010

David Cole david.cole at kitware.com
Wed Dec 14 20:31:37 EST 2011


This is because we should really only allow one project command per CMakeLists.txt file, but since we do not error out, it's difficult to change at this point in time...

--build uses the CMAKE_PROJECT_NAME cache variable to decide what sln file to use, and that corresponds to the first project command.

Do you need multiple project commands in your CMakeLists.txt file?

What benefit do you get from it?

I'd like to understand how people are using multiple project commands, so we can fix this the "right" way.


Thx,
David


On Dec 14, 2011, at 6:26 PM, J Decker <d3ck0r at gmail.com> wrote:

> visual studio 2010; cmake latest....
> 
> cmake .. - generates a .sln file that is comprised of the last project
> in the top level.
> 
> cmake --build .   - tries to build the .sln that is comprised of the
> first 'project' command that is encountered in the script.
> 
> 
> If I reverse the project and include lines in the root cmakelists.txt
> file; then the results are reversed.
> 
> 
> ----- CMakeLists.txt ----
> 
> include( other.txt )
> project( this_root )
> 
> ----- other.txt  ---
> 
> project( other_root )
> 
> ------ doit.bat ------
> cmake -G "Visual Studio 10" ..
> cmake --build .
> 
> ----------- The Output -------------------
> 
> M:\tst\cmake\build>doit.bat
> 
> M:\tst\cmake\build>cmake -G "Visual Studio 10" ..
> -- Check for working C compiler using: Visual Studio 10
> -- Check for working C compiler using: Visual Studio 10 -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler using: Visual Studio 10
> -- Check for working CXX compiler using: Visual Studio 10 -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Configuring done
> -- Generating done
> -- Build files have been written to: M:/tst/cmake/build
> 
> M:\tst\cmake\build>cmake --build .
> 
> Microsoft (R) Visual Studio Version 10.0.30319.1.
> Copyright (C) Microsoft Corp. All rights reserved.
> 
> The following files were specified on the command line:
> 
>        other_root.sln
> 
> These files could not be found and will not be loaded.
> 
> ----------------------------------------------
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list