This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 454db3a71dee0748f70c3fd2ce123270a13e5ef3 (commit) via ecf0e06b61327af4be5005281a6a92f9ac6de466 (commit) from d1aea18b90fec1a91e1d7420bcb4af279fd1758d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=454db3a71dee0748f70c3fd2ce123270a13e5ef3 commit 454db3a71dee0748f70c3fd2ce123270a13e5ef3 Merge: d1aea18 ecf0e06 Author: Bill Hoffman <bill.hoff...@kitware.com> AuthorDate: Thu Dec 15 22:00:01 2011 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Thu Dec 15 22:00:01 2011 -0500 Merge topic 'fix_double_project_cmake_build' into next ecf0e06 Fix the case where cmake --build failed with two project cmds in one file. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecf0e06b61327af4be5005281a6a92f9ac6de466 commit ecf0e06b61327af4be5005281a6a92f9ac6de466 Author: Bill Hoffman <bill.hoff...@kitware.com> AuthorDate: Thu Dec 15 21:56:34 2011 -0500 Commit: Bill Hoffman <bill.hoff...@kitware.com> CommitDate: Thu Dec 15 21:56:34 2011 -0500 Fix the case where cmake --build failed with two project cmds in one file. This adds a test that uses two project commands in the same CMakeLists.txt file. It also adds a fix so that cmake --build will work in that case. The fix sets the name of the last project command in the top level CMakeLists.txt in the cache variable CMAKE_PROJECT_NAME. This variable is used by cmake --build to find the project name. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 1a831d9..6e3b6af 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -47,9 +47,13 @@ bool cmProjectCommand this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str()); // Set the CMAKE_PROJECT_NAME variable to be the highest-level - // project name in the tree. This is always the first PROJECT - // command encountered. - if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME")) + // project name in the tree. If there are two project commands + // in the same CMakeLists.txt file, and it is the top level + // CMakeLists.txt file, then go with the last one, so that + // CMAKE_PROJECT_NAME will match PROJECT_NAME, and cmake --build + // will work. + if(!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") + || (this->Makefile->GetLocalGenerator()->GetParent() == 0) ) { this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); this->Makefile->AddCacheDefinition diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in index 9c3002b..a8bb750 100644 --- a/Tests/CMakeBuildTest.cmake.in +++ b/Tests/CMakeBuildTest.cmake.in @@ -32,21 +32,21 @@ set(CMAKE_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@) # run the executable out of the Debug directory if there # are configuration types if(CMAKE_CONFIGURATION_TYPES) - set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/COnly") + set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/Debug/@CMAKE_BUILD_TEST_EXE@") else(CMAKE_CONFIGURATION_TYPES) - set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/COnly") + set(RUN_TEST "@CMAKE_BUILD_TEST_BINARY_DIR@/@CMAKE_BUILD_TEST_EXE@") endif(CMAKE_CONFIGURATION_TYPES) # run the test results message("running [${RUN_TEST}]") execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT) if(RESULT) - message(FATAL_ERROR "Error running test COnly") + message(FATAL_ERROR "Error running test @CMAKE_BUILD_TEST_EXE@") endif(RESULT) -# build it again with clean and only COnly target +# build it again with clean and only @CMAKE_BUILD_TEST_EXE@ target execute_process(COMMAND "${CMAKE_COMMAND}" --build "@CMAKE_BUILD_TEST_BINARY_DIR@" --config Debug - --clean-first --target COnly + --clean-first --target @CMAKE_BUILD_TEST_EXE@ RESULT_VARIABLE RESULT) if(RESULT) message(FATAL_ERROR "Error running cmake --build") @@ -55,5 +55,5 @@ endif(RESULT) # run it again after clean execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT) if(RESULT) - message(FATAL_ERROR "Error running test COnly after clean ") + message(FATAL_ERROR "Error running test @CMAKE_BUILD_TEST_EXE@ after clean ") endif(RESULT) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1851f7a..903bb52 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -220,11 +220,21 @@ IF(BUILD_TESTING) SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/COnly") SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/CMakeBuildCOnly") + SET(CMAKE_BUILD_TEST_EXE COnly) CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake" @ONLY) ADD_TEST(CMakeBuildTest ${CMAKE_CMAKE_COMMAND} -P "${CMake_BINARY_DIR}/Tests/CMakeBuildTest.cmake") LIST(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) + # now do it again for a project that has two project commands + SET(CMAKE_BUILD_TEST_SOURCE_DIR "${CMake_SOURCE_DIR}/Tests/DoubleProject") + SET(CMAKE_BUILD_TEST_BINARY_DIR "${CMake_BINARY_DIR}/Tests/DoubleProject") + SET(CMAKE_BUILD_TEST_EXE just_silly) + CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CMakeBuildTest.cmake.in" + "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake" @ONLY) + ADD_TEST(CMakeDoubleProject ${CMAKE_CMAKE_COMMAND} -P + "${CMake_BINARY_DIR}/Tests/CMakeBuildDoubleProjectTest.cmake") + LIST(APPEND TEST_BUILD_DIRS ${CMAKE_BUILD_TEST_BINARY_DIR}) ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize) ----------------------------------------------------------------------- Summary of changes: Source/cmProjectCommand.cxx | 10 +++++++--- Tests/CMakeBuildTest.cmake.in | 12 ++++++------ Tests/CMakeLists.txt | 10 ++++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits