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 523cf8a7d69df6442bd63023f3925451520bf04a (commit) via b898554b6b8eab0a4c7775f7bcf4b67fcd0e50d4 (commit) via bff3d9ce0a5885dee6ee91f666372c6b22272231 (commit) via c307e1c911dbbafb1673799212a4e5f4e211b9f8 (commit) via 2963c9828ce5193334d60b38b051f1ce59bb3df3 (commit) via 1df09e57732501454ac2bee900d2aad963a84969 (commit) from 1732a497c138c358229cde071a333c0ff645ab57 (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=523cf8a7d69df6442bd63023f3925451520bf04a commit 523cf8a7d69df6442bd63023f3925451520bf04a Merge: 1732a49 b898554 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 18 11:14:43 2013 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Mon Feb 18 11:14:43 2013 -0500 Merge topic 'compiler-change-cleanup' into next b898554 Merge branch 'master' into compiler-change-cleanup bff3d9c Test Unix Makefiles generator support for changing compilers c307e1c Tests/RunCMake: Allow tests to control build tree behavior 2963c98 Merge branch 'empty-compiler-crash' into compiler-change-cleanup 1df09e5 Delete entire CMakeFiles directory when deleting CMakeCache.txt (#13756) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b898554b6b8eab0a4c7775f7bcf4b67fcd0e50d4 commit b898554b6b8eab0a4c7775f7bcf4b67fcd0e50d4 Merge: bff3d9c a0ac2c5 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 18 11:02:23 2013 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Feb 18 11:02:23 2013 -0500 Merge branch 'master' into compiler-change-cleanup http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bff3d9ce0a5885dee6ee91f666372c6b22272231 commit bff3d9ce0a5885dee6ee91f666372c6b22272231 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 18 10:35:53 2013 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Feb 18 11:00:28 2013 -0500 Test Unix Makefiles generator support for changing compilers Add RunCMake.CompilerChange test to cover use of -DCMAKE_C_COMPILER=cc to change the compiler of an existing build tree. Also test for proper failure with -DCMAKE_C_COMPILER="". diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 320ebcc..c55bb3a 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -52,6 +52,9 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) endif() add_RunCMake_test(CMP0019) +if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") + add_RunCMake_test(CompilerChange) +endif() add_RunCMake_test(ExternalData) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorToolset) diff --git a/Tests/RunCMake/CompilerChange/CMakeLists.txt b/Tests/RunCMake/CompilerChange/CMakeLists.txt new file mode 100644 index 0000000..3b92518 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8) +if(NOT RunCMake_TEST) + set(RunCMake_TEST "$ENV{RunCMake_TEST}") # needed when cache is deleted +endif() +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-result.txt b/Tests/RunCMake/CompilerChange/EmptyCompiler-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt new file mode 100644 index 0000000..4745b25 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt @@ -0,0 +1,5 @@ +You have changed variables that require your cache to be deleted. +Configure will be re-run and you may have to reset some variables. +The following variables have changed: +CMAKE_C_COMPILER= *( +|$) diff --git a/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake new file mode 100644 index 0000000..c87ec49 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/EmptyCompiler.cmake @@ -0,0 +1,3 @@ +enable_language(C) +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/FindCompiler.cmake b/Tests/RunCMake/CompilerChange/FindCompiler.cmake new file mode 100644 index 0000000..297ab2f --- /dev/null +++ b/Tests/RunCMake/CompilerChange/FindCompiler.cmake @@ -0,0 +1,2 @@ +enable_language(C) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt b/Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt new file mode 100644 index 0000000..17621b7 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_C_COMPILER is ".*/Tests/RunCMake/CompilerChange/cc1.sh" diff --git a/Tests/RunCMake/CompilerChange/FirstCompiler.cmake b/Tests/RunCMake/CompilerChange/FirstCompiler.cmake new file mode 100644 index 0000000..c87ec49 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/FirstCompiler.cmake @@ -0,0 +1,3 @@ +enable_language(C) +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake b/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake new file mode 100644 index 0000000..75a4ffc --- /dev/null +++ b/Tests/RunCMake/CompilerChange/RunCMakeTest.cmake @@ -0,0 +1,55 @@ +include(RunCMake) + +# Detect the compiler in use in the current environment. +run_cmake(FindCompiler) +include(${RunCMake_BINARY_DIR}/FindCompiler-build/cc.cmake) +if(NOT CMAKE_C_COMPILER) + message(FATAL_ERROR "FindCompiler provided no compiler!") +endif() +if(NOT IS_ABSOLUTE "${CMAKE_C_COMPILER}") + message(FATAL_ERROR "FindCompiler provided non-absolute path \"${CMAKE_C_COMPILER}\"!") +endif() +if(NOT EXISTS "${CMAKE_C_COMPILER}") + message(FATAL_ERROR "FindCompiler provided non-existing path \"${CMAKE_C_COMPILER}\"!") +endif() + +# Wrap around the real compiler so we can change the compiler +# path without changing the underlying compiler. +set(ccIn ${RunCMake_SOURCE_DIR}/cc.sh.in) +set(cc1 ${RunCMake_BINARY_DIR}/cc1.sh) +set(cc2 ${RunCMake_BINARY_DIR}/cc2.sh) +set(cc3 CMAKE_C_COMPILER-NOTFOUND) +configure_file(${ccIn} ${cc1} @ONLY IMMEDIATE) +configure_file(${ccIn} ${cc2} @ONLY IMMEDIATE) + +# Use a single build tree for remaining tests without cleaning. +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ChangeCompiler-build) +set(RunCMake_TEST_NO_CLEAN 1) +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + +# Check build with compiler wrapper 1. +set(RunCMake_TEST_OPTIONS -DCMAKE_C_COMPILER=${cc1}) +set(ENV{RunCMake_TEST} "FirstCompiler") +run_cmake(FirstCompiler) +include(${RunCMake_TEST_BINARY_DIR}/cc.cmake) +if(NOT "${CMAKE_C_COMPILER}" STREQUAL "${cc1}") + message(FATAL_ERROR "FirstCompiler built with compiler:\n ${CMAKE_C_COMPILER}\nand not with:\n ${cc1}") +endif() + +# Check rebuild with compiler wrapper 2. +set(RunCMake_TEST_OPTIONS -DCMAKE_C_COMPILER=${cc2}) +set(ENV{RunCMake_TEST} "SecondCompiler") +run_cmake(SecondCompiler) +include(${RunCMake_TEST_BINARY_DIR}/cc.cmake) +if(NOT "${CMAKE_C_COMPILER}" STREQUAL "${cc2}") + message(FATAL_ERROR "SecondCompiler built with compiler:\n ${CMAKE_C_COMPILER}\nand not with:\n ${cc2}") +endif() + +# Check failure with an empty compiler string. +set(RunCMake_TEST_OPTIONS -DCMAKE_C_COMPILER=) +set(ENV{RunCMake_TEST} "EmptyCompiler") +run_cmake(EmptyCompiler) +include(${RunCMake_TEST_BINARY_DIR}/cc.cmake) +if(NOT "${CMAKE_C_COMPILER}" STREQUAL "${cc3}") + message(FATAL_ERROR "Empty built with compiler:\n ${CMAKE_C_COMPILER}\nand not with:\n ${cc3}") +endif() diff --git a/Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt b/Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt new file mode 100644 index 0000000..3a01c53 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt @@ -0,0 +1,4 @@ +You have changed variables that require your cache to be deleted. +Configure will be re-run and you may have to reset some variables. +The following variables have changed: +CMAKE_C_COMPILER=.*/Tests/RunCMake/CompilerChange/cc2.sh diff --git a/Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt b/Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt new file mode 100644 index 0000000..26ca964 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt @@ -0,0 +1 @@ +-- CMAKE_C_COMPILER is ".*/Tests/RunCMake/CompilerChange/cc2.sh" diff --git a/Tests/RunCMake/CompilerChange/SecondCompiler.cmake b/Tests/RunCMake/CompilerChange/SecondCompiler.cmake new file mode 100644 index 0000000..c87ec49 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/SecondCompiler.cmake @@ -0,0 +1,3 @@ +enable_language(C) +message(STATUS "CMAKE_C_COMPILER is \"${CMAKE_C_COMPILER}\"") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cc.cmake" "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\")\n") diff --git a/Tests/RunCMake/CompilerChange/cc.sh.in b/Tests/RunCMake/CompilerChange/cc.sh.in new file mode 100755 index 0000000..1d400e6 --- /dev/null +++ b/Tests/RunCMake/CompilerChange/cc.sh.in @@ -0,0 +1,2 @@ +#!/bin/sh +exec "@CMAKE_C_COMPILER@" "$@" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c307e1c911dbbafb1673799212a4e5f4e211b9f8 commit c307e1c911dbbafb1673799212a4e5f4e211b9f8 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 18 10:43:40 2013 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Feb 18 10:47:27 2013 -0500 Tests/RunCMake: Allow tests to control build tree behavior Teach the run_cmake to allow tests to set a custom test build directory. Also add an option to skip removing the build directory. diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 40b98d4..00faa4c 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -26,8 +26,12 @@ function(run_cmake test) endif() endforeach() set(RunCMake_TEST_SOURCE_DIR "${top_src}") - set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + if(NOT RunCMake_TEST_BINARY_DIR) + set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") + endif() + if(NOT RunCMake_TEST_NO_CLEAN) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + endif() file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") if(NOT DEFINED RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2963c9828ce5193334d60b38b051f1ce59bb3df3 commit 2963c9828ce5193334d60b38b051f1ce59bb3df3 Merge: 1df09e5 ccfeefa Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 18 10:07:03 2013 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Feb 18 10:07:03 2013 -0500 Merge branch 'empty-compiler-crash' into compiler-change-cleanup http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1df09e57732501454ac2bee900d2aad963a84969 commit 1df09e57732501454ac2bee900d2aad963a84969 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Feb 18 09:51:40 2013 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Feb 18 09:58:34 2013 -0500 Delete entire CMakeFiles directory when deleting CMakeCache.txt (#13756) Since commit e015df7d (...delete CMakeFiles directory when cache is deleted, 2006-02-20) we deleted the files in the CMakeFiles directory when deleting CMakeCache.txt in order to reset the build tree to a fresh state. This allowed commit fd33bf93 (fix for bug 6102, allow users to change the compiler, 2007-12-13) to delete CMakeCache.txt when the user changes the compiler and CMakeFiles/CMake<lang>Compiler.cmake and other platform information files would go with it to allow a fresh start. Then commit 7195aca5 (Make platform information files specific to the CMake version, 2012-08-24) moved the platform information files to a subdirectory e.g. CMakeFiles/<version>/CMake<lang>Compiler.cmake where <version> is the current CMake version. This causes the compiler change logic to fail to remove all old compiler information. Then on the next configuration CMake<lang>Compiler.cmake would set CMAKE_<lang>_COMPILER back to the old value and re-trigger the compiler change logic. This causes an infinite loop of cache deletion and compiler reset. Fix this simply by teaching cmCacheManager::DeleteCache to remove the entire CMakeFiles directory recursively whenever it removes an existing CMakeCache.txt. This fully resets the build tree to configure with a fresh compiler. diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 4231243..3d5b24b 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -584,23 +584,15 @@ bool cmCacheManager::DeleteCache(const char* path) cmSystemTools::ConvertToUnixSlashes(cacheFile); std::string cmakeFiles = cacheFile; cacheFile += "/CMakeCache.txt"; - cmSystemTools::RemoveFile(cacheFile.c_str()); - // now remove the files in the CMakeFiles directory - // this cleans up language cache files - cmsys::Directory dir; - cmakeFiles += cmake::GetCMakeFilesDirectory(); - dir.Load(cmakeFiles.c_str()); - for (unsigned long fileNum = 0; - fileNum < dir.GetNumberOfFiles(); - ++fileNum) - { - if(!cmSystemTools:: - FileIsDirectory(dir.GetFile(fileNum))) + if(cmSystemTools::FileExists(cacheFile.c_str())) + { + cmSystemTools::RemoveFile(cacheFile.c_str()); + // now remove the files in the CMakeFiles directory + // this cleans up language cache files + cmakeFiles += cmake::GetCMakeFilesDirectory(); + if(cmSystemTools::FileIsDirectory(cmakeFiles.c_str())) { - std::string fullPath = cmakeFiles; - fullPath += "/"; - fullPath += dir.GetFile(fileNum); - cmSystemTools::RemoveFile(fullPath.c_str()); + cmSystemTools::RemoveADirectory(cmakeFiles.c_str()); } } return true; ----------------------------------------------------------------------- Summary of changes: Source/cmCacheManager.cxx | 22 +++----- Tests/RunCMake/CMakeLists.txt | 3 + Tests/RunCMake/CompilerChange/CMakeLists.txt | 6 ++ .../EmptyCompiler-result.txt} | 0 .../CompilerChange/EmptyCompiler-stderr.txt | 5 ++ Tests/RunCMake/CompilerChange/EmptyCompiler.cmake | 3 + Tests/RunCMake/CompilerChange/FindCompiler.cmake | 2 + .../CompilerChange/FirstCompiler-stdout.txt | 1 + Tests/RunCMake/CompilerChange/FirstCompiler.cmake | 3 + Tests/RunCMake/CompilerChange/RunCMakeTest.cmake | 55 ++++++++++++++++++++ .../CompilerChange/SecondCompiler-stderr.txt | 4 ++ .../CompilerChange/SecondCompiler-stdout.txt | 1 + Tests/RunCMake/CompilerChange/SecondCompiler.cmake | 3 + Tests/RunCMake/CompilerChange/cc.sh.in | 2 + Tests/RunCMake/RunCMake.cmake | 8 ++- 15 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 Tests/RunCMake/CompilerChange/CMakeLists.txt copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CompilerChange/EmptyCompiler-result.txt} (100%) create mode 100644 Tests/RunCMake/CompilerChange/EmptyCompiler-stderr.txt create mode 100644 Tests/RunCMake/CompilerChange/EmptyCompiler.cmake create mode 100644 Tests/RunCMake/CompilerChange/FindCompiler.cmake create mode 100644 Tests/RunCMake/CompilerChange/FirstCompiler-stdout.txt create mode 100644 Tests/RunCMake/CompilerChange/FirstCompiler.cmake create mode 100644 Tests/RunCMake/CompilerChange/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CompilerChange/SecondCompiler-stderr.txt create mode 100644 Tests/RunCMake/CompilerChange/SecondCompiler-stdout.txt create mode 100644 Tests/RunCMake/CompilerChange/SecondCompiler.cmake create mode 100755 Tests/RunCMake/CompilerChange/cc.sh.in hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits