diff options
-rw-r--r-- | Modules/AutomocInfo.cmake.in | 2 | ||||
-rw-r--r-- | Source/cmDocumentVariables.cxx | 9 | ||||
-rw-r--r-- | Source/cmProjectCommand.cxx | 10 | ||||
-rw-r--r-- | Source/cmQtAutomoc.cxx | 25 | ||||
-rw-r--r-- | Source/cmQtAutomoc.h | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 2 | ||||
-rw-r--r-- | Source/kwsys/kwsysDateStamp.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeBuildTest.cmake.in | 12 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/DoubleProject/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/DoubleProject/silly.c | 4 | ||||
-rw-r--r-- | Tests/QtAutomoc/CMakeLists.txt | 3 |
12 files changed, 53 insertions, 31 deletions
diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in index 44f2da2cf3..29dab9759f 100644 --- a/Modules/AutomocInfo.cmake.in +++ b/Modules/AutomocInfo.cmake.in @@ -13,4 +13,4 @@ set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" ) set(AM_Qt5Core_VERSION_MAJOR "@Qt5Core_VERSION_MAJOR@" ) set(AM_TARGET_NAME "@_moc_target_name@") -set(AM_STRICT_MODE "@_moc_strict_mode@") +set(AM_RELAXED_MODE "@_moc_relaxed_mode@") diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index a0632a2b33..fe29df9bea 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -508,16 +508,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables That Change Behavior"); cm->DefineProperty - ("CMAKE_AUTOMOC_STRICT_MODE", cmProperty::VARIABLE, + ("CMAKE_AUTOMOC_RELAXED_MODE", cmProperty::VARIABLE, "Switch between strict and relaxed automoc mode.", - "When TRUE, automoc behaves exactly as described in the documentation " + "By default, automoc behaves exactly as described in the documentation " "of the AUTOMOC target property. " - "When set to FALSE, it accepts more input and tries to find the correct " + "When set to TRUE, it accepts more input and tries to find the correct " "input file for moc even if it differs from the documented behaviour. " "In this mode it e.g. also checks whether a header file is intended to " "be processed by moc when a \"foo.moc\" file has been included.\n" - "When using Qt4, CMAKE_AUTOMOC_STRICT_MODE is initialized to FALSE. " - "It also has to be set to FALSE for KDE4 compatibility.", + "Relaxed mode has to be enabled for KDE4 compatibility.", false, "Variables That Change Behavior"); diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 1a831d92a2..6e3b6afecc 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/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 65c7952d75..0d0d80cff7 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -119,11 +119,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) return; } - bool strictMode = (qtMajorVersion == "5"); - if (makefile->IsDefinitionSet("CMAKE_AUTOMOC_STRICT_MODE")) - { - strictMode = makefile->IsOn("CMAKE_AUTOMOC_STRICT_MODE"); - } + bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); // create a custom target for running automoc at buildtime: std::string automocTargetName = targetName; @@ -213,7 +209,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) makefile->AddDefinition("_moc_options", _moc_options.c_str()); makefile->AddDefinition("_moc_files", _moc_files.c_str()); makefile->AddDefinition("_moc_headers", _moc_headers.c_str()); - makefile->AddDefinition("_moc_strict_mode", strictMode ? "TRUE" : "FALSE"); + makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); std::string inputFile = cmakeRoot; @@ -313,7 +309,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); - this->StrictMode = makefile->IsOn("AM_STRICT_MODE"); + this->RelaxedMode = makefile->IsOn("AM_RELAXED_MODE"); return true; } @@ -509,7 +505,7 @@ bool cmQtAutomoc::RunAutomoc() { std::cout << "AUTOMOC: Checking " << absFilename << std::endl; } - if (this->StrictMode == false) + if (this->RelaxedMode) { this->ParseCppFile(absFilename, headerExtensions, includedMocs); } @@ -702,8 +698,9 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, "includes the moc file \"" << currentMoc << "\", but does not contain a Q_OBJECT macro. " "Running moc on " - << "\"" << headerToMoc << "\" ! Better include \"moc_" - << basename << ".cpp\" for a robust build.\n" + << "\"" << headerToMoc << "\" ! Include \"moc_" + << basename << ".cpp\" for a compatiblity with " + "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" << std::endl; } else @@ -712,8 +709,9 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, "includes the moc file \"" << currentMoc << "\" instead of \"moc_" << basename << ".cpp\". " "Running moc on " - << "\"" << headerToMoc << "\" ! Better include \"moc_" - << basename << ".cpp\" for a robust build.\n" + << "\"" << headerToMoc << "\" ! Include \"moc_" + << basename << ".cpp\" for compatiblity with " + "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" << std::endl; } } @@ -753,7 +751,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, "includes " << "\"" << ownMocUnderscoreFile << "\". Running moc on " << "\"" << absFilename << "\" ! Better include \"" - << scannedFileBasename << ".moc\" for a robust build.\n" + << scannedFileBasename << ".moc\" for compatiblity with " + "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" << std::endl; includedMocs[absFilename] = ownMocUnderscoreFile; includedMocs.erase(ownMocHeaderFile); diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index a31f36a33d..8cbbac19d2 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -85,7 +85,7 @@ private: bool ColorOutput; bool RunMocFailed; bool GenerateAll; - bool StrictMode; + bool RelaxedMode; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fc3c1c9e12..6a937b8d38 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -162,7 +162,7 @@ void cmTarget::DefineProperties(cmake *cm) "CMAKE_AUTOMOC if it is set when a target is created.\n" "Additional command line options for moc can be set via the " "AUTOMOC_MOC_OPTIONS property.\n" - "By setting the CMAKE_AUTOMOC_STRICT_MODE variable to FALSE the rules " + "By setting the CMAKE_AUTOMOC_RELAXED_MODE variable to TRUE the rules " "for searching the files which will be processed by moc can be relaxed. " "See the documentation for this variable for more details."); diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index b03f65691c..8849166452 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 16) +SET(KWSYS_DATE_STAMP_DAY 20) diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in index 9c3002bc9e..a8bb75090e 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 939bd21599..42b3ef79b9 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) diff --git a/Tests/DoubleProject/CMakeLists.txt b/Tests/DoubleProject/CMakeLists.txt new file mode 100644 index 0000000000..02a6275970 --- /dev/null +++ b/Tests/DoubleProject/CMakeLists.txt @@ -0,0 +1,3 @@ +project(dumb) +project(dumber) +add_executable(just_silly silly.c) diff --git a/Tests/DoubleProject/silly.c b/Tests/DoubleProject/silly.c new file mode 100644 index 0000000000..f8b643afbf --- /dev/null +++ b/Tests/DoubleProject/silly.c @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index ebfb4f5fb7..d255a5a7d0 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -10,6 +10,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_definitions(-DFOO) +# enable relaxed mode so automoc can handle all the special cases: +set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) + # create an executable and a library target, both requiring automoc: add_library(codeeditorLib STATIC codeeditor.cpp) |