From ba89e92ba622ed821a6adf31e8a6633d574ff656 Mon Sep 17 00:00:00 2001 From: "Aaron C. Meadows" Date: Thu, 16 Feb 2012 15:27:05 -0600 Subject: Visual Studio: Allow setting Single Byte Character Set (#12189) For Visual Studio using the Preprocessor Define _SBCS. This behavior is similar to the way that _UNICODE and _MBCS work already. Added tests to confirm this behavior. --- Source/cmLocalVisualStudio7Generator.cxx | 4 ++++ Source/cmVisualStudio10TargetGenerator.cxx | 5 +++++ Source/cmVisualStudioGeneratorOptions.cxx | 14 ++++++++++++++ Source/cmVisualStudioGeneratorOptions.h | 1 + Tests/CMakeLists.txt | 2 ++ Tests/SBCS/CMakeLists.txt | 6 ++++++ Tests/SBCS/SBCS.cxx | 22 ++++++++++++++++++++++ 7 files changed, 54 insertions(+) create mode 100644 Tests/SBCS/CMakeLists.txt create mode 100644 Tests/SBCS/SBCS.cxx diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 11a0387..a23d6a1 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -774,6 +774,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { fout << "\t\t\tCharacterSet=\"1\">\n"; } + else if(targetOptions.UsingSBCS()) + { + fout << "\t\t\tCharacterSet=\"0\">\n"; + } else { fout << "\t\t\tCharacterSet=\"2\">\n"; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9418761..ab74265 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -394,6 +394,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { this->WriteString("Unicode\n", 2); } + else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + this->ClOptions[*i]->UsingSBCS()) + { + this->WriteString("NotSet\n", 2); + } else { this->WriteString("MultiByte\n", 2); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 41230e7..9369af6 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -117,6 +117,20 @@ bool cmVisualStudioGeneratorOptions::UsingUnicode() } return false; } +//---------------------------------------------------------------------------- +bool cmVisualStudioGeneratorOptions::UsingSBCS() +{ + // Look for the a _SBCS definition. + for(std::vector::const_iterator di = this->Defines.begin(); + di != this->Defines.end(); ++di) + { + if(*di == "_SBCS") + { + return true; + } + } + return false; +} //---------------------------------------------------------------------------- void cmVisualStudioGeneratorOptions::Parse(const char* flags) diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 51a1362..a1a55da 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -48,6 +48,7 @@ public: // Check for specific options. bool UsingUnicode(); + bool UsingSBCS(); bool IsDebug(); // Write options to output. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c97828..da656d4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1306,6 +1306,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") + ADD_TEST_MACRO(SBCS SBCS) + ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSExternalInclude" diff --git a/Tests/SBCS/CMakeLists.txt b/Tests/SBCS/CMakeLists.txt new file mode 100644 index 0000000..b3c3c2c --- /dev/null +++ b/Tests/SBCS/CMakeLists.txt @@ -0,0 +1,6 @@ +# a SBCS test case +project (SBCS) + +add_definitions(-D_SBCS) + +add_executable (SBCS SBCS.cxx) diff --git a/Tests/SBCS/SBCS.cxx b/Tests/SBCS/SBCS.cxx new file mode 100644 index 0000000..6ce2c9f --- /dev/null +++ b/Tests/SBCS/SBCS.cxx @@ -0,0 +1,22 @@ +// Test to verify that _SBCS being defined causes CharacterSet to be set to 0 (Single Byte Character Set) + +int main () +{ +#ifdef _UNICODE + bool UnicodeSet=true; +#else + bool UnicodeSet=false; +#endif + +#ifdef _MBCS + bool MBCSSet=true; +#else + bool MBCSSet=false; +#endif + + // if neither _UNICODE nor _MBCS is set, CharacterSet must be set to SBCS. + bool SBCSSet=(!UnicodeSet && !MBCSSet); + + // Reverse boolean to indicate error case correctly + return !SBCSSet; +} -- cgit v0.12 From 9090572f5cdde7b30d2c1ad1c0bbf4ab86ddb969 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 17 Feb 2012 12:41:39 -0500 Subject: Add ability to include a file in a project via a cache variable. If a variable exists called CMAKE_PROJECT__INCLUDE, the file pointed to by that variable will be included as the last step of the project command. --- Source/cmProjectCommand.cxx | 18 ++++++++++++++++++ Source/cmProjectCommand.h | 5 ++++- Tests/CMakeOnly/CMakeLists.txt | 8 ++++++++ Tests/CMakeOnly/ProjectInclude/CMakeLists.txt | 4 ++++ Tests/CMakeOnly/ProjectInclude/include.cmake | 1 + Tests/CMakeOnly/Test.cmake.in | 3 ++- 6 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 Tests/CMakeOnly/ProjectInclude/CMakeLists.txt create mode 100644 Tests/CMakeOnly/ProjectInclude/include.cmake diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 6e3b6af..4c1abcf 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -77,6 +77,24 @@ bool cmProjectCommand languages.push_back("CXX"); } this->Makefile->EnableLanguage(languages, false); + std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE"; + const char* include = this->Makefile->GetDefinition(extraInclude.c_str()); + if(include) + { + std::string fullFilePath; + bool readit = + this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), + include); + if(!readit && !cmSystemTools::GetFatalErrorOccured()) + { + std::string m = + "could not find load file:\n" + " "; + m += include; + this->SetError(m.c_str()); + return false; + } + } return true; } diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index fc2b7a2..1e5fc09 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -68,7 +68,10 @@ public: "By default C and CXX are enabled. E.g. if you do not have a " "C++ compiler, you can disable the check for it by explicitly listing " "the languages you want to support, e.g. C. By using the special " - "language \"NONE\" all checks for any language can be disabled."; + "language \"NONE\" all checks for any language can be disabled. " + "If a variable exists called CMAKE_PROJECT__INCLUDE_FILE, " + "the file pointed to by that variable will be included as the last step " + "of the project command."; } cmTypeMacro(cmProjectCommand, cmCommand); diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 4407efb..629f578 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -22,3 +22,11 @@ add_CMakeOnly_test(CheckLanguage) add_CMakeOnly_test(AllFindModules) add_CMakeOnly_test(TargetScope) + +add_CMakeOnly_test(ProjectInclude) + +add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} + -DTEST=ProjectInclude + -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) diff --git a/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt new file mode 100644 index 0000000..a9abb4a --- /dev/null +++ b/Tests/CMakeOnly/ProjectInclude/CMakeLists.txt @@ -0,0 +1,4 @@ +project(ProjectInclude) +if(NOT AUTO_INCLUDE) + message(FATAL_ERROR "include file not found") +endif() diff --git a/Tests/CMakeOnly/ProjectInclude/include.cmake b/Tests/CMakeOnly/ProjectInclude/include.cmake new file mode 100644 index 0000000..527ebe7 --- /dev/null +++ b/Tests/CMakeOnly/ProjectInclude/include.cmake @@ -0,0 +1 @@ +set(AUTO_INCLUDE TRUE) diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in index aa2d093..42af068 100644 --- a/Tests/CMakeOnly/Test.cmake.in +++ b/Tests/CMakeOnly/Test.cmake.in @@ -3,7 +3,8 @@ set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build") file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") execute_process( - COMMAND ${CMAKE_COMMAND} "${source_dir}" -G "@CMAKE_TEST_GENERATOR@" + COMMAND ${CMAKE_COMMAND} ${CMAKE_ARGS} + "${source_dir}" -G "@CMAKE_TEST_GENERATOR@" WORKING_DIRECTORY "${binary_dir}" RESULT_VARIABLE result ) -- cgit v0.12 From 3f78ced7c2318b23610c6a4ffdf727bde0efa529 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Feb 2012 14:14:16 -0500 Subject: Rename Modules/Platform/Windows-{Borland => Embarcadero}.cmake The Borland compiler is now the Embarcadero compiler. Rename the shared platform information file to reflect this. This does not change the interface, as old versions are still "Borland", but will allow new versions released by Embarcadero to be supported cleanly. --- Modules/Platform/Windows-Borland-C.cmake | 4 +- Modules/Platform/Windows-Borland-CXX.cmake | 4 +- Modules/Platform/Windows-Borland.cmake | 121 ----------------------------- Modules/Platform/Windows-Embarcadero.cmake | 121 +++++++++++++++++++++++++++++ 4 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 Modules/Platform/Windows-Borland.cmake create mode 100644 Modules/Platform/Windows-Embarcadero.cmake diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake index ebb74a1..c8abb65 100644 --- a/Modules/Platform/Windows-Borland-C.cmake +++ b/Modules/Platform/Windows-Borland-C.cmake @@ -1,2 +1,2 @@ -include(Platform/Windows-Borland) -__borland_language(C) +include(Platform/Windows-Embarcadero) +__embarcadero_language(C) diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake index 1260c0e..9704f8a 100644 --- a/Modules/Platform/Windows-Borland-CXX.cmake +++ b/Modules/Platform/Windows-Borland-CXX.cmake @@ -1,2 +1,2 @@ -include(Platform/Windows-Borland) -__borland_language(CXX) +include(Platform/Windows-Embarcadero) +__embarcadero_language(CXX) diff --git a/Modules/Platform/Windows-Borland.cmake b/Modules/Platform/Windows-Borland.cmake deleted file mode 100644 index 5c402bd..0000000 --- a/Modules/Platform/Windows-Borland.cmake +++ /dev/null @@ -1,121 +0,0 @@ - -#============================================================================= -# Copyright 2002-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# This module is shared by multiple languages; use include blocker. -if(__WINDOWS_BORLAND) - return() -endif() -set(__WINDOWS_BORLAND 1) - -SET(BORLAND 1) - -# Borland target type flags (bcc32 -h -t): -# -tW GUI App (implies -U__CONSOLE__) -# -tWC Console App (implies -D__CONSOLE__=1) -# -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) -# -tWM Enable threads (implies -D__MT__=1 -D_MT=1) -# -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) -# -# Notes: -# - The flags affect linking so we pass them to the linker. -# - The flags affect preprocessing so we pass them to the compiler. -# - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. -# - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. -set(_RTLDLL "-tWR -tW-") -set(_COMPILE_C "-c") -set(_COMPILE_CXX "-P -c") - -SET(CMAKE_LIBRARY_PATH_FLAG "-L") -SET(CMAKE_LINK_LIBRARY_FLAG "") - -SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") - -# uncomment these out to debug makefiles -#SET(CMAKE_START_TEMP_FILE "") -#SET(CMAKE_END_TEMP_FILE "") -#SET(CMAKE_VERBOSE_MAKEFILE 1) - -# Borland cannot handle + in the file name, so mangle object file name -SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") - -# extra flags for a win32 exe -SET(CMAKE_CREATE_WIN32_EXE "-tW" ) -# extra flags for a console app -SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) - -SET (CMAKE_BUILD_TYPE Debug CACHE STRING - "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") - -SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - -macro(__borland_language lang) - set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD") - - # compile a source file into an object file - # place outside the response file because Borland refuses - # to parse quotes from the response file. - set(CMAKE_${lang}_COMPILE_OBJECT - " ${_RTLDLL} ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" - ) - - set(CMAKE_${lang}_LINK_EXECUTABLE - " ${_RTLDLL} -e ${CMAKE_START_TEMP_FILE} ${CMAKE_END_TEMP_FILE}" - # "implib -c -w " - ) - - # place outside the response file because Borland refuses - # to parse quotes from the response file. - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" - ) - # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not - - # Create a module library. - set(CMAKE_${lang}_CREATE_SHARED_MODULE - " ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e ${CMAKE_END_TEMP_FILE}" - ) - - # Create an import library for another target. - set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY - "implib -c -w " - ) - - # Create a shared library. - # First create a module and then its import library. - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - ${CMAKE_${lang}_CREATE_SHARED_MODULE} - ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY} - ) - - # create a static library - set(CMAKE_${lang}_CREATE_STATIC_LIBRARY - "tlib ${CMAKE_START_TEMP_FILE}/p512 /a ${CMAKE_END_TEMP_FILE}" - ) - - # Initial configuration flags. - set(CMAKE_${lang}_FLAGS_INIT "-tWM") - set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od") - set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib") -endmacro() diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake new file mode 100644 index 0000000..a00f798 --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -0,0 +1,121 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_EMBARCADERO) + return() +endif() +set(__WINDOWS_EMBARCADERO 1) + +SET(BORLAND 1) + +# Borland target type flags (bcc32 -h -t): +# -tW GUI App (implies -U__CONSOLE__) +# -tWC Console App (implies -D__CONSOLE__=1) +# -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) +# -tWM Enable threads (implies -D__MT__=1 -D_MT=1) +# -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) +# +# Notes: +# - The flags affect linking so we pass them to the linker. +# - The flags affect preprocessing so we pass them to the compiler. +# - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. +# - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. +set(_RTLDLL "-tWR -tW-") +set(_COMPILE_C "-c") +set(_COMPILE_CXX "-P -c") + +SET(CMAKE_LIBRARY_PATH_FLAG "-L") +SET(CMAKE_LINK_LIBRARY_FLAG "") + +SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") + +# uncomment these out to debug makefiles +#SET(CMAKE_START_TEMP_FILE "") +#SET(CMAKE_END_TEMP_FILE "") +#SET(CMAKE_VERBOSE_MAKEFILE 1) + +# Borland cannot handle + in the file name, so mangle object file name +SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") + +# extra flags for a win32 exe +SET(CMAKE_CREATE_WIN32_EXE "-tW" ) +# extra flags for a console app +SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) + +SET (CMAKE_BUILD_TYPE Debug CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") + +SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + +macro(__embarcadero_language lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD") + + # compile a source file into an object file + # place outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_COMPILE_OBJECT + " ${_RTLDLL} ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" + ) + + set(CMAKE_${lang}_LINK_EXECUTABLE + " ${_RTLDLL} -e ${CMAKE_START_TEMP_FILE} ${CMAKE_END_TEMP_FILE}" + # "implib -c -w " + ) + + # place outside the response file because Borland refuses + # to parse quotes from the response file. + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "cpp32 ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" + ) + # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not + + # Create a module library. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + " ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e ${CMAKE_END_TEMP_FILE}" + ) + + # Create an import library for another target. + set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY + "implib -c -w " + ) + + # Create a shared library. + # First create a module and then its import library. + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + ${CMAKE_${lang}_CREATE_SHARED_MODULE} + ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY} + ) + + # create a static library + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + "tlib ${CMAKE_START_TEMP_FILE}/p512 /a ${CMAKE_END_TEMP_FILE}" + ) + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "-tWM") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od") + set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib") +endmacro() -- cgit v0.12 From bdbbf763d65a4040001188b2e2d05bdab4a35427 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 17 Feb 2012 14:17:32 -0500 Subject: Recognize Embarcadero compiler (#12604) The Borland compiler was re-branded as CodeGear during 2007-2009 and since 2009 is the Embarcadero compiler. They offer predefined macros: http://docwiki.embarcadero.com/RADStudio/en/Predefined_Macros and distinguish themselves by __CODEGEARC__ and __CODEGEARC_VERSION__. Version 6.30 (C++Builder XE) changed the meaning of some flags: http://docwiki.embarcadero.com/RADStudio/en/C%2B%2B_Compiler_Option_Changes_for_XE Teach Embarcadero compiler information files to generate build rules with flags matching the compiler version. Leave the flags unchanged for old Borland versions. Always set the BORLAND toolchain indicator for compatibility with existing projects that test it. Also set the EMBARCADERO indicator for newer toolchains. --- Modules/CMakeCCompilerId.c.in | 6 +++ Modules/CMakeCXXCompilerId.cpp.in | 6 +++ Modules/Platform/Windows-Borland-C.cmake | 3 +- Modules/Platform/Windows-Borland-CXX.cmake | 3 +- Modules/Platform/Windows-Embarcadero-C.cmake | 3 ++ Modules/Platform/Windows-Embarcadero-CXX.cmake | 3 ++ Modules/Platform/Windows-Embarcadero.cmake | 52 +++++++++++++++----------- 7 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 Modules/Platform/Windows-Embarcadero-C.cmake create mode 100644 Modules/Platform/Windows-Embarcadero-CXX.cmake diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index b0f5eb6..06aa9bf 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -26,6 +26,12 @@ # define COMPILER_VERSION_MINOR DEC(__clang_minor__) # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" /* __BORLANDC__ = 0xVRR */ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 927f7f4..95fc852 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -28,6 +28,12 @@ # define COMPILER_VERSION_MINOR DEC(__clang_minor__) # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF) + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" /* __BORLANDC__ = 0xVRR */ diff --git a/Modules/Platform/Windows-Borland-C.cmake b/Modules/Platform/Windows-Borland-C.cmake index c8abb65..e2f76aa 100644 --- a/Modules/Platform/Windows-Borland-C.cmake +++ b/Modules/Platform/Windows-Borland-C.cmake @@ -1,2 +1 @@ -include(Platform/Windows-Embarcadero) -__embarcadero_language(C) +include(Platform/Windows-Embarcadero-C) diff --git a/Modules/Platform/Windows-Borland-CXX.cmake b/Modules/Platform/Windows-Borland-CXX.cmake index 9704f8a..809490f 100644 --- a/Modules/Platform/Windows-Borland-CXX.cmake +++ b/Modules/Platform/Windows-Borland-CXX.cmake @@ -1,2 +1 @@ -include(Platform/Windows-Embarcadero) -__embarcadero_language(CXX) +include(Platform/Windows-Embarcadero-CXX) diff --git a/Modules/Platform/Windows-Embarcadero-C.cmake b/Modules/Platform/Windows-Embarcadero-C.cmake new file mode 100644 index 0000000..607fd4e --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero-C.cmake @@ -0,0 +1,3 @@ +set(_lang C) +include(Platform/Windows-Embarcadero) +__embarcadero_language(C) diff --git a/Modules/Platform/Windows-Embarcadero-CXX.cmake b/Modules/Platform/Windows-Embarcadero-CXX.cmake new file mode 100644 index 0000000..279a4de --- /dev/null +++ b/Modules/Platform/Windows-Embarcadero-CXX.cmake @@ -0,0 +1,3 @@ +set(_lang CXX) +include(Platform/Windows-Embarcadero) +__embarcadero_language(CXX) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index a00f798..87b3767 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2002-2009 Kitware, Inc. +# Copyright 2002-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -20,19 +20,26 @@ set(__WINDOWS_EMBARCADERO 1) SET(BORLAND 1) -# Borland target type flags (bcc32 -h -t): -# -tW GUI App (implies -U__CONSOLE__) -# -tWC Console App (implies -D__CONSOLE__=1) -# -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) -# -tWM Enable threads (implies -D__MT__=1 -D_MT=1) -# -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) -# -# Notes: -# - The flags affect linking so we pass them to the linker. -# - The flags affect preprocessing so we pass them to the compiler. -# - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. -# - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. -set(_RTLDLL "-tWR -tW-") +if("${CMAKE_${_lang}_COMPILER_VERSION}" VERSION_LESS 6.30) + # Borland target type flags (bcc32 -h -t): + set(_tW "-tW") # -tW GUI App (implies -U__CONSOLE__) + set(_tC "-tWC") # -tWC Console App (implies -D__CONSOLE__=1) + set(_tD "-tWD") # -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1) + set(_tM "-tWM") # -tWM Enable threads (implies -D__MT__=1 -D_MT=1) + set(_tR "-tWR -tW-") # -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!) + # Notes: + # - The flags affect linking so we pass them to the linker. + # - The flags affect preprocessing so we pass them to the compiler. + # - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead. + # - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs. +else() + set(EMBARCADERO 1) + set(_tC "-tC") # Target is a console application + set(_tD "-tD") # Target is a shared library + set(_tM "-tM") # Target is multi-threaded + set(_tR "-tR") # Target uses the dynamic RTL + set(_tW "-tW") # Target is a Windows application +endif() set(_COMPILE_C "-c") set(_COMPILE_CXX "-P -c") @@ -50,14 +57,14 @@ SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") # extra flags for a win32 exe -SET(CMAKE_CREATE_WIN32_EXE "-tW" ) +SET(CMAKE_CREATE_WIN32_EXE "${_tW}" ) # extra flags for a console app -SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" ) +SET(CMAKE_CREATE_CONSOLE_EXE "${_tC}" ) SET (CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") -SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ") +SET (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:10000000 -lSc:10000000 ") SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v") SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v") SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) @@ -67,18 +74,19 @@ SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + macro(__embarcadero_language lang) - set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # compile a source file into an object file # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - " ${_RTLDLL} ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" + " ${_tR} ${CMAKE_START_TEMP_FILE}-DWIN32 -o ${_COMPILE_${lang}} ${CMAKE_END_TEMP_FILE}" ) set(CMAKE_${lang}_LINK_EXECUTABLE - " ${_RTLDLL} -e ${CMAKE_START_TEMP_FILE} ${CMAKE_END_TEMP_FILE}" + " ${_tR} -e ${CMAKE_START_TEMP_FILE} ${CMAKE_END_TEMP_FILE}" # "implib -c -w " ) @@ -91,7 +99,7 @@ macro(__embarcadero_language lang) # Create a module library. set(CMAKE_${lang}_CREATE_SHARED_MODULE - " ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e ${CMAKE_END_TEMP_FILE}" + " ${_tR} ${_tD} ${CMAKE_START_TEMP_FILE}-e ${CMAKE_END_TEMP_FILE}" ) # Create an import library for another target. @@ -112,7 +120,7 @@ macro(__embarcadero_language lang) ) # Initial configuration flags. - set(CMAKE_${lang}_FLAGS_INIT "-tWM") + set(CMAKE_${lang}_FLAGS_INIT "${_tM}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG") -- cgit v0.12 From df19b9cadb5caca0f77ee87b8e28181e61c0658e Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 21 Feb 2012 11:29:06 -0500 Subject: VS6: Avoid _MBCS define when _SBCS is defined (#12189) Should fix the failing SBCS test on the VS6 dashboard. --- Source/cmLocalVisualStudio6Generator.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1dfcbea..fe5d48d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1605,11 +1605,13 @@ void cmLocalVisualStudio6Generator flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; } - - // if unicode is not found, then add -D_MBCS + + // if _UNICODE and _SBCS are not found, then add -D_MBCS std::string defs = this->Makefile->GetDefineFlags(); if(flags.find("D_UNICODE") == flags.npos && - defs.find("D_UNICODE") == flags.npos) + defs.find("D_UNICODE") == flags.npos && + flags.find("D_SBCS") == flags.npos && + defs.find("D_SBCS") == flags.npos) { flags += " /D \"_MBCS\""; } -- cgit v0.12 From fc6f3401373ccb169a7168c21366c5caee582319 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 11 Jan 2012 15:41:56 +0000 Subject: Don't use QT_LIBRARIES_PLUGINS by default. A lot of the libraries won't be found by default so will spit out all sorts of errors. Don't kill QT_LIBRARIES_PLUGINS altogether as it is sometimes useful. --- Modules/DeployQt4.cmake | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 83f322c..40779b3 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -264,10 +264,6 @@ function(install_qt4_executable executable) set(qt_plugins_dir "") endif() - if(NOT qtplugins AND QT_LIBRARIES_PLUGINS) - set(qtplugins "${QT_LIBRARIES_PLUGINS}") - endif() - foreach(plugin ${qtplugins}) set(installed_plugin_paths "") install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}") -- cgit v0.12 From a2123e8f3e04b3e1bd5507c488a22a358398232e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 16 Jan 2012 20:15:38 +0000 Subject: Fix mismatched arguments. --- Modules/DeployQt4.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 40779b3..ac9cc29 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -141,7 +141,7 @@ function(fixup_qt4_executable executable) foreach(plugin ${qtplugins}) set(installed_plugin_path "") - install_qt4_plugin("${plugin}" "${plugins_dir}" "${executable}" 1 installed_plugin_path) + install_qt4_plugin("${plugin}" "${executable}" 1 installed_plugin_path) list(APPEND libs ${installed_plugin_path}) endforeach() -- cgit v0.12 From 0ac15353e0220e296aca1bb725fc495c1321e4e6 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 11 Jan 2012 15:39:12 +0000 Subject: Fix bad plugin paths. --- Modules/DeployQt4.cmake | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index ac9cc29..aba339a 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -82,6 +82,7 @@ include(BundleUtilities) set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}") +set(DeployQt4_apple_plugins_dir "PlugIns") function(write_qt4_conf qt_conf_dir qt_conf_contents) set(qt_conf_path "${qt_conf_dir}/qt.conf") @@ -130,6 +131,9 @@ function(fixup_qt4_executable executable) set(qt_conf_dir "${executable}/Contents/Resources") set(executable_path "${executable}") set(write_qt_conf TRUE) + if(NOT plugins_dir) + set(plugins_dir "${DeployQt4_apple_plugins_dir}") + endif() else() get_filename_component(executable_path "${executable}" PATH) if(NOT executable_path) @@ -166,23 +170,19 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va set(component ${ARGV5}) set(configurations ${ARGV6}) if(EXISTS "${plugin}") - if(plugins_dir) - set(plugins_dir "${plugins_dir}") - else() - if(APPLE) - set(plugins_dir "PlugIns") - else() - set(plugins_dir "plugins") - endif() - endif() if(APPLE) + if(NOT plugins_dir) + set(plugins_dir "${DeployQt4_apple_plugins_dir}") + endif() set(plugins_path "${executable}/Contents/${plugins_dir}") else() - get_filename_component(executable_path "${executable}" PATH) - if(NOT executable_path) - set(executable_path ".") + get_filename_component(plugins_path "${executable}" PATH) + if(NOT plugins_path) + set(plugins_path ".") + endif() + if(plugins_dir) + set(plugins_path "${plugins_path}/${plugins_dir}") endif() - set(plugins_path "${executable_path}/${plugins_dir}") endif() set(plugin_group "") -- cgit v0.12 From 35cbf23c951e545560e11d79074a66988345c9eb Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 21 Feb 2012 17:10:39 +0000 Subject: Ensure libs are passed to BundleUtilities. --- Modules/DeployQt4.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index aba339a..a5051df 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -210,7 +210,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va endif() install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component}) endif() - set(${installed_plugin_path_var} ${${installed_path_var}} "${plugins_path}/${plugin_name}" PARENT_SCOPE) + set(${installed_plugin_path_var} "${plugins_path}/${plugin_name}" PARENT_SCOPE) endif() endfunction() @@ -235,7 +235,7 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel") install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Debug") endif() - set(installed_plugin_path_var "${installed_plugin_path_var}" PARENT_SCOPE) + set(installed_plugin_paths ${${installed_plugin_path_var}} PARENT_SCOPE) endfunction() function(install_qt4_executable executable) -- cgit v0.12 From 40efa4db7462312ab9b2c82e601acba0ab67ca19 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 21 Feb 2012 23:54:01 +0100 Subject: Fix documented function signature to match reality. The function description is already correct. --- Modules/GenerateExportHeader.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f3f61f6..0d9a3b8 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -18,7 +18,7 @@ # [PREFIX_NAME ] # ) # -# ADD_COMPILER_EXPORT_FLAGS( [FATAL_WARNINGS] ) +# ADD_COMPILER_EXPORT_FLAGS( [] ) # # By default GENERATE_EXPORT_HEADER() generates macro names in a file name # determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function -- cgit v0.12 From bbddaeef7e2c65994812ccee0a92744f4777175c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 21 Feb 2012 20:52:27 +0100 Subject: FindPython{Interp,Libs}: document Python_ADDITIONAL_VERSIONS as input The current documentation could be read as if that variable is output from the module, which is nonsense. --- Modules/FindPythonInterp.cmake | 4 +++- Modules/FindPythonLibs.cmake | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 5c1d56b..930f675 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -10,7 +10,9 @@ # PYTHON_VERSION_MINOR - Python minor version found e.g. 5 # PYTHON_VERSION_PATCH - Python patch version found e.g. 2 # -# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for +# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of +# version numbers that should be taken into account when searching for Python. +# You need to set this variable before calling find_package(PythonInterp). #============================================================================= # Copyright 2005-2010 Kitware, Inc. diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index da7a1ac..049a36f 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -8,7 +8,10 @@ # PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) # PYTHON_INCLUDE_DIRS - path to where Python.h is found # PYTHON_DEBUG_LIBRARIES - path to the debug library -# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for +# +# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of +# version numbers that should be taken into account when searching for Python. +# You need to set this variable before calling find_package(PythonLibs). #============================================================================= # Copyright 2001-2009 Kitware, Inc. -- cgit v0.12 From f7723786e7ecdd29a430df396d6cce64b9ccdcb6 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 21 Feb 2012 21:00:15 +0100 Subject: FindPythonLibs: make the version selection work as for PythonInterp --- Modules/FindPythonLibs.cmake | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 049a36f..8ba2d39 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -30,11 +30,42 @@ INCLUDE(CMakeFindFrameworks) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) +SET(_PYTHON1_VERSIONS 1.6 1.5) +SET(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +SET(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) + +IF(PythonLibs_FIND_VERSION) + IF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") + STRING(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + UNSET(_PYTHON_FIND_OTHER_VERSIONS) + IF(NOT PythonLibs_FIND_VERSION_EXACT) + FOREACH(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + IF(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) + LIST(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) + ENDIF() + ENDFOREACH() + ENDIF(NOT PythonLibs_FIND_VERSION_EXACT) + UNSET(_PYTHON_FIND_MAJ_MIN) + UNSET(_PYTHON_FIND_MAJ) + ELSE(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + ENDIF(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") +ELSE(PythonLibs_FIND_VERSION) + SET(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) +ENDIF(PythonLibs_FIND_VERSION) + # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -set(_Python_VERSIONS +SET(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS} - 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + ${_PYTHON_FIND_OTHER_VERSIONS} + ) + +UNSET(_PYTHON_FIND_OTHER_VERSIONS) +UNSET(_PYTHON1_VERSIONS) +UNSET(_PYTHON2_VERSIONS) +UNSET(_PYTHON3_VERSIONS) FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) -- cgit v0.12 From c9c1a176092593ce7c47e7a473e24363d9395c79 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 21 Feb 2012 21:12:16 +0100 Subject: FindPythonLibs: get the exact version of the found library (#3080) --- Modules/FindPythonLibs.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 8ba2d39..9401dbb 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -8,6 +8,7 @@ # PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) # PYTHON_INCLUDE_DIRS - path to where Python.h is found # PYTHON_DEBUG_LIBRARIES - path to the debug library +# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8) # # The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of # version numbers that should be taken into account when searching for Python. @@ -126,6 +127,14 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}" CACHE INTERNAL "Path to where Python.h is found (deprecated)") + IF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + FILE(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str + REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") + STRING(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + PYTHONLIBS_VERSION_STRING "${python_version_str}") + UNSET(python_version_str) + ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + ENDFOREACH(_CURRENT_VERSION) MARK_AS_ADVANCED( @@ -144,8 +153,9 @@ SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs DEFAULT_MSG PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) - +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs + REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS + VERSION_VAR PYTHONLIBS_VERSION_STRING) # PYTHON_ADD_MODULE( src1 src2 ... srcN) is used to build modules for python. # PYTHON_WRITE_MODULES_HEADER() writes a header file you can include -- cgit v0.12 From 0110262a2d93da0911f7439ac5fba4e18b29757e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 22 Feb 2012 17:47:52 +0100 Subject: FindOpenMP: simplify check for enabled languages --- Modules/FindOpenMP.cmake | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index e1af15e..b96a2ec 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -25,11 +25,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -get_property(_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -list(FIND _ENABLED_LANGUAGES "C" _HAVE_LANGUAGE_C) -list(FIND _ENABLED_LANGUAGES "CXX" _HAVE_LANGUAGE_CXX) -unset(_ENABLED_LANGUAGES) - set(_OPENMP_REQUIRED_VARS) function(_OPENMP_FLAG_CANDIDATES LANG) @@ -93,7 +88,7 @@ int main() { ") # check c compiler -if(NOT _HAVE_LANGUAGE_C EQUAL -1) +if(CMAKE_C_COMPILER_LOADED) # if these are set then do not try to find them again, # by avoiding any try_compiles for the flags if(OpenMP_C_FLAGS) @@ -124,7 +119,7 @@ if(NOT _HAVE_LANGUAGE_C EQUAL -1) endif() # check cxx compiler -if(NOT _HAVE_LANGUAGE_CXX EQUAL -1) +if(CMAKE_CXX_COMPILER_LOADED) # if these are set then do not try to find them again, # by avoiding any try_compiles for the flags if(OpenMP_CXX_FLAGS) @@ -158,9 +153,6 @@ if(NOT _HAVE_LANGUAGE_CXX EQUAL -1) unset(OpenMP_CXX_TEST_SOURCE) endif() -unset(_HAVE_LANGUAGE_C) -unset(_HAVE_LANGUAGE_CXX) - if(_OPENMP_REQUIRED_VARS) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -- cgit v0.12 From d90eed445fe6cfe4d5998813d4cb24151f8d8f9d Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 16:38:17 -0500 Subject: Fix compiler error reported on older Borland dashboard. Declare variable only once at a scope appropriate for both uses. --- Source/cmDepends.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 94ff471..b511f65 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -261,11 +261,12 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, void cmDepends::SetIncludePathFromLanguage(const char* lang) { // Look for the new per "TARGET_" variant first: + const char * includePath = 0; std::string includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_TARGET_INCLUDE_PATH"; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if(const char* includePath = mf->GetDefinition(includePathVar.c_str())) + if(includePath = mf->GetDefinition(includePathVar.c_str())) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } @@ -275,7 +276,7 @@ void cmDepends::SetIncludePathFromLanguage(const char* lang) includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_INCLUDE_PATH"; - if(const char* includePath = mf->GetDefinition(includePathVar.c_str())) + if(includePath = mf->GetDefinition(includePathVar.c_str())) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } -- cgit v0.12 From f66e735de393c25408d9e955aa8f27c9611ac245 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 22 Feb 2012 17:12:11 -0500 Subject: Fix compiler warning reported on older Borland dashboard. Avoid assignment inside the if. --- Source/cmDepends.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index b511f65..9296d4c 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -266,7 +266,8 @@ void cmDepends::SetIncludePathFromLanguage(const char* lang) includePathVar += lang; includePathVar += "_TARGET_INCLUDE_PATH"; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - if(includePath = mf->GetDefinition(includePathVar.c_str())) + includePath = mf->GetDefinition(includePathVar.c_str()); + if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } @@ -276,7 +277,8 @@ void cmDepends::SetIncludePathFromLanguage(const char* lang) includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_INCLUDE_PATH"; - if(includePath = mf->GetDefinition(includePathVar.c_str())) + includePath = mf->GetDefinition(includePathVar.c_str()); + if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); } -- cgit v0.12 From e8e964f675dc2475e871a13bb5dae99ef7a40201 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 23 Feb 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index baf15ad..33c8c08 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 22) +SET(KWSYS_DATE_STAMP_DAY 23) -- cgit v0.12 From d662dff7690ae4a3b22947f07de4fc952c33e568 Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 23 Feb 2012 08:11:09 -0500 Subject: Fix shadowed variable warning on dashboard results --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d206d32..7cd82ba 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2132,7 +2132,7 @@ void cmMakefile::ExpandVariables() l != this->Targets.end(); ++l) { cmTarget &t = l->second; - const char *includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); + includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); if (includeDirs) { std::string dirs = includeDirs; -- cgit v0.12 From aca1121ea6d7aca8634d07a07fe150344ce13e40 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 23 Feb 2012 18:39:23 +0100 Subject: UseSWIG: clean up string compares --- Modules/UseSWIG.cmake | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 2a83045..ef76724 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -47,20 +47,17 @@ MACRO(SWIG_MODULE_INITIALIZE name language) SET(SWIG_MODULE_${name}_LANGUAGE "${swig_uppercase_language}") SET(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - MESSAGE(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xUNKNOWNx$") - SET(SWIG_MODULE_${name}_REAL_NAME "${name}") - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") + IF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") + MESSAGE(FATAL_ERROR "SWIG Error: Language \"${language}\" not found") + ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PYTHON") # when swig is used without the -interface it will produce in the module.py # a 'import _modulename' statement, which implies having a corresponding # _modulename.so (*NIX), _modulename.pyd (Win32). SET(SWIG_MODULE_${name}_REAL_NAME "_${name}") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") - IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") + ELSEIF("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "PERL") SET(SWIG_MODULE_${name}_EXTRA_FLAGS "-shadow") - ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") + ENDIF() ENDMACRO(SWIG_MODULE_INITIALIZE) # -- cgit v0.12 From 91d5a2a386051cb7903044267c5364402bbe190b Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 21 Feb 2012 21:40:02 +0100 Subject: FindPythonLibs: put debug libraries into PYTHON_LIBRARIES --- Modules/FindPythonLibs.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 9401dbb..c9a240c 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -7,7 +7,7 @@ # PYTHON_LIBRARIES - path to the python library # PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) # PYTHON_INCLUDE_DIRS - path to where Python.h is found -# PYTHON_DEBUG_LIBRARIES - path to the debug library +# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated) # PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8) # # The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of @@ -134,7 +134,6 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) PYTHONLIBS_VERSION_STRING "${python_version_str}") UNSET(python_version_str) ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") - ENDFOREACH(_CURRENT_VERSION) MARK_AS_ADVANCED( @@ -148,9 +147,18 @@ MARK_AS_ADVANCED( # library. We now set the variables listed by the documentation for this # module. SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") -SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") +# These variables have been historically named in this module different from +# what SELECT_LIBRARY_CONFIGURATIONS() expects. +SET(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}") +SET(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}") +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) +SELECT_LIBRARY_CONFIGURATIONS(PYTHON) +# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library. +# Unset this, this prefix doesn't match the module prefix, they are different +# for historical reasons. +UNSET(PYTHON_FOUND) INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs -- cgit v0.12 From 53d02ea1eae3af89c6802f3f9c32c0284d6e3367 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 22 Feb 2012 17:25:08 +0100 Subject: FindPythonLibs: stop scanning when libraries are found --- Modules/FindPythonLibs.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index c9a240c..fcd0838 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -134,6 +134,10 @@ FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) PYTHONLIBS_VERSION_STRING "${python_version_str}") UNSET(python_version_str) ENDIF(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h") + + IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) + BREAK() + ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) ENDFOREACH(_CURRENT_VERSION) MARK_AS_ADVANCED( -- cgit v0.12 From 4853e1effddd36c37d8e2fb4962f039c0d08af80 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 21 Feb 2012 17:11:28 +0000 Subject: Fix plugin installation issues. --- Modules/DeployQt4.cmake | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index a5051df..8a5e9c5 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -220,11 +220,7 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) if(EXISTS "${plugin}") install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}") else() - if(QT_IS_STATIC) - string(TOUPPER "QT_${plugin}_LIBRARY" plugin_var) - else() - string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var) - endif() + string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var) set(plugin_release_var "${plugin_var}_RELEASE") set(plugin_debug_var "${plugin_var}_DEBUG") set(plugin_release "${${plugin_release_var}}") @@ -232,10 +228,24 @@ function(install_qt4_plugin plugin executable copy installed_plugin_path_var) if(DEFINED "${plugin_release_var}" AND DEFINED "${plugin_debug_var}" AND NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}") message(WARNING "Qt plugin \"${plugin}\" not recognized or found.") endif() - install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel") - install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Debug") + if(NOT EXISTS "${${plugin_debug_var}}") + set(plugin_debug "${plugin_release}") + endif() + + if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}_release" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel") + install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}_debug" "${plugins_dir}" "${component}" "Debug") + + if(CMAKE_BUILD_TYPE MATCHES "^Debug$") + set(${installed_plugin_path_var} ${${installed_plugin_path_var}_debug}) + else() + set(${installed_plugin_path_var} ${${installed_plugin_path_var}_release}) + endif() + else() + install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}") + endif() endif() - set(installed_plugin_paths ${${installed_plugin_path_var}} PARENT_SCOPE) + set(${installed_plugin_path_var} ${${installed_plugin_path_var}} PARENT_SCOPE) endfunction() function(install_qt4_executable executable) @@ -264,11 +274,15 @@ function(install_qt4_executable executable) set(qt_plugins_dir "") endif() - foreach(plugin ${qtplugins}) - set(installed_plugin_paths "") - install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}") - list(APPEND libs ${installed_plugin_paths}) - endforeach() + if(QT_IS_STATIC) + message(WARNING "Qt built statically: not installing plugins.") + else() + foreach(plugin ${qtplugins}) + set(installed_plugin_paths "") + install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${component}") + list(APPEND libs ${installed_plugin_paths}) + endforeach() + endif() resolve_qt4_paths(libs) -- cgit v0.12 From f6ecb900fb1bed7fc74e3c7d7091c6e796c099d3 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 23 Feb 2012 23:08:04 +0100 Subject: Check{C,CXX}CompilerFlag: detect ICC error messages Patch provided by Christopher Sean Morrison. --- Modules/CheckCCompilerFlag.cmake | 1 + Modules/CheckCXXCompilerFlag.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 3618bdf..1c08c59 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -33,6 +33,7 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "ignoring unknown option" # MSVC FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "option .*not supported" # Intel FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 134f875..6fa69b1 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -33,6 +33,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "ignoring unknown option" # MSVC FAIL_REGEX "warning D9002" # MSVC, any lang + FAIL_REGEX "option .*not supported" # Intel FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL -- cgit v0.12 From 672e3bb70f46cbc1203974fccc561760a6be8b96 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 20 Jan 2012 16:30:35 -0700 Subject: Add test for DeployQt4.cmake --- Tests/CMakeLists.txt | 21 +++++++++++++ Tests/Qt4Deploy/CMakeLists.txt | 70 ++++++++++++++++++++++++++++++++++++++++++ Tests/Qt4Deploy/testdeploy.cpp | 29 +++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 Tests/Qt4Deploy/CMakeLists.txt create mode 100644 Tests/Qt4Deploy/testdeploy.cpp diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c97828..2e72dec 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -227,12 +227,16 @@ IF(BUILD_TESTING) LIST(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX}) + IF(NOT QT4_FOUND) + FIND_PACKAGE(Qt4) + ENDIF(NOT QT4_FOUND) # run test for BundleUtilities on supported platforms/compilers if(MSVC OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin") if(NOT "${CMAKE_TEST_GENERATOR}" STREQUAL "Watcom WMake") + ADD_TEST(BundleUtilities ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/BundleUtilities" @@ -242,6 +246,23 @@ IF(BUILD_TESTING) --build-project BundleUtilities ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleUtilities") + + # run test for DeployQt4 on supported platforms/compilers (which depends on BundleUtilities) + # this test also depends on the existence of the standard qtiff plugin + if(QT4_FOUND) + ADD_TEST(Qt4Deploy ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Qt4Deploy" + "${CMake_BINARY_DIR}/Tests/Qt4Deploy" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project Qt4Deploy + --build-options + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + ) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Deploy") + endif() + endif() endif() diff --git a/Tests/Qt4Deploy/CMakeLists.txt b/Tests/Qt4Deploy/CMakeLists.txt new file mode 100644 index 0000000..ccacf74 --- /dev/null +++ b/Tests/Qt4Deploy/CMakeLists.txt @@ -0,0 +1,70 @@ +cmake_minimum_required(VERSION 2.8) + +project(Qt4Deploy) +set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install) + +find_package(Qt4 REQUIRED QtMain QtCore QtGui QtSql) +include(${QT_USE_FILE}) + +add_executable(testdeploy MACOSX_BUNDLE testdeploy.cpp) +target_link_libraries(testdeploy ${QT_LIBRARIES}) +set_target_properties(testdeploy PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}") + +if(CMAKE_CONFIGURATION_TYPES AND QT_QTCORE_LIBRARY_RELEASE AND QT_QTCORE_LIBRARY_DEBUG) + # note: installing debug Qt libraries from a Qt installation configured with + # -debug-and-release not yet supported (very low priority). + install(CODE " + if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\") + return() + endif() + ") +endif() + +# install the Qt4 app with qsqlite plugin +install(CODE "file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}\")") +install(TARGETS testdeploy DESTINATION .) +include(../../Modules/DeployQt4.cmake) +if(APPLE) + install_qt4_executable(testdeploy.app "qsqlite") +elseif(WIN32) + install_qt4_executable(testdeploy.exe "qsqlite") +else() + install_qt4_executable(testdeploy "qsqlite") +endif() + + +# test depends on standard qsqlite plugin +if(QT_QSQLITE_PLUGIN_DEBUG OR QT_QSQLITE_PLUGIN_RELEASE) + + # test the deployed Qt application + if(APPLE) + install(CODE " + message(STATUS \"executing: ${CMAKE_INSTALL_PREFIX}/testdeploy.app/Contents/MacOS/testdeploy\") + execute_process(COMMAND \"${CMAKE_INSTALL_PREFIX}/testdeploy.app/Contents/MacOS/testdeploy\" + RESULT_VARIABLE result) + if(NOT result STREQUAL \"0\") + message(FATAL_ERROR \"error running testdeploy app\") + endif() + ") + else() + install(CODE " + message(STATUS \"executing: ${CMAKE_INSTALL_PREFIX}/testdeploy\") + execute_process(COMMAND \"${CMAKE_INSTALL_PREFIX}/testdeploy\" + RESULT_VARIABLE result) + if(NOT result STREQUAL \"0\") + message(FATAL_ERROR \"error running testdeploy app\") + endif() + ") + endif() + + # custom target to install and test the installation at build time + if(CMAKE_CONFIGURATION_TYPES) + set(install_config "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") + endif() + + add_custom_target(testdeploy_test ALL + COMMAND ${CMAKE_COMMAND} ${install_config} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake + COMMENT "${CMAKE_COMMAND} ${install_config} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake" + DEPENDS testdeploy) + +endif() diff --git a/Tests/Qt4Deploy/testdeploy.cpp b/Tests/Qt4Deploy/testdeploy.cpp new file mode 100644 index 0000000..bcf77a2 --- /dev/null +++ b/Tests/Qt4Deploy/testdeploy.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + QCoreApplication app(argc, argv); + + qDebug() << "App path:" << app.applicationDirPath(); + qDebug() << "Plugin path:" << QLibraryInfo::location(QLibraryInfo::PluginsPath); + + bool foundSqlite = false; + + qDebug() << "Supported Database Drivers:"; + foreach(const QString &sqlDriver, QSqlDatabase::drivers()) + { + qDebug() << " " << sqlDriver; + if(sqlDriver == "QSQLITE") + foundSqlite = true; + } + + if(foundSqlite) + qDebug() << "Found sqlite support from plugin."; + else + qDebug() << "Could not find sqlite support from plugin."; + return foundSqlite ? 0 : 1; +} -- cgit v0.12 From 2437b40933bd8377815a51a8154a81d3a70dc0fc Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 24 Feb 2012 00:01:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 33c8c08..bf8b852 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 23) +SET(KWSYS_DATE_STAMP_DAY 24) -- cgit v0.12 From 52e827964843cdf25ec3be1af98cb47c17800545 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 24 Feb 2012 08:09:17 -0700 Subject: Fix for Qt4Deploy on some test machines. Use the same check for whether Qt4 works for Qt4Automoc test before trying to do the Qt4Deploy test. Also pass down to Qt4Deploy which Qt to use. --- Tests/CMakeLists.txt | 73 +++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2e72dec..cc2ae5e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -231,6 +231,25 @@ IF(BUILD_TESTING) FIND_PACKAGE(Qt4) ENDIF(NOT QT4_FOUND) + IF(QT4_FOUND) + # test whether the Qt4 which has been found works, on some machines + # which run nightly builds there were errors like "wrong file format" + # for libQtCore.so. So first check it works, and only if it does add + # the automoc test. + INCLUDE(CheckCXXSourceCompiles) + SET(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") + SET(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") + + SET(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES}) + SET(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES}) + + CHECK_CXX_SOURCE_COMPILES("#include \n int main() {return (qApp == 0 ? 0 : 1); }\n" + QT4_WORKS) + + SET(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}") + SET(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}") + ENDIF() + # run test for BundleUtilities on supported platforms/compilers if(MSVC OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR @@ -249,7 +268,7 @@ IF(BUILD_TESTING) # run test for DeployQt4 on supported platforms/compilers (which depends on BundleUtilities) # this test also depends on the existence of the standard qtiff plugin - if(QT4_FOUND) + if(QT4_WORKS) ADD_TEST(Qt4Deploy ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4Deploy" @@ -259,6 +278,7 @@ IF(BUILD_TESTING) --build-project Qt4Deploy --build-options -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Deploy") endif() @@ -868,43 +888,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment") - IF(NOT QT4_FOUND) - FIND_PACKAGE(Qt4) - ENDIF(NOT QT4_FOUND) - - IF(QT4_FOUND) - # test whether the Qt4 which has been found works, on some machines - # which run nightly builds there were errors like "wrong file format" - # for libQtCore.so. So first check it works, and only if it does add - # the automoc test. - INCLUDE(CheckCXXSourceCompiles) - SET(_save_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") - SET(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") - - SET(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES}) - SET(CMAKE_REQUIRED_LIBRARIES ${QT_QTCORE_LIBRARIES}) - - CHECK_CXX_SOURCE_COMPILES("#include \n int main() {return (qApp == 0 ? 0 : 1); }\n" - QT4_WORKS_FOR_AUTOMOC_TEST) - - SET(CMAKE_REQUIRED_INCLUDES "${_save_CMAKE_REQUIRED_INCLUDES}") - SET(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}") - - IF(QT4_WORKS_FOR_AUTOMOC_TEST) - ADD_TEST(QtAutomoc ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutomoc" - "${CMake_BINARY_DIR}/Tests/QtAutomoc" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-project QtAutomoc - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} - --build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc" - --force-new-ctest-process - --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - --test-command ${CMAKE_CTEST_COMMAND} -V - ) - LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc") - ENDIF() + IF(QT4_WORKS) + ADD_TEST(QtAutomoc ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/QtAutomoc" + "${CMake_BINARY_DIR}/Tests/QtAutomoc" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project QtAutomoc + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-exe-dir "${CMake_BINARY_DIR}/Tests/QtAutomoc" + --force-new-ctest-process + --build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc") ENDIF() ADD_TEST(ExternalProject ${CMAKE_CTEST_COMMAND} -- cgit v0.12 From 4412fc0890ab4081432721b7578f9893f89406fd Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 24 Feb 2012 17:13:22 +0100 Subject: GenerateExportHeader: remove unneeded code These expressions check for command line arguments unsupported by the compiler. We don't pass any custom flags here anyway so this isn't needed. --- Modules/GenerateExportHeader.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f3f61f6..e1dcb51 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -149,13 +149,6 @@ include(CheckCXXCompilerFlag) macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT) check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } int main() { return somefunc();}" ${_RESULT} - # Some compilers do not fail with a bad flag - FAIL_REGEX "unrecognized .*option" # GNU - FAIL_REGEX "ignoring unknown option" # MSVC - FAIL_REGEX "warning D9002" # MSVC, any lang - FAIL_REGEX "[Uu]nknown option" # HP - FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro - FAIL_REGEX "command option .* is not recognized" # XL ) endmacro() -- cgit v0.12 From c28e2769482c12da53a3c01ea45f9ae6cdc1de34 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 24 Feb 2012 17:48:02 +0100 Subject: GenerateExportHeader: improve compiler identification Use CMAKE__COMPILER_VERSION instead of calling the compiler. This macro predates those useful variables. This also fixes the issue that g++ version detection was not working if C language was not enabled. --- Modules/GenerateExportHeader.cmake | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index e1dcb51..51ba6fc 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -154,34 +154,15 @@ endmacro() macro(_test_compiler_hidden_visibility) - if(CMAKE_COMPILER_IS_GNUCXX) - exec_program(${CMAKE_C_COMPILER} ARGS --version - OUTPUT_VARIABLE _gcc_version_info) - string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]" - _gcc_version "${_gcc_version_info}") - # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the - # patch level, handle this here: - if(NOT _gcc_version) - string(REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" - _gcc_version "${_gcc_version_info}") - endif() - - if("${_gcc_version}" VERSION_LESS "4.2") - set(GCC_TOO_OLD TRUE) - message(WARNING "GCC version older than 4.2") - endif() - endif() - - if(CMAKE_CXX_COMPILER_ID MATCHES Intel) - exec_program(${CMAKE_CXX_COMPILER} ARGS -V - OUTPUT_VARIABLE _intel_version_info) - string(REGEX REPLACE ".*Version ([0-9]+(\\.[0-9]+)+).*" "\\1" - _intel_version "${_intel_version_info}") - - if(${_intel_version} VERSION_LESS "12.0") - set(_INTEL_TOO_OLD TRUE) - message(WARNING "Intel compiler older than 12.0") - endif() + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") + set(GCC_TOO_OLD TRUE) + message(WARNING "GCC version older than 4.2") + elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2") + set(GCC_TOO_OLD TRUE) + message(WARNING "GCC version older than 4.2") + elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0") + set(_INTEL_TOO_OLD TRUE) + message(WARNING "Intel compiler older than 12.0") endif() -- cgit v0.12 From ab9824e14f07111210ad113a982fd7523f73e9d3 Mon Sep 17 00:00:00 2001 From: Christopher Sean Morrison Date: Fri, 24 Feb 2012 10:39:16 -0500 Subject: cmake-mode.el: Make indentation case-insensitive (#12995) Convert the block open and close matching expressions to be explicitly insensitive to case. This way it will not matter whether Emacs is sensitive to case when evaluating 'string-match'. --- Docs/cmake-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el index 4418bfa..9517455 100644 --- a/Docs/cmake-mode.el +++ b/Docs/cmake-mode.el @@ -68,9 +68,9 @@ set the path with these commands: "\\|" "[ \t\r\n]" "\\)*")) (defconst cmake-regex-block-open - "^\\(IF\\|MACRO\\|FOREACH\\|ELSE\\|ELSEIF\\|WHILE\\|FUNCTION\\)$") + "^\\([iI][fF]\\|[mM][aA][cC][rR][oO]\\|[fF][oO][rR][eE][aA][cC][hH]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[wW][hH][iI][lL][eE]\\|[fF][uU][nN][cC][tT][iI][oO][nN]\\)$") (defconst cmake-regex-block-close - "^[ \t]*\\(ENDIF\\|ENDFOREACH\\|ENDMACRO\\|ELSE\\|ELSEIF\\|ENDWHILE\\|ENDFUNCTION\\)[ \t]*(") + "^[ \t]*\\([eE][nN][dD][iI][fF]\\|[eE][nN][dD][fF][oO][rR][eE][aA][cC][hH]\\|[eE][nN][dD][mM][aA][cC][rR][oO]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[eE][nN][dD][wW][hH][iI][lL][eE]\\|[eE][nN][dD][fF][uU][nN][cC][tT][iI][oO][nN]\\)[ \t]*(") ;------------------------------------------------------------------------------ -- cgit v0.12 From 261491fe171edb41c2dabce0fd90f282fb11bf6a Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Fri, 24 Feb 2012 23:37:02 +0400 Subject: cmPropertyDefinition::IsChained is const --- Source/cmPropertyDefinition.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index f68db87..58d1472 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -31,7 +31,7 @@ public: cmPropertyDefinition() { this->Chained = false; }; // is it chained? - bool IsChained() {return this->Chained; }; + bool IsChained() const { return this->Chained; }; // Get the section if any const std::string &GetDocumentationSection() const { -- cgit v0.12 From ffdaa4761c4dee10af1ec096ecfc72af7cdff827 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 24 Feb 2012 20:39:01 +0100 Subject: FindOpenSceneGraph: give every message() with an explicit level --- Modules/FindOpenSceneGraph.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 460f0fd..52f9316 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -78,7 +78,7 @@ list(APPEND _osg_modules_to_process "osg" "OpenThreads") list(REMOVE_DUPLICATES _osg_modules_to_process) if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Components = ${_osg_modules_to_process}") endif() @@ -93,7 +93,7 @@ endif() # Try to ascertain the version... if(OSG_INCLUDE_DIR) if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") endif() @@ -127,14 +127,14 @@ if(OSG_INCLUDE_DIR) string(REGEX REPLACE ".*#define OPENSCENEGRAPH_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" _osg_VERSION_PATCH ${_osg_Version_contents}) else() - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(WARNING "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Failed to parse version number, please report this as a bug") endif() set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}" CACHE INTERNAL "The version of OSG which was detected") if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Detected version ${OPENSCENEGRAPH_VERSION}") endif() endif() @@ -165,7 +165,7 @@ endif() # foreach(_osg_module ${_osg_modules_to_process}) if(OpenSceneGraph_DEBUG) - message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + message(STATUS "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " "Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})") endif() find_package(${_osg_module} ${_osg_quiet}) -- cgit v0.12 From b2cbd755c1b07b5da8155848e4f7604eef485573 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Fri, 24 Feb 2012 23:29:42 +0400 Subject: Remove unused file cmake.1 This old man page has long been replaced by generated documentation. --- cmake.1 | 112 ---------------------------------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 cmake.1 diff --git a/cmake.1 b/cmake.1 deleted file mode 100644 index c7695b4..0000000 --- a/cmake.1 +++ /dev/null @@ -1,112 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH CMAKE 1 "August 8, 2002" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -cmake \- Cross-platform Makefile generator. -.SH SYNOPSIS -.B cmake -.RI < path-to-source > " " [ options ] -.br -.B ccmake -.RI < path-to-source > -.br -.B ctest -.RI [ -R " " < regex > ] -.br -.B cmaketest -.RI < test-src-dir > " " < test-bin-dir > " " < test-executable > -.SH DESCRIPTION - -This manual page documents briefly the \fBcmake\fP, \fBccmake\fP, -\fBctest\fP and \fBcmaketest\fP commands. It is not intended to aid -authors of CMakeLists.txt files or to describe all advanced options -available. For full documentation, please visit -\fBhttp://www.cmake.org\fP. - -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. - -CMake provides developers with a means of building their project on -multiple platforms while writing only one build system configuration. -The developer writes a set of CMakeLists.txt files that are read by -CMake and used to generate a native build system for the current -environment. On unix platforms, Makefiles are generated. - -.PP - -\fBcmake\fP is used to generate the makefiles for a project from its -source. The first argument should specify a path to the source tree. -The current directory will be used as the build tree for the project. -Both in-source and out-of-source builds are supported, but -out-of-source builds are preferred. CMake provides functionality for -tailoring the build to user preferences through settings in the cmake -cache. Options may be set interactively using the -i option (or -\fBccmake\fP). Once CMake has generated the makefiles in the build -tree, one may use the standard \fBmake\fP tool to build the project. - -.PP - -\fBccmake\fP provides a curses interface front-end for \fBcmake\fP. -The interface allows users to interactively configure the build -options stored in the cmake cache. This is the preferred interface -for interactive builds. Build scripts should use \fBcmake\fP -directly. - -.PP - -\fBctest\fP runs tests found in the project's build tree after it has -been compiled and displays a summary of test results. Use the -R -option to specify a regular expression of test names to match. - -\fBcmaketest\fP is provided to simplify project testing scripts. It -allows a CMake project to be compiled and tested from a single command -line. - -.SH OPTIONS - -.TP -.B \-\-help -Available for \fBcmake\fP , \fBccmake\fP and \fBcmaketest\fP. -.br -Show version number and summary of options. - -.TP -.B -R regex -Available for \fBctest\fP. -.br -Run only tests matching the given regular expression. - -.TP -.B -i -Available for \fBcmake\fP. -.br -Run cmake in an interactive wizard mode to configure the build. - -.SH SEE ALSO -.BR Dart (1), -.BR VTK (1). - -.SH MAILING LIST -For help using cmake, a mailing list is provided at -\fBcmake@www.cmake.org\fP. Please first read the full documentation -at \fBhttp://www.cmake.org\fP before posting questions to the list. - -.SH AUTHOR -This manual page was written by CMake authors at Kitware -. -- cgit v0.12 From f3fe73da548a90e6682fd6a650d923151950003d Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 25 Feb 2012 00:01:02 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index bf8b852..829c587 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 24) +SET(KWSYS_DATE_STAMP_DAY 25) -- cgit v0.12 From 213eb6e6a6517775a3b538681e6c334abcdf5d5f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sat, 25 Feb 2012 14:52:19 +0100 Subject: FindHSPELL: set HSPELL_VERSION_STRING This variable was documented, but never set. --- Modules/FindHSPELL.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index 054f565..ca5709b 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -32,12 +32,15 @@ IF (HSPELL_INCLUDE_DIR) FILE(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H) STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}") STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}") + SET(HSPELL_VERSION_STRING "${HSPELL_VERSION_MAJOR}.${HSPELL_VERSION_MINOR}") ENDIF() # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if # all listed variables are TRUE INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL DEFAULT_MSG HSPELL_LIBRARIES HSPELL_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL + REQUIRED_VARS HSPELL_LIBRARIES HSPELL_INCLUDE_DIR + VERSION_VAR HSPELL_VERSION_STRING) MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) -- cgit v0.12 From 0d2f5c8d6a3384816310aec2478cf9e3877e8569 Mon Sep 17 00:00:00 2001 From: Bjoern Ricks Date: Sat, 25 Feb 2012 18:20:36 +0100 Subject: Fix crash if app bundle executeable couldn't be found Fix a crash on Mac OS X if a programm can't be found as an application bundle. CFRelease MUST NOT be called on a NULL value. See https://developer.apple.com/library/mac/documentation/CoreFOundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/doc/c_ref/CFRelease --- Source/cmFindProgramCommand.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 7c56ad7..00f5419 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -175,6 +175,8 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) // And finally to a c++ string executable = bundlePath + "/Contents/MacOS/" + std::string(buffer); + // Only release CFURLRef if it's not null + CFRelease( executableURL ); } // Any CF objects returned from functions with "create" or @@ -182,7 +184,6 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath) CFRelease( bundlePathCFS ); CFRelease( bundleURL ); CFRelease( appBundle ); - CFRelease( executableURL ); #endif return executable; -- cgit v0.12 From 4849e6ac63149cd9e582bac379d616a382948bbd Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 19:05:08 +0100 Subject: Fix layout of the CPack Bundle documentation CPACK_BUNDLE_STARTUP_SCRIPT was in fact CPACK_BUNDLE_STARTUP_COMMAND in the C++ code. The doc has been changed accordingly. --- Modules/CPackBundle.cmake | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index 007fc04..0da51e3 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -4,33 +4,32 @@ # - CPack Bundle generator (Mac OS X) specific options # # Installers built on Mac OS X using the Bundle generator use the -# aforementioned DragNDrop variables, plus the following Bundle-specific -# parameters: +# aforementioned DragNDrop (CPACK_DMG_xxx) variables, plus +# the following Bundle-specific parameters (CPACK_BUNDLE_xxx). ##end # ##variable -# CPACK_BUNDLE_NAME - The name of the generated bundle. This -# appears in the OSX finder as the bundle name. Required. +# CPACK_BUNDLE_NAME - The name of the generated bundle. This +# appears in the OSX finder as the bundle name. Required. ##end # ##variable -# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used -# as the Info.plist for the generated bundle. This assumes that -# the caller has generated or specified their own Info.plist file. -# Required. +# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used +# for the generated bundle. This assumes that the caller has generated +# or specified their own Info.plist file. Required. ##end # ##variable -# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as -# the icon for the generated bundle. This is the icon that appears -# in the OSX finder for the bundle, and in the OSX dock when the -# bundle is opened. Required. +# CPACK_BUNDLE_ICON - Path to an OSX icon file that will be used as +# the icon for the generated bundle. This is the icon that appears in the +# OSX finder for the bundle, and in the OSX dock when the bundle is opened. +# Required. ##end # ##variable -# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that -# will be run whenever an end-user double-clicks the generated bundle -# in the OSX Finder. Optional. +# CPACK_BUNDLE_STARTUP_COMMAND - Path to a startup script. This is a path to +# an executable or script that will be run whenever an end-user double-clicks +# the generated bundle in the OSX Finder. Optional. ##end #============================================================================= -- cgit v0.12 From b3851f504dc8404384aa14b62ca4765f3a4dc955 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 19:18:52 +0100 Subject: Fix CPack Drag and Drop generator documentation layout. --- Modules/CPackDMG.cmake | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index caa8dc8..e866bab 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -7,53 +7,53 @@ ##end # ##variable -# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -# image. Defaults to CPACK_PACKAGE_FILE_NAME. +# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk +# image. Defaults to CPACK_PACKAGE_FILE_NAME. ##end # ##variable -# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO -# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF -# bzip2-compressed). Refer to hdiutil(1) for more information on -# other available formats. +# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO +# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF +# bzip2-compressed). Refer to hdiutil(1) for more information on +# other available formats. ##end # ##variable -# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. -# can be used to specify the Finder window position/geometry and -# layout (such as hidden toolbars, placement of the icons etc.). -# This file has to be generated by the Finder (either manually or -# through OSA-script) using a normal folder from which the .DS_Store -# file can then be extracted. +# CPACK_DMG_DS_STORE - Path to a custom DS_Store file. This .DS_Store +# file e.g. can be used to specify the Finder window +# position/geometry and layout (such as hidden toolbars, placement of the +# icons etc.). This file has to be generated by the Finder (either manually or +# through OSA-script) using a normal folder from which the .DS_Store +# file can then be extracted. ##end # ##variable -# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be -# used as the background for the Finder Window when the disk image -# is opened. By default no background image is set. The background -# image is applied after applying the custom .DS_Store file. +# CPACK_DMG_BACKGROUND_IMAGE - Path to a background image file. This +# file will be used as the background for the Finder Window when the disk +# image is opened. By default no background image is set. The background +# image is applied after applying the custom .DS_Store file. ##end # ##variable -# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to -# operate on disk image files on Mac OS X. This variable can be used -# to override the automatically detected command (or specify its -# location if the auto-detection fails to find it.) +# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to +# operate on disk image files on Mac OS X. This variable can be used +# to override the automatically detected command (or specify its +# location if the auto-detection fails to find it.) ##end # ##variable -# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set -# extended attributes on files and directories on Mac OS X. This -# variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to -# find it.) +# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set +# extended attributes on files and directories on Mac OS X. This +# variable can be used to override the automatically detected +# command (or specify its location if the auto-detection fails to +# find it.) ##end # ##variable -# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile -# resources on Mac OS X. This variable can be used to override the -# automatically detected command (or specify its location if the -# auto-detection fails to find it.) +# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile +# resources on Mac OS X. This variable can be used to override the +# automatically detected command (or specify its location if the +# auto-detection fails to find it.) ##end #============================================================================= -- cgit v0.12 From 94a269304ed2a653cbac3bba26c4a59db9d80fbc Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 22:57:59 +0100 Subject: Review and update CPack variable documentation. This concerns all variables common to all CPack generators. Variables mainly used and/or set in CPack.cmake are documented therein. C++ built-in variables are documented in cmCPackDocumentVariables.cxx. --- Modules/CPack.cmake | 184 +++++++++++++++++------------- Source/CPack/cmCPackDocumentVariables.cxx | 64 +++++++++-- 2 files changed, 162 insertions(+), 86 deletions(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index e0a5518..b506711 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -53,176 +53,198 @@ ##end # ##variable -# CPACK_PACKAGE_NAME - The name of the package (or application). If -# not specified, defaults to the project name. +# CPACK_PACKAGE_NAME - The name of the package (or application). If +# not specified, defaults to the project name. ##end # ##variable -# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g., -# "Kitware"). +# CPACK_PACKAGE_VENDOR - The name of the package vendor. (e.g., +# "Kitware"). ##end # ##variable -# CPACK_PACKAGE_VERSION_MAJOR - Package major Version +# CPACK_PACKAGE_VERSION_MAJOR - Package major Version ##end # ##variable -# CPACK_PACKAGE_VERSION_MINOR - Package minor Version +# CPACK_PACKAGE_VERSION_MINOR - Package minor Version ##end # ##variable -# CPACK_PACKAGE_VERSION_PATCH - Package patch Version +# CPACK_PACKAGE_VERSION_PATCH - Package patch Version ##end # ##variable -# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the -# project. Used, for example, the introduction screen of a -# CPack-generated Windows installer to describe the project. +# CPACK_PACKAGE_DESCRIPTION_FILE - A text file used to describe the +# project. Used, for example, the introduction screen of a +# CPack-generated Windows installer to describe the project. ##end # ##variable -# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the -# project (only a few words). +# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Short description of the +# project (only a few words). ##end # ##variable -# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, -# not including the extension. For example, cmake-2.6.1-Linux-i686. +# CPACK_PACKAGE_FILE_NAME - The name of the package file to generate, +# not including the extension. For example, cmake-2.6.1-Linux-i686. +# The default value is +# ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}. ##end # ##variable -# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the -# target system, e.g., "CMake 2.5". +# CPACK_PACKAGE_INSTALL_DIRECTORY - Installation directory on the +# target system. This may be used by some CPack generators +# like NSIS to create an installation directory e.g., "CMake 2.5" +# below the installation prefix. All installed element will be +# put inside this directory. ##end # ##variable -# CPACK_PROJECT_CONFIG_FILE - File included at cpack time, once per -# generator after setting CPACK_GENERATOR to the actual generator -# being used. Allows per-generator setting of CPACK_* variables at -# cpack time. +# CPACK_PROJECT_CONFIG_FILE - CPack-time project CPack configuration +# file. This file included at cpack time, once per +# generator after CPack has set CPACK_GENERATOR to the actual generator +# being used. It allows per-generator setting of CPACK_* variables at +# cpack time. ##end # ##variable -# CPACK_RESOURCE_FILE_LICENSE - License file for the project, which -# will typically be displayed to the user (often with an explicit -# "Accept" button, for graphical installers) prior to installation. +# CPACK_RESOURCE_FILE_LICENSE - License to be embedded in the installer. It +# will typically be displayed to the user by the produced installer +# (often with an explicit "Accept" button, for graphical installers) +# prior to installation. This license file is NOT added to installed +# file but is used by some CPack generators like NSIS. If you want +# to install a license file (may be the same as this one) +# along with your project you must add an appropriate CMake INSTALL +# command in your CMakeLists.txt. ##end # ##variable -# CPACK_RESOURCE_FILE_README - ReadMe file for the project, which -# typically describes in some detail +# CPACK_RESOURCE_FILE_README - ReadMe file to be embedded in the installer. It +# typically describes in some detail the purpose of the project +# during the installation. Not all CPack generators uses +# this file. ##end # ##variable -# CPACK_RESOURCE_FILE_WELCOME - Welcome file for the project, which -# welcomes users to this installer. Typically used in the graphical -# installers on Windows and Mac OS X. +# CPACK_RESOURCE_FILE_WELCOME - Welcome file to be embedded in the +# installer. It welcomes users to this installer. +# Typically used in the graphical installers on Windows and Mac OS X. ##end # ##variable -# CPACK_MONOLITHIC_INSTALL - Disables the component-based -# installation mechanism, so that all components are always installed. +# CPACK_MONOLITHIC_INSTALL - Disables the component-based +# installation mechanism. When set the component specification is ignored +# and all installed items are put in a single "MONOLITHIC" package. +# Some CPack generators do monolithic packaging by default and +# may be asked to do component packaging by setting +# CPACK__COMPONENT_INSTALL to 1/TRUE. ##end # ##variable -# CPACK_GENERATOR - List of CPack generators to use. If not -# specified, CPack will create a set of options (e.g., -# CPACK_BINARY_NSIS) allowing the user to enable/disable individual -# generators. +# CPACK_GENERATOR - List of CPack generators to use. If not +# specified, CPack will create a set of options CPACK_BINARY_ (e.g., +# CPACK_BINARY_NSIS) allowing the user to enable/disable individual +# generators. This variable may be used on the command line +# as well as in: +# +# cpack -D CPACK_GENERATOR="ZIP;TGZ" /path/to/build/tree ##end # ##variable -# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack configuration file -# for binary installers that will be generated by the CPack -# module. Defaults to CPackConfig.cmake. +# CPACK_OUTPUT_CONFIG_FILE - The name of the CPack binary configuration +# file. This file is the CPack configuration generated by the CPack module +# for binary installers. Defaults to CPackConfig.cmake. ##end # ##variable -# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables along -# with a text label, to be used to create Start Menu shortcuts on -# Windows. For example, setting this to the list ccmake;CMake will -# create a shortcut named "CMake" that will execute the installed -# executable ccmake. +# CPACK_PACKAGE_EXECUTABLES - Lists each of the executables and associated +# text label to be used to create Start Menu shortcuts. For example, +# setting this to the list ccmake;CMake will +# create a shortcut named "CMake" that will execute the installed +# executable ccmake. Not all CPack generators use it (at least NSIS and +# OSXX11 do). ##end # ##variable -# CPACK_STRIP_FILES - List of files to be stripped. Starting with -# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which -# enables stripping of all files (a list of files evaluates to TRUE -# in CMake, so this change is compatible). +# CPACK_STRIP_FILES - List of files to be stripped. Starting with +# CMake 2.6.0 CPACK_STRIP_FILES will be a boolean variable which +# enables stripping of all files (a list of files evaluates to TRUE +# in CMake, so this change is compatible). ##end # # The following CPack variables are specific to source packages, and # will not affect binary packages: # ##variable -# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package, -# e.g., cmake-2.6.1 +# CPACK_SOURCE_PACKAGE_FILE_NAME - The name of the source package. For +# example cmake-2.6.1. ##end # ##variable -# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that -# will be stripped. Starting with CMake 2.6.0 -# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables -# stripping of all files (a list of files evaluates to TRUE in CMake, -# so this change is compatible). +# CPACK_SOURCE_STRIP_FILES - List of files in the source tree that +# will be stripped. Starting with CMake 2.6.0 +# CPACK_SOURCE_STRIP_FILES will be a boolean variable which enables +# stripping of all files (a list of files evaluates to TRUE in CMake, +# so this change is compatible). ##end # ##variable -# CPACK_SOURCE_GENERATOR - List of generators used for the source -# packages. As with CPACK_GENERATOR, if this is not specified then -# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) -# allowing users to select which packages will be generated. +# CPACK_SOURCE_GENERATOR - List of generators used for the source +# packages. As with CPACK_GENERATOR, if this is not specified then +# CPack will create a set of options (e.g., CPACK_SOURCE_ZIP) +# allowing users to select which packages will be generated. ##end # ##variable -# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack -# configuration file for source installers that will be generated by -# the CPack module. Defaults to CPackSourceConfig.cmake. +# CPACK_SOURCE_OUTPUT_CONFIG_FILE - The name of the CPack source +# configuration file. This file is the CPack configuration generated by the +# CPack module for source installers. Defaults to CPackSourceConfig.cmake. ##end # ##variable -# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree -# that won't be packaged when building a source package. This is a -# list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* +# CPACK_SOURCE_IGNORE_FILES - Pattern of files in the source tree +# that won't be packaged when building a source package. This is a +# list of regular expression patterns (that must be properly escaped), +# e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* ##end # # The following variables are for advanced uses of CPack: # ##variable -# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the -# project is CMake project. Defaults to the value of CMAKE_GENERATOR; -# few users will want to change this setting. +# CPACK_CMAKE_GENERATOR - What CMake generator should be used if the +# project is CMake project. Defaults to the value of CMAKE_GENERATOR +# few users will want to change this setting. ##end # ##variable -# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify -# what project to install. The four values are: Build directory, -# Project Name, Project Component, Directory. If omitted, CPack will -# build an installer that installers everything. +# CPACK_INSTALL_CMAKE_PROJECTS - List of four values that specify +# what project to install. The four values are: Build directory, +# Project Name, Project Component, Directory. If omitted, CPack will +# build an installer that installers everything. ##end # ##variable -# CPACK_SYSTEM_NAME - System name, defaults to the value of -# ${CMAKE_SYSTEM_NAME}. +# CPACK_SYSTEM_NAME - System name, defaults to the value of +# ${CMAKE_SYSTEM_NAME}. ##end # ##variable -# CPACK_PACKAGE_VERSION - Package full version, used internally. By -# default, this is built from CPACK_PACKAGE_VERSION_MAJOR, -# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. +# CPACK_PACKAGE_VERSION - Package full version, used internally. By +# default, this is built from CPACK_PACKAGE_VERSION_MAJOR, +# CPACK_PACKAGE_VERSION_MINOR, and CPACK_PACKAGE_VERSION_PATCH. ##end # ##variable -# CPACK_TOPLEVEL_TAG - Directory for the installed files. +# CPACK_TOPLEVEL_TAG - Directory for the installed files. ##end # ##variable -# CPACK_INSTALL_COMMANDS - Extra commands to install components. +# CPACK_INSTALL_COMMANDS - Extra commands to install components. ##end # ##variable -# CPACK_INSTALLED_DIRECTORIES - Extra directories to install. +# CPACK_INSTALLED_DIRECTORIES - Extra directories to install. ##end # @@ -358,6 +380,12 @@ macro(cpack_optional_append _list _cond _item) endif(${_cond}) endmacro(cpack_optional_append _list _cond _item) +##variable +# CPACK_BINARY_ - CPack generated options for binary generators. The +# CPack.cmake module generates (when CPACK_GENERATOR is not set) +# a set of CMake options (see CMake option command) which may then be used to +# select the CPack generator(s) to be used when launching the package target. +##end # Provide options to choose generators # we might check here if the required tools for the generates exist # and set the defaults according to the results diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 68cde78..23e99f8 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -21,12 +21,60 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) "", false, "Variables common to all CPack generators"); - // Subsection: variables defined/used by cpack, - // which are specific to one CPack generator -// cm->DefineProperty -// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, -// "RPM specific package name.", -// "If not specified, defaults to CPACK_PACKAGE_NAME." -// "", false, -// "Variables specific to a CPack generator"); + cm->DefineProperty + ("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", cmProperty::VARIABLE, + "Boolean toggle to include/exclude top level directory.", + "When preparing a package CPack installs the item under" + " the so-called top level directory. The purpose of" + " is to include (set to 1 or ON or TRUE) the top level directory" + " in the package or not (set to 0 or OFF or FALSE).\n" + "Each CPack generator as a built-in default value for this" + " variable. E.g. Archive generators (ZIP, TGZ, ...) includes" + " the top level whereas RPM or DEB don't. The user may override" + " the default value byt setting this variable.\n" + "There is a similar variable " + "CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY" + "which may be used to override the behavior for the component" + "packaging case which may have different default value for" + "historical (now backward compatibility) reason.", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_SET_DESTDIR", cmProperty::VARIABLE, + "Boolean toggle to make CPack use DESTDIR mechanism when" + " packaging.", "DESTDIR means DESTination DIRectory." + " It is commonly used by makefile " + "users in order to install software at non-default location. It a" + "basic relocation mechanism. " + "It is usually invoked like this:\n" + " make DESTDIR=/home/john install\n" + "which will install the concerned software using the" + " installation prefix, e.g. \"/usr/local\" prepended with " + "the DESTDIR value which finally gives \"/home/john/usr/local\"." + " When preparing a package CPack first installs the items to be " + "packaged in a local (to the build tree) directory by using the " + "same DESTDIR mechanism. Nevertheless, if " + "CPACK_SET_DESTDIR is set then CPack will set DESTDIR before" + " doing the local install. The most noticeable difference is" + " that without CPACK_SET_DESTDIR, CPack uses " + "CPACK_PACKAGING_INSTALL_PREFIX as a prefix whereas with " + "CPACK_SET_DESTDIR set, CPack will use CMAKE_INSTALL_PREFIX as" + " a prefix.\n" + "Manually setting CPACK_SET_DESTDIR may help (or simply be" + " necessary) if some install rules uses absolute " + "DESTINATION (see CMake INSTALL command)." + "However, starting with" + " CPack/CMake 2.8.3 RPM and DEB installers tries to handle DESTDIR" + " automatically so that it is seldom necessary for the user to set" + " it.", false, + "Variables common to all CPack generators"); + + cm->DefineProperty + ("CPACK_INSTALL_SCRIPT", cmProperty::VARIABLE, + "Extra CMake script provided by the user.", + "If set this CMake script will be executed by CPack " + "during its local [CPack-private] installation " + "which is done right before packaging the files." + " The script is not called by e.g.: make install.", false, + "Variables common to all CPack generators"); } -- cgit v0.12 From 6ad0f0405bdaf8c817e3b7168ee38050f3b4128f Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 23:03:46 +0100 Subject: Update CPackConfig template. Remove variable documentation from the template in order to avoid multiple location for doc update. Users can now retrieve CPACK_xxx variable documentation from the command line. --- Templates/CPackConfig.cmake.in | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/Templates/CPackConfig.cmake.in b/Templates/CPackConfig.cmake.in index 7150feb..79b8d93 100644 --- a/Templates/CPackConfig.cmake.in +++ b/Templates/CPackConfig.cmake.in @@ -1,29 +1,12 @@ # This file will be configured to contain variables for CPack. These variables # should be set in the CMake list file of the project before CPack module is -# included. Example variables are: -# CPACK_GENERATOR - Generator used to create package -# CPACK_INSTALL_CMAKE_PROJECTS - For each project (path, name, component) -# CPACK_CMAKE_GENERATOR - CMake Generator used for the projects -# CPACK_INSTALL_COMMANDS - Extra commands to install components -# CPACK_INSTALLED_DIRECTORIES - Extra directories to install -# CPACK_PACKAGE_DESCRIPTION_FILE - Description file for the package -# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Summary of the package -# CPACK_PACKAGE_EXECUTABLES - List of pairs of executables and labels -# CPACK_PACKAGE_FILE_NAME - Name of the package generated -# CPACK_PACKAGE_ICON - Icon used for the package -# CPACK_PACKAGE_INSTALL_DIRECTORY - Name of directory for the installer -# CPACK_PACKAGE_NAME - Package project name -# CPACK_PACKAGE_VENDOR - Package project vendor -# CPACK_PACKAGE_VERSION - Package project version -# CPACK_PACKAGE_VERSION_MAJOR - Package project version (major) -# CPACK_PACKAGE_VERSION_MINOR - Package project version (minor) -# CPACK_PACKAGE_VERSION_PATCH - Package project version (patch) - -# There are certain generator specific ones - -# NSIS Generator: -# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer -# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall -# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra commands used during install +# included. The list of available CPACK_xxx variables and their associated +# documentation may be obtained using +# cpack --help-variable-list +# +# Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME) +# and some are specific to a generator +# (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables +# usually begin with CPACK__xxxx. @_CPACK_OTHER_VARIABLES_@ -- cgit v0.12 From c8950621805a112e44dc91e1ba0647ae1c21a201 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 23:14:47 +0100 Subject: Update CPack PackageMaker variable doc layout --- Modules/CPackPackageMaker.cmake | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake index 8fe423c..5ac4bf0 100644 --- a/Modules/CPackPackageMaker.cmake +++ b/Modules/CPackPackageMaker.cmake @@ -6,18 +6,18 @@ # using PackageMaker: # ##variable -# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the -# resulting PackageMaker archive should be compatible -# with. Different versions of Mac OS X support different -# features. For example, CPack can only build component-based -# installers for Mac OS X 10.4 or newer, and can only build -# installers that download component son-the-fly for Mac OS X 10.5 -# or newer. If left blank, this value will be set to the minimum -# version of Mac OS X that supports the requested features. Set this -# variable to some value (e.g., 10.4) only if you want to guarantee -# that your installer will work on that version of Mac OS X, and -# don't mind missing extra features available in the installer -# shipping with later versions of Mac OS X. +# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the +# resulting PackageMaker archive should be compatible with. Different +# versions of Mac OS X support different +# features. For example, CPack can only build component-based +# installers for Mac OS X 10.4 or newer, and can only build +# installers that download component son-the-fly for Mac OS X 10.5 +# or newer. If left blank, this value will be set to the minimum +# version of Mac OS X that supports the requested features. Set this +# variable to some value (e.g., 10.4) only if you want to guarantee +# that your installer will work on that version of Mac OS X, and +# don't mind missing extra features available in the installer +# shipping with later versions of Mac OS X. ##end #============================================================================= -- cgit v0.12 From 98d158376eacacd12a765675272268be27609192 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 23:26:41 +0100 Subject: Provide template for CPack Cygwin generator specific variables. --- Modules/CPackCygwin.cmake | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Modules/CPackCygwin.cmake diff --git a/Modules/CPackCygwin.cmake b/Modules/CPackCygwin.cmake new file mode 100644 index 0000000..7ed7f67 --- /dev/null +++ b/Modules/CPackCygwin.cmake @@ -0,0 +1,33 @@ +##section Variables specific to CPack Cygwin generator +##end +##module +# - Cygwin CPack generator (Cygwin). +# The following variable is specific to installers build on +# and/or for Cygwin: +##end +# +##variable +# CPACK_CYGWIN_PATCH_NUMBER - The Cygwin patch number. +# FIXME: This documentation is incomplete. +##end +##variable +# CPACK_CYGWIN_PATCH_FILE - The Cygwin patch file. +# FIXME: This documentation is incomplete. +##end +##variable +# CPACK_CYGWIN_BUILD_SCRIPT - The Cygwin build script. +# FIXME: This documentation is incomplete. +##end + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) -- cgit v0.12 From 2ace3427ace03c93981885901b055cada722d62d Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 25 Feb 2012 23:28:31 +0100 Subject: Typo: Add missing ##end for ##module --- Modules/CPackPackageMaker.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake index 5ac4bf0..45ba465 100644 --- a/Modules/CPackPackageMaker.cmake +++ b/Modules/CPackPackageMaker.cmake @@ -4,6 +4,7 @@ # - PackageMaker CPack generator (Mac OS X). # The following variable is specific to installers build on Mac OS X # using PackageMaker: +##end # ##variable # CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the -- cgit v0.12 From 08ff8727afba8363455af36de5dcc78cfb209158 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 26 Feb 2012 00:01:05 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 829c587..4e99678 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 25) +SET(KWSYS_DATE_STAMP_DAY 26) -- cgit v0.12 From 00daeff02bd1507de46d3a0eac4743672ef1ecef Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 27 Feb 2012 00:01:02 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 4e99678..e843ebd 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 26) +SET(KWSYS_DATE_STAMP_DAY 27) -- cgit v0.12 From a5edfc4fb79ac0fdb5be09e0ea7dc2f02f5ec29e Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sat, 25 Feb 2012 11:09:32 +0400 Subject: Fix typo in documentation --- Source/cmDocumentVariables.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 1cab2b5..366ebaa 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -895,7 +895,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("BORLAND", cmProperty::VARIABLE, - "True of the borland compiler is being used.", + "True if the borland compiler is being used.", "This is set to true if the Borland compiler is being used.",false, "Variables That Describe the System"); -- cgit v0.12 From f5cf8f9897fc372ae75eafa4ed3e8e68ac1fcfa9 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Mon, 27 Feb 2012 09:00:46 -0500 Subject: Tests: Escape metachars before embedding paths into the regex (#12999) ${CMake_SOURCE_DIR} and ${CMake_BINARY_DIR} cannot be embedded into regex directly. If they contain special regex metacharacters like +, the regex will break. So just escape such metacharacters with a backslash before embedding the path into the regex. The issue affected the following tests: CTestTestConfigFileInBuildDir1 and CTestTestConfigFileInBuildDir2. --- Tests/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index af1df22..654538e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -16,6 +16,11 @@ MACRO(ADD_TEST_MACRO NAME COMMAND) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}") ENDMACRO(ADD_TEST_MACRO) +MACRO(REGEX_ESCAPE_STRING _OUT _IN) + # Escape special regex metacharacters with a backslash + string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}") +ENDMACRO(REGEX_ESCAPE_STRING _OUT _IN) + INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckFortran.cmake) # Fake a user home directory to avoid polluting the real one. @@ -1646,9 +1651,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/test1.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir1/testOut1.log" ) + REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_SOURCE_DIR "${CMake_SOURCE_DIR}") SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir1 PROPERTIES DEPENDS CTestTestNoBuild PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CMake_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") + "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_SOURCE_DIR}.Tests.CTestTestConfigFileInBuildDir.CTestConfig.cmake") CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in" @@ -1662,10 +1668,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ -S "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/test2.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/testOut2.log" ) + REGEX_ESCAPE_STRING(CTEST_TEST_ESCAPED_BINARY_DIR "${CMake_BINARY_DIR}") SET_TESTS_PROPERTIES(CTestTestConfigFileInBuildDir2 PROPERTIES DEPENDS CTestTestNoBuild REQUIRED_FILES ${CMake_BINARY_DIR}/Tests/CTestTestConfigFileInBuildDir2/CTestConfig.cmake PASS_REGULAR_EXPRESSION - "Reading ctest configuration file: ${CMake_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") + "Reading ctest configuration file: ${CTEST_TEST_ESCAPED_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake") # Use macro, not function so that build can still be driven by CMake 2.4. # After 2.6 is required, this could be a function without the extra 'set' -- cgit v0.12 From 518f965bbabf6678a3fc03948c38bc78e48cfdc3 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 27 Feb 2012 17:25:24 +0100 Subject: FindImageMagick: fix fail if no components were given The variable name should be added to the list here, not the content. --- Modules/FindImageMagick.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 52d575b..0c890f5 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -171,7 +171,7 @@ FOREACH(component ${ImageMagick_FIND_COMPONENTS} ELSEIF(ImageMagick_${component}_EXECUTABLE) # if no components were requested explicitly put all (default) executables # in the list - LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES "${ImageMagick_${component}_EXECUTABLE}") + LIST(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE) ENDIF(ImageMagick_FIND_COMPONENTS) ENDIF(component STREQUAL "Magick++") ENDFOREACH(component) -- cgit v0.12 From 4f6fd961da510d9a2b6144e48272c68101376f0f Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sat, 25 Feb 2012 13:20:57 +0400 Subject: Drop if(...) check because condition is always true GetLocation returns std::string::c_str() which is never NULL --- Source/cmLocalGenerator.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ffbeb48..501fe61 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1902,15 +1902,8 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: case cmTarget::UNKNOWN_LIBRARY: - { - // Get the location of the target's output file and depend on it. - if(const char* location = target->GetLocation(config)) - { - dep = location; - return true; - } - } - break; + dep = target->GetLocation(config); + return true; case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: // A utility target has no file on which to depend. This was listed -- cgit v0.12 From 7d6db93de9ffc6e6092fa722aaf9c057dadcd634 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 26 Feb 2012 09:29:02 +0100 Subject: FindPythonInterp: rework the version detection There are versions out there that neither understand --version nor -V. Try a completely different approach: execute a small python script that prints the version number (and only that) in an easily reusable way using sys.version_info. This is documented to work since Python 2.0. Use sys.version for older versions, which is documented to exist since 1.5. If even that doesn't work then simply assume we are on 1.4.0. --- Modules/FindPythonInterp.cmake | 51 +++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 5c1d56b..babbd4b 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -15,6 +15,7 @@ #============================================================================= # Copyright 2005-2010 Kitware, Inc. # Copyright 2011 Bjoern Ricks +# Copyright 2012 Rolf Eike Beer # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -88,24 +89,42 @@ endif() # determine python version string if(PYTHON_EXECUTABLE) - execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version - ERROR_VARIABLE _VERSION + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c + "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))" + OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT - OUTPUT_QUIET - ERROR_STRIP_TRAILING_WHITESPACE) - if(_PYTHON_VERSION_RESULT) - execute_process(COMMAND "${PYTHON_EXECUTABLE}" -V - ERROR_VARIABLE _VERSION + ERROR_QUIET) + if(NOT _PYTHON_VERSION_RESULT) + string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}") + list(GET _VERSION 0 PYTHON_VERSION_MAJOR) + list(GET _VERSION 1 PYTHON_VERSION_MINOR) + list(GET _VERSION 2 PYTHON_VERSION_PATCH) + if(PYTHON_VERSION_PATCH EQUAL 0) + # it's called "Python 2.7", not "2.7.0" + string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}") + endif() + else() + # sys.version predates sys.version_info, so use that + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)" + OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT - OUTPUT_QUIET - ERROR_STRIP_TRAILING_WHITESPACE) - endif(_PYTHON_VERSION_RESULT) - if(NOT _PYTHON_VERSION_RESULT AND _VERSION MATCHES "^Python [0-9]+\\.[0-9]+.*") - string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}") - string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") - if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + ERROR_QUIET) + if(NOT _PYTHON_VERSION_RESULT) + string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}") + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") + if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + else() + set(PYTHON_VERSION_PATCH "0") + endif() + else() + # sys.version was first documented for Python 1.5, so assume + # this is older. + set(PYTHON_VERSION_STRING "1.4") + set(PYTHON_VERSION_MAJOR "1") + set(PYTHON_VERSION_MAJOR "4") + set(PYTHON_VERSION_MAJOR "0") endif() endif() unset(_PYTHON_VERSION_RESULT) -- cgit v0.12 From 573fa3bf136e5c780d3dd7e2dc692d52b3eba96d Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 27 Feb 2012 11:26:38 -0500 Subject: Factor cmInstallType out of cmTarget::TargetType The purpose of the TargetType enumeration was overloaded for install type because install rules were once recorded as targets. Factor the install types out into their own enumeration. --- Source/cmExtraCodeBlocksGenerator.cxx | 4 ---- Source/cmExtraEclipseCDT4Generator.cxx | 4 ---- Source/cmFileCommand.cxx | 33 +++++++++++++++++---------------- Source/cmInstallDirectoryGenerator.cxx | 2 +- Source/cmInstallExportGenerator.cxx | 5 ++--- Source/cmInstallFilesGenerator.cxx | 6 ++---- Source/cmInstallGenerator.cxx | 18 ++++++++---------- Source/cmInstallGenerator.h | 3 ++- Source/cmInstallTargetGenerator.cxx | 26 ++++++++++++++++++++------ Source/cmInstallType.h | 29 +++++++++++++++++++++++++++++ Source/cmLocalGenerator.cxx | 4 ---- Source/cmTarget.cxx | 16 ---------------- Source/cmTarget.h | 1 - 13 files changed, 81 insertions(+), 70 deletions(-) create mode 100644 Source/cmInstallType.h diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 38002ec..6e246e6 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -392,10 +392,6 @@ void cmExtraCodeBlocksGenerator make.c_str(), makefile, compiler.c_str()); } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 07549e9..c8c86c7 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1045,10 +1045,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } } break; - // ignore these: - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: default: break; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6df5ab3..3f14fa1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -12,6 +12,7 @@ #include "cmFileCommand.h" #include "cmake.h" #include "cmHexFileConverter.h" +#include "cmInstallType.h" #include "cmFileTimeComparison.h" #include "cmCryptoHash.h" @@ -1690,7 +1691,7 @@ struct cmFileInstaller: public cmFileCopier { cmFileInstaller(cmFileCommand* command): cmFileCopier(command, "INSTALL"), - InstallType(cmTarget::INSTALL_FILES), + InstallType(cmInstallType_FILES), Optional(false), DestDirLength(0) { @@ -1711,7 +1712,7 @@ struct cmFileInstaller: public cmFileCopier } protected: - cmTarget::TargetType InstallType; + cmInstallType InstallType; bool Optional; int DestDirLength; std::string Rename; @@ -1745,7 +1746,7 @@ protected: virtual bool Install(const char* fromFile, const char* toFile) { // Support installing from empty source to make a directory. - if(this->InstallType == cmTarget::INSTALL_DIRECTORY && !*fromFile) + if(this->InstallType == cmInstallType_DIRECTORY && !*fromFile) { return this->InstallDirectory(fromFile, toFile, MatchProperties()); } @@ -1767,14 +1768,14 @@ protected: // Add execute permissions based on the target type. switch(this->InstallType) { - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: + case cmInstallType_SHARED_LIBRARY: + case cmInstallType_MODULE_LIBRARY: if(this->Makefile->IsOn("CMAKE_INSTALL_SO_NO_EXE")) { break; } - case cmTarget::EXECUTABLE: - case cmTarget::INSTALL_PROGRAMS: + case cmInstallType_EXECUTABLE: + case cmInstallType_PROGRAMS: this->FilePermissions |= mode_owner_execute; this->FilePermissions |= mode_group_execute; this->FilePermissions |= mode_world_execute; @@ -1796,8 +1797,8 @@ bool cmFileInstaller::Parse(std::vector const& args) if(!this->Rename.empty()) { - if(this->InstallType != cmTarget::INSTALL_FILES && - this->InstallType != cmTarget::INSTALL_PROGRAMS) + if(this->InstallType != cmInstallType_FILES && + this->InstallType != cmInstallType_PROGRAMS) { this->FileCommand->SetError("INSTALL option RENAME may be used " "only with FILES or PROGRAMS."); @@ -1936,31 +1937,31 @@ bool cmFileInstaller { if ( stype == "EXECUTABLE" ) { - this->InstallType = cmTarget::EXECUTABLE; + this->InstallType = cmInstallType_EXECUTABLE; } else if ( stype == "FILE" ) { - this->InstallType = cmTarget::INSTALL_FILES; + this->InstallType = cmInstallType_FILES; } else if ( stype == "PROGRAM" ) { - this->InstallType = cmTarget::INSTALL_PROGRAMS; + this->InstallType = cmInstallType_PROGRAMS; } else if ( stype == "STATIC_LIBRARY" ) { - this->InstallType = cmTarget::STATIC_LIBRARY; + this->InstallType = cmInstallType_STATIC_LIBRARY; } else if ( stype == "SHARED_LIBRARY" ) { - this->InstallType = cmTarget::SHARED_LIBRARY; + this->InstallType = cmInstallType_SHARED_LIBRARY; } else if ( stype == "MODULE" ) { - this->InstallType = cmTarget::MODULE_LIBRARY; + this->InstallType = cmInstallType_MODULE_LIBRARY; } else if ( stype == "DIRECTORY" ) { - this->InstallType = cmTarget::INSTALL_DIRECTORY; + this->InstallType = cmInstallType_DIRECTORY; } else { diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ab32f94..ddf7d08 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -42,7 +42,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, { // Write code to install the directories. const char* no_rename = 0; - this->AddInstallRule(os, cmTarget::INSTALL_DIRECTORY, + this->AddInstallRule(os, cmInstallType_DIRECTORY, this->Directories, this->Optional, this->FilePermissions.c_str(), diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 69e3f2c..28a19d7 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,7 +16,6 @@ #include "cmake.h" #include "cmInstallTargetGenerator.h" #include "cmGeneratedFileStream.h" -#include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" @@ -186,7 +185,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); os << indent << "IF(" << config_test << ")\n"; - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); os << indent << "ENDIF(" << config_test << ")\n"; @@ -225,6 +224,6 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, // Install the main export file. std::vector files; files.push_back(this->MainImportFile); - this->AddInstallRule(os, cmTarget::INSTALL_FILES, files, false, + this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 28f055f..ec02bc7 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -11,8 +11,6 @@ ============================================================================*/ #include "cmInstallFilesGenerator.h" -#include "cmTarget.h" - //---------------------------------------------------------------------------- cmInstallFilesGenerator ::cmInstallFilesGenerator(std::vector const& files, @@ -43,8 +41,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, const char* no_dir_permissions = 0; this->AddInstallRule(os, (this->Programs - ? cmTarget::INSTALL_PROGRAMS - : cmTarget::INSTALL_FILES), + ? cmInstallType_PROGRAMS + : cmInstallType_FILES), this->Files, this->Optional, this->FilePermissions.c_str(), no_dir_permissions, diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index d7505dc..807168e 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -12,7 +12,6 @@ #include "cmInstallGenerator.h" #include "cmSystemTools.h" -#include "cmTarget.h" //---------------------------------------------------------------------------- cmInstallGenerator @@ -35,7 +34,7 @@ cmInstallGenerator void cmInstallGenerator ::AddInstallRule( std::ostream& os, - int type, + cmInstallType type, std::vector const& files, bool optional /* = false */, const char* permissions_file /* = 0 */, @@ -49,14 +48,13 @@ void cmInstallGenerator std::string stype; switch(type) { - case cmTarget::INSTALL_DIRECTORY:stype = "DIRECTORY"; break; - case cmTarget::INSTALL_PROGRAMS: stype = "PROGRAM"; break; - case cmTarget::EXECUTABLE: stype = "EXECUTABLE"; break; - case cmTarget::STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; - case cmTarget::SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; - case cmTarget::MODULE_LIBRARY: stype = "MODULE"; break; - case cmTarget::INSTALL_FILES: - default: stype = "FILE"; break; + case cmInstallType_DIRECTORY: stype = "DIRECTORY"; break; + case cmInstallType_PROGRAMS: stype = "PROGRAM"; break; + case cmInstallType_EXECUTABLE: stype = "EXECUTABLE"; break; + case cmInstallType_STATIC_LIBRARY: stype = "STATIC_LIBRARY"; break; + case cmInstallType_SHARED_LIBRARY: stype = "SHARED_LIBRARY"; break; + case cmInstallType_MODULE_LIBRARY: stype = "MODULE"; break; + case cmInstallType_FILES: stype = "FILE"; break; } os << indent; std::string dest = this->GetInstallDestination(); diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index aa9a47c..c89ab8a 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -12,6 +12,7 @@ #ifndef cmInstallGenerator_h #define cmInstallGenerator_h +#include "cmInstallType.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -29,7 +30,7 @@ public: virtual ~cmInstallGenerator(); void AddInstallRule( - std::ostream& os, int type, + std::ostream& os, cmInstallType type, std::vector const& files, bool optional = false, const char* permissions_file = 0, diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ac1c949..c74dda0 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -82,8 +82,22 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::vector filesFrom; std::vector filesTo; std::string literal_args; - cmTarget::TargetType type = this->Target->GetType(); - if(type == cmTarget::EXECUTABLE) + cmTarget::TargetType targetType = this->Target->GetType(); + cmInstallType type = cmInstallType(); + switch(targetType) + { + case cmTarget::EXECUTABLE: type = cmInstallType_EXECUTABLE; break; + case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break; + case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break; + case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break; + case cmTarget::UTILITY: + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + this->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, + "cmInstallTargetGenerator created with non-installable target."); + return; + } + if(targetType == cmTarget::EXECUTABLE) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -110,7 +124,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else { @@ -121,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, if(this->Target->IsAppBundleOnApple()) { // Install the whole app bundle directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; from1 += ".app"; @@ -173,7 +187,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, } // An import library looks like a static library. - type = cmTarget::STATIC_LIBRARY; + type = cmInstallType_STATIC_LIBRARY; } else if(this->Target->IsFrameworkOnApple()) { @@ -181,7 +195,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, assert(this->NamelinkMode == NamelinkModeNone); // Install the whole framework directory. - type = cmTarget::INSTALL_DIRECTORY; + type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; std::string from1 = fromDirConfig + targetName + ".framework"; diff --git a/Source/cmInstallType.h b/Source/cmInstallType.h new file mode 100644 index 0000000..a837368 --- /dev/null +++ b/Source/cmInstallType.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmInstallType_h +#define cmInstallType_h + +/** + * Enumerate types known to file(INSTALL). + */ +enum cmInstallType +{ + cmInstallType_EXECUTABLE, + cmInstallType_STATIC_LIBRARY, + cmInstallType_SHARED_LIBRARY, + cmInstallType_MODULE_LIBRARY, + cmInstallType_FILES, + cmInstallType_PROGRAMS, + cmInstallType_DIRECTORY +}; + +#endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ffbeb48..3f98045 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1916,10 +1916,6 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, // A utility target has no file on which to depend. This was listed // only to get the target-level dependency. return false; - case cmTarget::INSTALL_FILES: - case cmTarget::INSTALL_PROGRAMS: - case cmTarget::INSTALL_DIRECTORY: - break; } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ae5596b..57f5a94 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -43,12 +43,6 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType) return "UTILITY"; case cmTarget::GLOBAL_TARGET: return "GLOBAL_TARGET"; - case cmTarget::INSTALL_FILES: - return "INSTALL_FILES"; - case cmTarget::INSTALL_PROGRAMS: - return "INSTALL_PROGRAMS"; - case cmTarget::INSTALL_DIRECTORY: - return "INSTALL_DIRECTORY"; case cmTarget::UNKNOWN_LIBRARY: return "UNKNOWN_LIBRARY"; } @@ -1184,16 +1178,6 @@ void cmTarget::DefineProperties(cmake *cm) void cmTarget::SetType(TargetType type, const char* name) { this->Name = name; - if(type == cmTarget::INSTALL_FILES || - type == cmTarget::INSTALL_PROGRAMS || - type == cmTarget::INSTALL_DIRECTORY) - { - this->Makefile-> - IssueMessage(cmake::INTERNAL_ERROR, - "SetType called on cmTarget for INSTALL_FILES, " - "INSTALL_PROGRAMS, or INSTALL_DIRECTORY "); - return; - } // only add dependency information for library targets this->TargetTypeValue = type; if(this->TargetTypeValue >= STATIC_LIBRARY diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 59f0184..f4b6955 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -60,7 +60,6 @@ public: cmTarget(); enum TargetType { EXECUTABLE, STATIC_LIBRARY, SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET, - INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY, UNKNOWN_LIBRARY}; static const char* GetTargetTypeName(TargetType targetType); enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD }; -- cgit v0.12 From b3f9fe42f949515dfdb2635bc0031c5b1b807dc0 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 17 Feb 2012 11:43:27 +0100 Subject: find_package: print error if an invalid CONFIGS name is used In commit 41c2895b (Added version support to Config mode of find_package command, 2008-01-28) the error message was computed but was not reported. Add the SetError call to report it. --- Source/cmFindPackageCommand.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 22bb628..b0a7607 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -538,6 +538,7 @@ bool cmFindPackageCommand e << "given CONFIGS option followed by invalid file name \"" << args[i] << "\". The names given must be file names without " << "a path and with a \".cmake\" extension."; + this->SetError(e.str().c_str()); return false; } this->Configs.push_back(args[i]); -- cgit v0.12 From 978d89b99db233f2fbe5a9cfa4c7acdca93e6442 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 17 Feb 2012 21:31:08 +0100 Subject: find_package: rename NoModule to UseFindModules ...positive logic is easier to handle Alex --- Source/cmFindPackageCommand.cxx | 28 ++++++++++++++-------------- Source/cmFindPackageCommand.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index b0a7607..5254de8 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -57,7 +57,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->NoUserRegistry = false; this->NoSystemRegistry = false; this->NoBuilds = false; - this->NoModule = false; + this->UseFindModules = true; this->DebugMode = false; this->UseLib64Paths = false; this->PolicyScope = true; @@ -425,7 +425,7 @@ bool cmFindPackageCommand } else if(args[i] == "NO_MODULE") { - this->NoModule = true; + this->UseFindModules = false; doing = DoingNone; } else if(args[i] == "REQUIRED") @@ -440,31 +440,31 @@ bool cmFindPackageCommand } else if(args[i] == "NAMES") { - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingNames; } else if(args[i] == "PATHS") { - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingPaths; } else if(args[i] == "HINTS") { - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingHints; } else if(args[i] == "PATH_SUFFIXES") { - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingPathSuffixes; } else if(args[i] == "CONFIGS") { - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingConfigs; } @@ -477,27 +477,27 @@ bool cmFindPackageCommand else if(args[i] == "NO_CMAKE_PACKAGE_REGISTRY") { this->NoUserRegistry = true; - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingNone; } else if(args[i] == "NO_CMAKE_SYSTEM_PACKAGE_REGISTRY") { this->NoSystemRegistry = true; - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingNone; } else if(args[i] == "NO_CMAKE_BUILDS_PATH") { this->NoBuilds = true; - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingNone; } else if(this->CheckCommonArgument(args[i])) { - this->NoModule = true; + this->UseFindModules = false; this->Compatibility_1_6 = false; doing = DoingNone; } @@ -636,7 +636,7 @@ bool cmFindPackageCommand this->SetModuleVariables(components); // See if there is a Find.cmake module. - if(!this->NoModule) + if(this->UseFindModules) { bool foundModule = false; if(!this->FindModule(foundModule)) @@ -913,12 +913,12 @@ bool cmFindPackageCommand::HandlePackageMode() else { e << "Could not find "; - if(!this->NoModule) + if(this->UseFindModules) { e << "module Find" << this->Name << ".cmake or "; } e << "a configuration file for package " << this->Name << ".\n"; - if(!this->NoModule) + if(this->UseFindModules) { e << "Adjust CMAKE_MODULE_PATH to find Find" << this->Name << ".cmake or set "; diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index e736352..513c49c 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -133,7 +133,7 @@ private: bool Quiet; bool Required; bool Compatibility_1_6; - bool NoModule; + bool UseFindModules; bool NoUserRegistry; bool NoSystemRegistry; bool NoBuilds; -- cgit v0.12 From 26519d591ea28d3f26f34c625c2d57db6f302d63 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 28 Feb 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index e843ebd..92a27dc 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 27) +SET(KWSYS_DATE_STAMP_DAY 28) -- cgit v0.12 From 7d67dcf52bddcd8863f00d7bb6e6e7e22a966951 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 24 Feb 2012 20:33:21 +0100 Subject: find_package: improve error message when no Find module is present Explain exactly why CMake is looking for a package configuration file and who is expected to provide what: CMake Error at CMakeLists.txt:7 (find_package): By not providing "Find.cmake" in CMAKE_MODULE_PATH the caller has asked CMake to find a package configuration file provided by "", but CMake did not find one. Could not find a package configuration file provided by "" with any of the names: Config.cmake -config.cmake Add the installation prefix of "" to CMAKE_PREFIX_PATH or set "_DIR" to a directory containing one of the above files. If "" provides separate development package or SDK be sure it has been installed. The first paragraph explains how CMake is interpreting the intention of the caller. This puts the blame or credit at the call site in the project code where it belongs both when it is a bug and when it is intentional. It can be dropped in NO_MODULE mode. Suggested-by: Brad King --- Source/cmFindPackageCommand.cxx | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 5254de8..c02d385 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -912,38 +912,37 @@ bool cmFindPackageCommand::HandlePackageMode() } else { - e << "Could not find "; if(this->UseFindModules) { - e << "module Find" << this->Name << ".cmake or "; + e << "By not providing \"Find" << this->Name << ".cmake\" in " + "CMAKE_MODULE_PATH this project has asked CMake to find a " + "package configuration file provided by \""<Name<< "\", " + "but CMake did not find one.\n"; } - e << "a configuration file for package " << this->Name << ".\n"; - if(this->UseFindModules) - { - e << "Adjust CMAKE_MODULE_PATH to find Find" - << this->Name << ".cmake or set "; - } - else - { - e << "Set "; - } - e << this->Variable << " to the directory containing a CMake " - << "configuration file for " << this->Name << ". "; + if(this->Configs.size() == 1) { - e << "The file will be called " << this->Configs[0]; + e << "Could not find a package configuration file named \"" + << this->Configs[0] << "\" provided by package \"" << this->Name << "\".\n"; } else { - e << "The file will have one of the following names:\n"; - for(std::vector::const_iterator ci=this->Configs.begin(); + e << "Could not find a package configuration file provided by \"" + << this->Name << "\" with any of the following names:\n"; + for(std::vector::const_iterator ci = + this->Configs.begin(); ci != this->Configs.end(); ++ci) { e << " " << *ci << "\n"; } } - } + e << "Add the installation prefix of \"" << this->Name << "\" to " + "CMAKE_PREFIX_PATH or set \"" << this->Variable << "\" to a " + "directory containing one of the above files. " + "If \"" << this->Name << "\" provides a separate development " + "package or SDK, be sure it has been installed."; + } this->Makefile->IssueMessage( this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str()); -- cgit v0.12 From f310f6729149551ca73a853789413f9a36f86ced Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 20 Feb 2012 22:09:10 +0100 Subject: find_package: add MODULE mode to use only Find-modules The new mode differ from default mode in that that it doesn't fallback to config mode. The default mode stays unchanged. --- Source/cmFindPackageCommand.cxx | 172 +++++++++++++++++++++++++++------------- Source/cmFindPackageCommand.h | 1 + 2 files changed, 117 insertions(+), 56 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index c02d385..c3c037c 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -57,6 +57,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->NoUserRegistry = false; this->NoSystemRegistry = false; this->NoBuilds = false; + this->UseConfigFiles = true; this->UseFindModules = true; this->DebugMode = false; this->UseLib64Paths = false; @@ -86,7 +87,7 @@ void cmFindPackageCommand::GenerateDocumentation() cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder, "FIND_XXX", "find_package"); this->CommandDocumentation = - " find_package( [version] [EXACT] [QUIET]\n" + " find_package( [version] [EXACT] [QUIET] [MODULE]\n" " [[REQUIRED|COMPONENTS] [components...]]\n" " [NO_POLICY_SCOPE])\n" "Finds and loads settings from an external project. " @@ -94,6 +95,7 @@ void cmFindPackageCommand::GenerateDocumentation() "When the package is found package-specific information is provided " "through variables documented by the package itself. " "The QUIET option disables messages if the package cannot be found. " + "The MODULE option disables the second signature documented below. " "The REQUIRED option stops processing with an error message if the " "package cannot be found. " "A package-specific list of components may be listed after the " @@ -124,7 +126,8 @@ void cmFindPackageCommand::GenerateDocumentation() "and producing any needed messages. " "Many find-modules provide limited or no support for versioning; " "check the module documentation. " - "If no module is found the command proceeds to Config mode.\n" + "If no module is found and the MODULE option is not given the command " + "proceeds to Config mode.\n" "The complete Config mode command signature is:\n" " find_package( [version] [EXACT] [QUIET]\n" " [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n" @@ -410,6 +413,7 @@ bool cmFindPackageCommand Doing doing = DoingNone; cmsys::RegularExpression version("^[0-9.]+$"); bool haveVersion = false; + std::string haveModeString = ""; for(unsigned int i=1; i < args.size(); ++i) { if(args[i] == "QUIET") @@ -423,10 +427,35 @@ bool cmFindPackageCommand this->Compatibility_1_6 = false; doing = DoingNone; } + else if(args[i] == "MODULE") + { + if(!haveModeString.empty()) + { + cmOStringStream e; + e << "given " << args[i] << ", but mode is already set to " + << haveModeString << "."; + this->SetError(e.str().c_str()); + return false; + } + + this->UseConfigFiles = false; + doing = DoingNone; + haveModeString = args[i]; + } else if(args[i] == "NO_MODULE") { + if(!haveModeString.empty()) + { + cmOStringStream e; + e << "given " << args[i] << ", but mode is already set to " + << haveModeString << "."; + this->SetError(e.str().c_str()); + return false; + } + this->UseFindModules = false; doing = DoingNone; + haveModeString = args[i]; } else if(args[i] == "REQUIRED") { @@ -831,41 +860,44 @@ bool cmFindPackageCommand::HandlePackageMode() // Try to load the config file if the directory is known bool fileFound = false; - if(!cmSystemTools::IsOff(def)) + if (this->UseConfigFiles) { - // Get the directory from the variable value. - std::string dir = def; - cmSystemTools::ConvertToUnixSlashes(dir); - - // Treat relative paths with respect to the current source dir. - if(!cmSystemTools::FileIsFullPath(dir.c_str())) + if(!cmSystemTools::IsOff(def)) { - dir = "/" + dir; - dir = this->Makefile->GetCurrentDirectory() + dir; + // Get the directory from the variable value. + std::string dir = def; + cmSystemTools::ConvertToUnixSlashes(dir); + + // Treat relative paths with respect to the current source dir. + if(!cmSystemTools::FileIsFullPath(dir.c_str())) + { + dir = "/" + dir; + dir = this->Makefile->GetCurrentDirectory() + dir; + } + // The file location was cached. Look for the correct file. + std::string file; + if (this->FindConfigFile(dir, file)) + { + this->FileFound = file; + fileFound = true; + } + def = this->Makefile->GetDefinition(this->Variable.c_str()); } - // The file location was cached. Look for the correct file. - std::string file; - if (this->FindConfigFile(dir, file)) + + // Search for the config file if it is not already found. + if(cmSystemTools::IsOff(def) || !fileFound) { - this->FileFound = file; - fileFound = true; + fileFound = this->FindConfig(); + def = this->Makefile->GetDefinition(this->Variable.c_str()); } - def = this->Makefile->GetDefinition(this->Variable.c_str()); - } - // Search for the config file if it is not already found. - if(cmSystemTools::IsOff(def) || !fileFound) - { - fileFound = this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable.c_str()); - } - - // Sanity check. - if(fileFound && this->FileFound.empty()) - { - this->Makefile->IssueMessage( - cmake::INTERNAL_ERROR, "fileFound is true but FileFound is empty!"); - fileFound = false; + // Sanity check. + if(fileFound && this->FileFound.empty()) + { + this->Makefile->IssueMessage( + cmake::INTERNAL_ERROR, "fileFound is true but FileFound is empty!"); + fileFound = false; + } } // If the directory for the config file was found, try to read the file. @@ -893,6 +925,7 @@ bool cmFindPackageCommand::HandlePackageMode() { // The variable is not set. cmOStringStream e; + cmOStringStream aw; // If there are files in ConsideredConfigs, it means that FooConfig.cmake // have been found, but they didn't have appropriate versions. if (this->ConsideredConfigs.size() > 0) @@ -912,40 +945,67 @@ bool cmFindPackageCommand::HandlePackageMode() } else { - if(this->UseFindModules) + if (this->UseConfigFiles) { - e << "By not providing \"Find" << this->Name << ".cmake\" in " - "CMAKE_MODULE_PATH this project has asked CMake to find a " - "package configuration file provided by \""<Name<< "\", " - "but CMake did not find one.\n"; - } + if(this->UseFindModules) + { + e << "By not providing \"Find" << this->Name << ".cmake\" in " + "CMAKE_MODULE_PATH this project has asked CMake to find a " + "package configuration file provided by \""<Name<< "\", " + "but CMake did not find one.\n"; + } - if(this->Configs.size() == 1) - { - e << "Could not find a package configuration file named \"" - << this->Configs[0] << "\" provided by package \"" << this->Name << "\".\n"; - } - else - { - e << "Could not find a package configuration file provided by \"" - << this->Name << "\" with any of the following names:\n"; - for(std::vector::const_iterator ci = - this->Configs.begin(); - ci != this->Configs.end(); ++ci) + if(this->Configs.size() == 1) { - e << " " << *ci << "\n"; + e << "Could not find a package configuration file named \"" + << this->Configs[0] << "\" provided by package \"" + << this->Name << "\".\n"; + } + else + { + e << "Could not find a package configuration file provided by \"" + << this->Name << "\" with any of the following names:\n"; + for(std::vector::const_iterator ci = + this->Configs.begin(); + ci != this->Configs.end(); ++ci) + { + e << " " << *ci << "\n"; + } } - } - e << "Add the installation prefix of \"" << this->Name << "\" to " - "CMAKE_PREFIX_PATH or set \"" << this->Variable << "\" to a " - "directory containing one of the above files. " - "If \"" << this->Name << "\" provides a separate development " - "package or SDK, be sure it has been installed."; + e << "Add the installation prefix of \"" << this->Name << "\" to " + "CMAKE_PREFIX_PATH or set \"" << this->Variable << "\" to a " + "directory containing one of the above files. " + "If \"" << this->Name << "\" provides a separate development " + "package or SDK, be sure it has been installed."; + } + else // if(!this->UseFindModules && !this->UseConfigFiles) + { + e << "No \"Find" << this->Name << ".cmake\" found in " + << "CMAKE_MODULE_PATH."; + + aw<< "Find"<< this->Name <<".cmake must either be part of this " + "project itself, in this case adjust CMAKE_MODULE_PATH so that " + "it points to the correct location inside its source tree.\n" + "Or it must be installed by a package which has already been " + "found via find_package(). In this case make sure that " + "package has indeed been found and adjust CMAKE_MODULE_PATH to " + "contain the location where that package has installed " + "Find" << this->Name << ".cmake. This must be a location " + "provided by that package. This error in general means that " + "the buildsystem of this project is relying on a Find-module " + "without ensuring that it is actually available.\n"; + } } + this->Makefile->IssueMessage( this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str()); + + if (!aw.str().empty()) + { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,aw.str()); + } } // Set a variable marking whether the package was found. diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 513c49c..560df9b 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -133,6 +133,7 @@ private: bool Quiet; bool Required; bool Compatibility_1_6; + bool UseConfigFiles; bool UseFindModules; bool NoUserRegistry; bool NoSystemRegistry; -- cgit v0.12 From 9c39bbd47420a74d50fab2b421baf630f13343ec Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 20 Feb 2012 22:09:10 +0100 Subject: find_package: add CONFIG mode keyword alias for NO_MODULE --- Source/cmFindPackageCommand.cxx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index c3c037c..8e6debb 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -130,7 +130,8 @@ void cmFindPackageCommand::GenerateDocumentation() "proceeds to Config mode.\n" "The complete Config mode command signature is:\n" " find_package( [version] [EXACT] [QUIET]\n" - " [[REQUIRED|COMPONENTS] [components...]] [NO_MODULE]\n" + " [[REQUIRED|COMPONENTS] [components...]]\n" + " [CONFIG|NO_MODULE]\n" " [NO_POLICY_SCOPE]\n" " [NAMES name1 [name2 ...]]\n" " [CONFIGS config1 [config2 ...]]\n" @@ -148,9 +149,10 @@ void cmFindPackageCommand::GenerateDocumentation() " [CMAKE_FIND_ROOT_PATH_BOTH |\n" " ONLY_CMAKE_FIND_ROOT_PATH |\n" " NO_CMAKE_FIND_ROOT_PATH])\n" - "The NO_MODULE option may be used to skip Module mode explicitly. " - "It is also implied by use of options not specified in the reduced " - "signature. " + "The CONFIG option may be used to skip Module mode explicitly and " + "switch to Config mode. It is synonymous to using NO_MODULE. " + "Config mode is also implied by use of options not specified in the " + "reduced signature. " "\n" "Config mode attempts to locate a configuration file provided by the " "package to be found. A cache entry called _DIR is created to " @@ -442,6 +444,21 @@ bool cmFindPackageCommand doing = DoingNone; haveModeString = args[i]; } + else if(args[i] == "CONFIG") + { + if(!haveModeString.empty()) + { + cmOStringStream e; + e << "given " << args[i] << ", but mode is already set to " + << haveModeString << "."; + this->SetError(e.str().c_str()); + return false; + } + + this->UseFindModules = false; + doing = DoingNone; + haveModeString = args[i]; + } else if(args[i] == "NO_MODULE") { if(!haveModeString.empty()) -- cgit v0.12 From 6d8308314adbc3ff504b836b3989db9939de1e0b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 17 Feb 2012 11:37:29 +0100 Subject: find_package: mention requested version number in error message When neither a Find-module or a config file can be found print the required version so the user knows which version of the package to install. --- Source/cmFindPackageCommand.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 8e6debb..86eb2c8 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -962,6 +962,14 @@ bool cmFindPackageCommand::HandlePackageMode() } else { + std::string requestedVersionString; + if(!this->Version.empty()) + { + requestedVersionString = " (requested version "; + requestedVersionString += this->Version; + requestedVersionString += ")"; + } + if (this->UseConfigFiles) { if(this->UseFindModules) @@ -976,12 +984,13 @@ bool cmFindPackageCommand::HandlePackageMode() { e << "Could not find a package configuration file named \"" << this->Configs[0] << "\" provided by package \"" - << this->Name << "\".\n"; + << this->Name << "\"" << requestedVersionString <<".\n"; } else { e << "Could not find a package configuration file provided by \"" - << this->Name << "\" with any of the following names:\n"; + << this->Name << "\"" << requestedVersionString + << " with any of the following names:\n"; for(std::vector::const_iterator ci = this->Configs.begin(); ci != this->Configs.end(); ++ci) -- cgit v0.12 From 31ead5f695182dbb96196f9795b6437e013c6567 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Feb 2012 08:56:50 -0500 Subject: find_package: Reject mixed use of MODULE- and CONFIG-only options Many options imply exclusive Config mode. The new MODULE option implies exclusive Module mode. Do not allow mixed combinations. --- Source/cmFindPackageCommand.cxx | 80 +++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 86eb2c8..437f47a 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -415,7 +415,8 @@ bool cmFindPackageCommand Doing doing = DoingNone; cmsys::RegularExpression version("^[0-9.]+$"); bool haveVersion = false; - std::string haveModeString = ""; + std::set configArgs; + std::set moduleArgs; for(unsigned int i=1; i < args.size(); ++i) { if(args[i] == "QUIET") @@ -431,48 +432,18 @@ bool cmFindPackageCommand } else if(args[i] == "MODULE") { - if(!haveModeString.empty()) - { - cmOStringStream e; - e << "given " << args[i] << ", but mode is already set to " - << haveModeString << "."; - this->SetError(e.str().c_str()); - return false; - } - - this->UseConfigFiles = false; + moduleArgs.insert(i); doing = DoingNone; - haveModeString = args[i]; } else if(args[i] == "CONFIG") { - if(!haveModeString.empty()) - { - cmOStringStream e; - e << "given " << args[i] << ", but mode is already set to " - << haveModeString << "."; - this->SetError(e.str().c_str()); - return false; - } - - this->UseFindModules = false; + configArgs.insert(i); doing = DoingNone; - haveModeString = args[i]; } else if(args[i] == "NO_MODULE") { - if(!haveModeString.empty()) - { - cmOStringStream e; - e << "given " << args[i] << ", but mode is already set to " - << haveModeString << "."; - this->SetError(e.str().c_str()); - return false; - } - - this->UseFindModules = false; + configArgs.insert(i); doing = DoingNone; - haveModeString = args[i]; } else if(args[i] == "REQUIRED") { @@ -486,31 +457,31 @@ bool cmFindPackageCommand } else if(args[i] == "NAMES") { - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNames; } else if(args[i] == "PATHS") { - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingPaths; } else if(args[i] == "HINTS") { - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingHints; } else if(args[i] == "PATH_SUFFIXES") { - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingPathSuffixes; } else if(args[i] == "CONFIGS") { - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingConfigs; } @@ -523,27 +494,27 @@ bool cmFindPackageCommand else if(args[i] == "NO_CMAKE_PACKAGE_REGISTRY") { this->NoUserRegistry = true; - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } else if(args[i] == "NO_CMAKE_SYSTEM_PACKAGE_REGISTRY") { this->NoSystemRegistry = true; - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } else if(args[i] == "NO_CMAKE_BUILDS_PATH") { this->NoBuilds = true; - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } else if(this->CheckCommonArgument(args[i])) { - this->UseFindModules = false; + configArgs.insert(i); this->Compatibility_1_6 = false; doing = DoingNone; } @@ -603,6 +574,29 @@ bool cmFindPackageCommand } } + // Maybe choose one mode exclusively. + this->UseFindModules = configArgs.empty(); + this->UseConfigFiles = moduleArgs.empty(); + if(!this->UseFindModules && !this->UseConfigFiles) + { + cmOStringStream e; + e << "given options exclusive to Module mode:\n"; + for(std::set::const_iterator si = moduleArgs.begin(); + si != moduleArgs.end(); ++si) + { + e << " " << args[*si] << "\n"; + } + e << "and options exclusive to Config mode:\n"; + for(std::set::const_iterator si = configArgs.begin(); + si != configArgs.end(); ++si) + { + e << " " << args[*si] << "\n"; + } + e << "The options are incompatible."; + this->SetError(e.str().c_str()); + return false; + } + // Ignore EXACT with no version. if(this->Version.empty() && this->VersionExact) { -- cgit v0.12 From d3651041e9f16876d227c757254256039d62d85b Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Feb 2012 09:51:10 -0500 Subject: find_package: Optionally warn when implicitly using Config mode Define variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE for use by a project that wants to use an explicit mode in every call to find_package in order to generate more specific failure messages. Word the warning using the new CONFIG and MODULE mode keywords when the minimum required version of CMake is new enough to have them. Otherwise word the warning using the old NO_MODULE mode keyword. Inspired-by: Alex Neundorf --- Source/cmDocumentVariables.cxx | 20 ++++++++++++++++++++ Source/cmFindPackageCommand.cxx | 41 +++++++++++++++++++++++++++++++++++++++++ Source/cmFindPackageCommand.h | 1 + 3 files changed, 62 insertions(+) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 1cab2b5..f3125ce 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -746,6 +746,26 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables That Change Behavior"); cm->DefineProperty + ("CMAKE_FIND_PACKAGE_WARN_NO_MODULE", cmProperty::VARIABLE, + "Tell find_package to warn if called without an explicit mode.", + "If find_package is called without an explicit mode option " + "(MODULE, CONFIG or NO_MODULE) and no Find.cmake module is " + "in CMAKE_MODULE_PATH then CMake implicitly assumes that the " + "caller intends to search for a package configuration file. " + "If no package configuration file is found then the wording " + "of the failure message must account for both the case that the " + "package is really missing and the case that the project has a " + "bug and failed to provide the intended Find module. " + "If instead the caller specifies an explicit mode option then " + "the failure message can be more specific." + "\n" + "Set CMAKE_FIND_PACKAGE_WARN_NO_MODULE to TRUE to tell find_package " + "to warn when it implicitly assumes Config mode. " + "This helps developers enforce use of an explicit mode in all calls " + "to find_package within a project.", false, + "Variables That Change Behavior"); + + cm->DefineProperty ("CMAKE_USER_MAKE_RULES_OVERRIDE", cmProperty::VARIABLE, "Specify a CMake file that overrides platform information.", "CMake loads the specified file while enabling support for each " diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 437f47a..d632570 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -73,6 +73,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->VersionFoundPatch = 0; this->VersionFoundTweak = 0; this->VersionFoundCount = 0; + this->RequiredCMakeVersion = 0; } //---------------------------------------------------------------------------- @@ -372,6 +373,15 @@ bool cmFindPackageCommand return false; } + // Lookup required version of CMake. + if(const char* rv = + this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) + { + unsigned int v[3] = {0,0,0}; + sscanf(rv, "%u.%u.%u", &v[0], &v[1], &v[2]); + this->RequiredCMakeVersion = CMake_VERSION_ENCODE(v[0],v[1],v[2]); + } + // Check for debug mode. this->DebugMode = this->Makefile->IsOn("CMAKE_FIND_DEBUG_MODE"); @@ -691,6 +701,37 @@ bool cmFindPackageCommand } } + if(this->UseFindModules && this->UseConfigFiles && + this->Makefile->IsOn("CMAKE_FIND_PACKAGE_WARN_NO_MODULE")) + { + cmOStringStream aw; + if(this->RequiredCMakeVersion >= CMake_VERSION_ENCODE(2,8,8)) + { + aw << "find_package called without either MODULE or CONFIG option and " + "no Find" << this->Name << ".cmake module is in CMAKE_MODULE_PATH. " + "Add MODULE to exclusively request Module mode and fail if " + "Find" << this->Name << ".cmake is missing. " + "Add CONFIG to exclusively request Config mode and search for a " + "package configuration file provided by " << this->Name << + " (" << this->Name << "Config.cmake or " << + cmSystemTools::LowerCase(this->Name) << "-config.cmake). "; + } + else + { + aw << "find_package called without NO_MODULE option and no " + "Find" << this->Name << ".cmake module is in CMAKE_MODULE_PATH. " + "Add NO_MODULE to exclusively request Config mode and search for a " + "package configuration file provided by " << this->Name << + " (" << this->Name << "Config.cmake or " << + cmSystemTools::LowerCase(this->Name) << "-config.cmake). " + "Otherwise make Find" << this->Name << ".cmake available in " + "CMAKE_MODULE_PATH."; + } + aw << "\n" + "(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.)"; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str()); + } + // No find module. Assume the project has a CMake config file. Use // a _DIR cache variable to locate it. this->Variable = this->Name; diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 560df9b..7269749 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -130,6 +130,7 @@ private: unsigned int VersionFoundPatch; unsigned int VersionFoundTweak; unsigned int VersionFoundCount; + unsigned int RequiredCMakeVersion; bool Quiet; bool Required; bool Compatibility_1_6; -- cgit v0.12 From 5e1a5c44da395f8b2c121789e81f4a360a4088bc Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Feb 2012 11:34:10 -0500 Subject: Add infrastructure for CMakeCommands tests Generalize the build_command test framework as a macro to add the test. Process the CMakeCommands subdirectory explicitly. --- Tests/CMakeCommands/CMakeLists.txt | 10 +++ Tests/CMakeCommands/build_command/RunCMake.cmake | 86 ------------------------ Tests/CMakeCommands/build_command/test.cmake | 86 ++++++++++++++++++++++++ Tests/CMakeLists.txt | 8 +-- 4 files changed, 97 insertions(+), 93 deletions(-) create mode 100644 Tests/CMakeCommands/CMakeLists.txt delete mode 100644 Tests/CMakeCommands/build_command/RunCMake.cmake create mode 100644 Tests/CMakeCommands/build_command/test.cmake diff --git a/Tests/CMakeCommands/CMakeLists.txt b/Tests/CMakeCommands/CMakeLists.txt new file mode 100644 index 0000000..e9e4020 --- /dev/null +++ b/Tests/CMakeCommands/CMakeLists.txt @@ -0,0 +1,10 @@ +macro(add_CMakeCommands_test test) + add_test(CMakeCommands.${test} ${CMAKE_CMAKE_COMMAND} + -DCMake_SOURCE_DIR=${CMake_SOURCE_DIR} # TODO: Remove + -Ddir=${CMAKE_CURRENT_BINARY_DIR}/${test} + -Dgen=${CMAKE_TEST_GENERATOR} + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/test.cmake" + ) +endmacro() + +add_CMakeCommands_test(build_command) diff --git a/Tests/CMakeCommands/build_command/RunCMake.cmake b/Tests/CMakeCommands/build_command/RunCMake.cmake deleted file mode 100644 index 55d9359..0000000 --- a/Tests/CMakeCommands/build_command/RunCMake.cmake +++ /dev/null @@ -1,86 +0,0 @@ -if(NOT DEFINED CMake_SOURCE_DIR) - message(FATAL_ERROR "CMake_SOURCE_DIR not defined") -endif() - -if(NOT DEFINED dir) - message(FATAL_ERROR "dir not defined") -endif() - -if(NOT DEFINED gen) - message(FATAL_ERROR "gen not defined") -endif() - -message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") - -# Run cmake: -# -function(run_cmake build_dir extra_args expected_result expected_output expected_error) - message(STATUS "run_cmake build_dir='${build_dir}' extra_args='${extra_args}'") - - # Ensure build_dir exists: - # - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}) - - # Run cmake: - # - execute_process(COMMAND ${CMAKE_COMMAND} - ${extra_args} - -G ${gen} ${CMake_SOURCE_DIR}/Tests/CMakeCommands/build_command - RESULT_VARIABLE result - OUTPUT_VARIABLE stdout - ERROR_VARIABLE stderr - WORKING_DIRECTORY ${build_dir} - ) - - message(STATUS "result='${result}'") - message(STATUS "stdout='${stdout}'") - message(STATUS "stderr='${stderr}'") - message(STATUS "") - - # Verify result and output match expectations: - # - if("0" STREQUAL "${expected_result}") - if(NOT "${result}" STREQUAL "0") - message(FATAL_ERROR - "error: result='${result}' is non-zero and different than expected_result='${expected_result}'") - endif() - else() - if("${result}" STREQUAL "0") - message(FATAL_ERROR - "error: result='${result}' is zero and different than expected_result='${expected_result}'") - endif() - endif() - - foreach(e ${expected_output}) - if(NOT stdout MATCHES "${e}") - message(FATAL_ERROR - "error: stdout does not match expected_output item e='${e}'") - else() - message(STATUS "info: stdout matches '${e}'") - endif() - endforeach() - - foreach(e ${expected_error}) - if(NOT stderr MATCHES "${e}") - message(FATAL_ERROR - "error: stderr does not match expected_error item e='${e}'") - else() - message(STATUS "info: stderr matches '${e}'") - endif() - endforeach() - - message(STATUS "result, stdout and stderr match all expectations: test passes") - message(STATUS "") -endfunction() - - -# Expect this case to succeed: -run_cmake("${dir}/b1" "" 0 - "Build files have been written to:" - "skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF") - - -# Expect this one to fail: -run_cmake("${dir}/b2" "-DTEST_ERROR_CONDITIONS:BOOL=ON" 1 - "Configuring incomplete, errors occurred!" - "build_command requires at least one argument naming a CMake variable;build_command unknown argument ") diff --git a/Tests/CMakeCommands/build_command/test.cmake b/Tests/CMakeCommands/build_command/test.cmake new file mode 100644 index 0000000..55d9359 --- /dev/null +++ b/Tests/CMakeCommands/build_command/test.cmake @@ -0,0 +1,86 @@ +if(NOT DEFINED CMake_SOURCE_DIR) + message(FATAL_ERROR "CMake_SOURCE_DIR not defined") +endif() + +if(NOT DEFINED dir) + message(FATAL_ERROR "dir not defined") +endif() + +if(NOT DEFINED gen) + message(FATAL_ERROR "gen not defined") +endif() + +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") + +# Run cmake: +# +function(run_cmake build_dir extra_args expected_result expected_output expected_error) + message(STATUS "run_cmake build_dir='${build_dir}' extra_args='${extra_args}'") + + # Ensure build_dir exists: + # + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}) + + # Run cmake: + # + execute_process(COMMAND ${CMAKE_COMMAND} + ${extra_args} + -G ${gen} ${CMake_SOURCE_DIR}/Tests/CMakeCommands/build_command + RESULT_VARIABLE result + OUTPUT_VARIABLE stdout + ERROR_VARIABLE stderr + WORKING_DIRECTORY ${build_dir} + ) + + message(STATUS "result='${result}'") + message(STATUS "stdout='${stdout}'") + message(STATUS "stderr='${stderr}'") + message(STATUS "") + + # Verify result and output match expectations: + # + if("0" STREQUAL "${expected_result}") + if(NOT "${result}" STREQUAL "0") + message(FATAL_ERROR + "error: result='${result}' is non-zero and different than expected_result='${expected_result}'") + endif() + else() + if("${result}" STREQUAL "0") + message(FATAL_ERROR + "error: result='${result}' is zero and different than expected_result='${expected_result}'") + endif() + endif() + + foreach(e ${expected_output}) + if(NOT stdout MATCHES "${e}") + message(FATAL_ERROR + "error: stdout does not match expected_output item e='${e}'") + else() + message(STATUS "info: stdout matches '${e}'") + endif() + endforeach() + + foreach(e ${expected_error}) + if(NOT stderr MATCHES "${e}") + message(FATAL_ERROR + "error: stderr does not match expected_error item e='${e}'") + else() + message(STATUS "info: stderr matches '${e}'") + endif() + endforeach() + + message(STATUS "result, stdout and stderr match all expectations: test passes") + message(STATUS "") +endfunction() + + +# Expect this case to succeed: +run_cmake("${dir}/b1" "" 0 + "Build files have been written to:" + "skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF") + + +# Expect this one to fail: +run_cmake("${dir}/b2" "-DTEST_ERROR_CONDITIONS:BOOL=ON" 1 + "Configuring incomplete, errors occurred!" + "build_command requires at least one argument naming a CMake variable;build_command unknown argument ") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c97828..3a1453b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -48,6 +48,7 @@ IF(BUILD_TESTING) ADD_SUBDIRECTORY(CMakeLib) ADD_SUBDIRECTORY(CMakeOnly) + ADD_SUBDIRECTORY(CMakeCommands) ADD_SUBDIRECTORY(FindPackageModeMakefileTest) @@ -1695,13 +1696,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ add_config_tests(Release) add_config_tests(RelWithDebInfo) - add_test(CMakeCommands.build_command ${CMAKE_CMAKE_COMMAND} - -DCMake_SOURCE_DIR=${CMake_SOURCE_DIR} - -Ddir=${CMake_BINARY_DIR}/Tests/CMakeCommands/build_command - -Dgen=${CMAKE_TEST_GENERATOR} - -P "${CMake_SOURCE_DIR}/Tests/CMakeCommands/build_command/RunCMake.cmake" - ) - ADD_TEST_MACRO(CMakeCommands.target_link_libraries target_link_libraries) CONFIGURE_FILE( -- cgit v0.12 From 0b8638821eccd09a50dfb26cfe7a82549c8254c5 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Fri, 24 Feb 2012 01:39:39 +0400 Subject: CMakeFindPackageMode: fix 32/64bit detection if 'file' is a symlink --- Modules/CMakeFindPackageMode.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 4296577..59c7ba5 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -71,7 +71,8 @@ if(UNIX) # use the file utility to check whether itself is 64 bit: find_program(FILE_EXECUTABLE file) if(FILE_EXECUTABLE) - execute_process(COMMAND "${FILE_EXECUTABLE}" "${FILE_EXECUTABLE}" OUTPUT_VARIABLE fileOutput ERROR_QUIET) + get_filename_component(FILE_ABSPATH "${FILE_EXECUTABLE}" ABSOLUTE) + execute_process(COMMAND "${FILE_ABSPATH}" "${FILE_ABSPATH}" OUTPUT_VARIABLE fileOutput ERROR_QUIET) if("${fileOutput}" MATCHES "64-bit") set(CMAKE_SIZEOF_VOID_P 8) endif() -- cgit v0.12 From eeaaffcb2f68254ccd5cc6fbf4d13fed41d40774 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Feb 2012 13:34:53 -0500 Subject: find_package: Test error and warning messages in failure cases Add a "CMakeCommands.find_package" test to run CMake on a bunch of cases in which find_package fails. Check that the process return code and warning/error messages are as expected. Record expected test output in corresponding files for reference by the check. These files will also serve as a reference for the message text in each case. --- Tests/CMakeCommands/CMakeLists.txt | 1 + Tests/CMakeCommands/find_package/CMakeLists.txt | 3 + .../find_package/MissingConfig-stderr.txt | 13 ++++ .../CMakeCommands/find_package/MissingConfig.cmake | 1 + .../find_package/MissingConfigOneName-stderr.txt | 10 +++ .../find_package/MissingConfigOneName.cmake | 1 + .../find_package/MissingConfigRequired-result.txt | 1 + .../find_package/MissingConfigRequired-stderr.txt | 13 ++++ .../find_package/MissingConfigRequired.cmake | 1 + .../find_package/MissingConfigVersion-stderr.txt | 13 ++++ .../find_package/MissingConfigVersion.cmake | 1 + .../find_package/MissingModule-stderr.txt | 21 ++++++ .../CMakeCommands/find_package/MissingModule.cmake | 1 + .../find_package/MissingModuleRequired-result.txt | 1 + .../find_package/MissingModuleRequired-stderr.txt | 21 ++++++ .../find_package/MissingModuleRequired.cmake | 1 + .../find_package/MissingNormal-stderr.txt | 17 +++++ .../CMakeCommands/find_package/MissingNormal.cmake | 1 + .../find_package/MissingNormalRequired-result.txt | 1 + .../find_package/MissingNormalRequired-stderr.txt | 17 +++++ .../find_package/MissingNormalRequired.cmake | 1 + .../find_package/MissingNormalVersion-stderr.txt | 17 +++++ .../find_package/MissingNormalVersion.cmake | 1 + .../MissingNormalWarnNoModuleNew-stderr.txt | 30 ++++++++ .../MissingNormalWarnNoModuleNew.cmake | 3 + .../MissingNormalWarnNoModuleOld-stderr.txt | 29 ++++++++ .../MissingNormalWarnNoModuleOld.cmake | 2 + .../find_package/MixedModeOptions-result.txt | 1 + .../find_package/MixedModeOptions-stderr.txt | 14 ++++ .../find_package/MixedModeOptions.cmake | 1 + Tests/CMakeCommands/find_package/test.cmake | 80 ++++++++++++++++++++++ 31 files changed, 318 insertions(+) create mode 100644 Tests/CMakeCommands/find_package/CMakeLists.txt create mode 100644 Tests/CMakeCommands/find_package/MissingConfig-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingConfig.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingConfigOneName.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt create mode 100644 Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingConfigRequired.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingConfigVersion.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingModule-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingModule.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt create mode 100644 Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingModuleRequired.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingNormal-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingNormal.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt create mode 100644 Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingNormalRequired.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingNormalVersion.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake create mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake create mode 100644 Tests/CMakeCommands/find_package/MixedModeOptions-result.txt create mode 100644 Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt create mode 100644 Tests/CMakeCommands/find_package/MixedModeOptions.cmake create mode 100644 Tests/CMakeCommands/find_package/test.cmake diff --git a/Tests/CMakeCommands/CMakeLists.txt b/Tests/CMakeCommands/CMakeLists.txt index e9e4020..aa400d0 100644 --- a/Tests/CMakeCommands/CMakeLists.txt +++ b/Tests/CMakeCommands/CMakeLists.txt @@ -8,3 +8,4 @@ macro(add_CMakeCommands_test test) endmacro() add_CMakeCommands_test(build_command) +add_CMakeCommands_test(find_package) diff --git a/Tests/CMakeCommands/find_package/CMakeLists.txt b/Tests/CMakeCommands/find_package/CMakeLists.txt new file mode 100644 index 0000000..c2deed0 --- /dev/null +++ b/Tests/CMakeCommands/find_package/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${TEST} NONE) +include(${TEST}.cmake) diff --git a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt new file mode 100644 index 0000000..0d14dcb --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning at MissingConfig.cmake:1 \(find_package\): + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingConfig.cmake b/Tests/CMakeCommands/find_package/MissingConfig.cmake new file mode 100644 index 0000000..3cebef1 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfig.cmake @@ -0,0 +1 @@ +find_package(NotHere CONFIG) diff --git a/Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt new file mode 100644 index 0000000..10e71fa --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning at MissingConfigOneName.cmake:1 \(find_package\): + Could not find a package configuration file named "NotHereConfig.cmake" + provided by package "NotHere". + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingConfigOneName.cmake b/Tests/CMakeCommands/find_package/MissingConfigOneName.cmake new file mode 100644 index 0000000..11676a9 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigOneName.cmake @@ -0,0 +1 @@ +find_package(NotHere CONFIGS NotHereConfig.cmake) diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt b/Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt new file mode 100644 index 0000000..56325d8 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at MissingConfigRequired.cmake:1 \(find_package\): + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake new file mode 100644 index 0000000..3c28552 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake @@ -0,0 +1 @@ +find_package(NotHere CONFIG REQUIRED) diff --git a/Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt new file mode 100644 index 0000000..2f5086e --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning at MissingConfigVersion.cmake:1 \(find_package\): + Could not find a package configuration file provided by "NotHere" + \(requested version 1\.2\) with any of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingConfigVersion.cmake b/Tests/CMakeCommands/find_package/MissingConfigVersion.cmake new file mode 100644 index 0000000..ac35a79 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingConfigVersion.cmake @@ -0,0 +1 @@ +find_package(NotHere 1.2 CONFIG) diff --git a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt new file mode 100644 index 0000000..71b5eae --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt @@ -0,0 +1,21 @@ +CMake Warning at MissingModule.cmake:1 \(find_package\): + No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\): + FindNotHere.cmake must either be part of this project itself, in this case + adjust CMAKE_MODULE_PATH so that it points to the correct location inside + its source tree. + + Or it must be installed by a package which has already been found via + find_package\(\). In this case make sure that package has indeed been found + and adjust CMAKE_MODULE_PATH to contain the location where that package has + installed FindNotHere.cmake. This must be a location provided by that + package. This error in general means that the buildsystem of this project + is relying on a Find-module without ensuring that it is actually available. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/CMakeCommands/find_package/MissingModule.cmake b/Tests/CMakeCommands/find_package/MissingModule.cmake new file mode 100644 index 0000000..420539f --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingModule.cmake @@ -0,0 +1 @@ +find_package(NotHere MODULE) diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt b/Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt new file mode 100644 index 0000000..c3cd350 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt @@ -0,0 +1,21 @@ +CMake Error at MissingModuleRequired.cmake:1 \(find_package\): + No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\): + FindNotHere.cmake must either be part of this project itself, in this case + adjust CMAKE_MODULE_PATH so that it points to the correct location inside + its source tree. + + Or it must be installed by a package which has already been found via + find_package\(\). In this case make sure that package has indeed been found + and adjust CMAKE_MODULE_PATH to contain the location where that package has + installed FindNotHere.cmake. This must be a location provided by that + package. This error in general means that the buildsystem of this project + is relying on a Find-module without ensuring that it is actually available. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake new file mode 100644 index 0000000..07f36c5 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake @@ -0,0 +1 @@ +find_package(NotHere MODULE REQUIRED) diff --git a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt new file mode 100644 index 0000000..e5cbd97 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt @@ -0,0 +1,17 @@ +CMake Warning at MissingNormal.cmake:1 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormal.cmake b/Tests/CMakeCommands/find_package/MissingNormal.cmake new file mode 100644 index 0000000..778cd38 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormal.cmake @@ -0,0 +1 @@ +find_package(NotHere) diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt b/Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt new file mode 100644 index 0000000..ac52aec --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at MissingNormalRequired.cmake:1 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake new file mode 100644 index 0000000..5c33fca --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake @@ -0,0 +1 @@ +find_package(NotHere REQUIRED) diff --git a/Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt new file mode 100644 index 0000000..36de800 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt @@ -0,0 +1,17 @@ +CMake Warning at MissingNormalVersion.cmake:1 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" + \(requested version 1\.2\) with any of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalVersion.cmake b/Tests/CMakeCommands/find_package/MissingNormalVersion.cmake new file mode 100644 index 0000000..2d9ce4e --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalVersion.cmake @@ -0,0 +1 @@ +find_package(NotHere 1.2) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt new file mode 100644 index 0000000..d34f23c --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt @@ -0,0 +1,30 @@ +CMake Warning \(dev\) at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\): + find_package called without either MODULE or CONFIG option and no + FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to + exclusively request Module mode and fail if FindNotHere.cmake is missing. + Add CONFIG to exclusively request Config mode and search for a package + configuration file provided by NotHere \(NotHereConfig.cmake or + nothere-config.cmake\). + + \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake new file mode 100644 index 0000000..0211249 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake @@ -0,0 +1,3 @@ +set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1) +set(CMAKE_MINIMUM_REQUIRED_VERSION 2.8.8) +find_package(NotHere) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt new file mode 100644 index 0000000..b336b56 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt @@ -0,0 +1,29 @@ +CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): + find_package called without NO_MODULE option and no FindNotHere.cmake + module is in CMAKE_MODULE_PATH. Add NO_MODULE to exclusively request + Config mode and search for a package configuration file provided by NotHere + \(NotHereConfig.cmake or nothere-config.cmake\). Otherwise make + FindNotHere.cmake available in CMAKE_MODULE_PATH. + + \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake new file mode 100644 index 0000000..1c4a775 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake @@ -0,0 +1,2 @@ +set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1) +find_package(NotHere) diff --git a/Tests/CMakeCommands/find_package/MixedModeOptions-result.txt b/Tests/CMakeCommands/find_package/MixedModeOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/CMakeCommands/find_package/MixedModeOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt b/Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt new file mode 100644 index 0000000..b867022 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at MixedModeOptions.cmake:1 \(find_package\): + find_package given options exclusive to Module mode: + + MODULE + + and options exclusive to Config mode: + + CONFIG + CONFIGS + NO_DEFAULT_PATH + + The options are incompatible. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MixedModeOptions.cmake b/Tests/CMakeCommands/find_package/MixedModeOptions.cmake new file mode 100644 index 0000000..7f78ee0 --- /dev/null +++ b/Tests/CMakeCommands/find_package/MixedModeOptions.cmake @@ -0,0 +1 @@ +find_package(NotHere MODULE CONFIG CONFIGS NotHereConfig.cmake NO_DEFAULT_PATH) diff --git a/Tests/CMakeCommands/find_package/test.cmake b/Tests/CMakeCommands/find_package/test.cmake new file mode 100644 index 0000000..dd1072e --- /dev/null +++ b/Tests/CMakeCommands/find_package/test.cmake @@ -0,0 +1,80 @@ +if(NOT DEFINED dir) + message(FATAL_ERROR "dir not defined") +endif() + +if(NOT DEFINED gen) + message(FATAL_ERROR "gen not defined") +endif() + +# TODO: Generalize this for other tests. +function(run_test test) + set(top_src "${CMAKE_CURRENT_LIST_DIR}") + set(top_bin "${dir}") + if(EXISTS ${top_src}/${test}-result.txt) + file(READ ${top_src}/${test}-result.txt expect_result) + string(REGEX REPLACE "\n+$" "" expect_result "${expect_result}") + else() + set(expect_result 0) + endif() + foreach(o out err) + if(EXISTS ${top_src}/${test}-std${o}.txt) + file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) + string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") + else() + unset(expect_std${o}) + endif() + endforeach() + set(source_dir "${top_src}") + set(binary_dir "${top_bin}/${test}-build") + file(REMOVE_RECURSE "${binary_dir}") + file(MAKE_DIRECTORY "${binary_dir}") + execute_process( + COMMAND ${CMAKE_COMMAND} "${source_dir}" -G "${gen}" -DTEST=${test} + WORKING_DIRECTORY "${binary_dir}" + OUTPUT_VARIABLE actual_stdout + ERROR_VARIABLE actual_stderr + RESULT_VARIABLE actual_result + ) + set(msg "") + if(NOT "${actual_result}" STREQUAL "${expect_result}") + set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") + endif() + foreach(o out err) + string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") + set(expect_${o} "") + if(DEFINED expect_std${o}) + if(NOT "${actual_std${o}}" MATCHES "${expect_std${o}}") + string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} + " expect-${o}> ${expect_std${o}}") + set(expect_${o} "Expected std${o} to match:\n${expect_${o}}\n") + set(msg "${msg}std${o} does not match that expected.\n") + endif() + endif() + endforeach() + if(msg) + string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") + string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}") + message(SEND_ERROR "${test} - FAILED:\n" + "${msg}" + "${expect_out}" + "Actual stdout:\n${actual_out}\n" + "${expect_err}" + "Actual stderr:\n${actual_err}\n" + ) + else() + message(STATUS "${test} - PASSED") + endif() +endfunction() + +run_test(MissingNormal) +run_test(MissingNormalRequired) +run_test(MissingNormalVersion) +run_test(MissingNormalWarnNoModuleOld) +run_test(MissingNormalWarnNoModuleNew) +run_test(MissingModule) +run_test(MissingModuleRequired) +run_test(MissingConfig) +run_test(MissingConfigOneName) +run_test(MissingConfigRequired) +run_test(MissingConfigVersion) +run_test(MixedModeOptions) -- cgit v0.12 From 80072d4ebfd2bc431649298618e040e1eba5822f Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Tue, 28 Feb 2012 17:05:54 +0400 Subject: doxygen: cmPropertyDefinition --- Source/cmPropertyDefinition.h | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index f68db87..4a3c887 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -14,45 +14,56 @@ #include "cmProperty.h" -class cmPropertyDefinition +/** \class cmPropertyDefinition + * \brief Property meta-information + * + * This class contains the following meta-information about property: + * - Name; + * - Various documentation strings; + * - The scope of the property; + * - If the property is chained. + */ +class cmPropertyDefinition { public: - // Define this property + /// Define this property void DefineProperty(const char *name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, const char *DocumentationSection, bool chained); - // get the documentation string + /// Get the documentation string cmDocumentationEntry GetDocumentation() const; - // basic constructor + /// Default constructor cmPropertyDefinition() { this->Chained = false; }; - // is it chained? + /// Is the property chained? bool IsChained() {return this->Chained; }; - // Get the section if any + /// Get the section if any const std::string &GetDocumentationSection() const { return this->DocumentationSection; }; - - // get the scope + + /// Get the scope cmProperty::ScopeType GetScope() const { return this->Scope; }; - // get the docs + /// Get the documentation (short version) const std::string &GetShortDescription() const { - return this->ShortDescription; }; + return this->ShortDescription; }; + + /// Get the documentation (full version) const std::string &GetFullDescription() const { return this->FullDescription; }; - + protected: std::string Name; std::string ShortDescription; std::string FullDescription; std::string DocumentationSection; - cmProperty::ScopeType Scope; + cmProperty::ScopeType Scope; bool Chained; }; -- cgit v0.12 From 54ab11c0d23fcd015ec2e5686524ac9c746ed0ca Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sat, 25 Feb 2012 13:16:07 +0400 Subject: doxygen: Improve API docs of GetRealDependency Use list instead of sequence of sentences in one paragraph. --- Source/cmLocalGenerator.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 0c5b9d0..c3d057f 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -160,15 +160,18 @@ public: void AppendFeatureOptions(std::string& flags, const char* lang, const char* feature); - /** Translate a dependency as given in CMake code to the name to - appear in a generated build file. If the given name is that of - a utility target, returns false. If the given name is that of - a CMake target it will be transformed to the real output - location of that target for the given configuration. If the - given name is the full path to a file it will be returned. - Otherwise the name is treated as a relative path with respect to - the source directory of this generator. This should only be - used for dependencies of custom commands. */ + /** \brief Get absolute path to dependency \a name + * + * Translate a dependency as given in CMake code to the name to + * appear in a generated build file. + * - If \a name is a utility target, returns false. + * - If \a name is a CMake target, it will be transformed to the real output + * location of that target for the given configuration. + * - If \a name is the full path to a file, it will be returned. + * - Otherwise \a name is treated as a relative path with respect to + * the source directory of this generator. This should only be + * used for dependencies of custom commands. + */ bool GetRealDependency(const char* name, const char* config, std::string& dep); -- cgit v0.12 From 1e5b971ed0346849243ecbcd05443404ebf7a3cb Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sun, 26 Feb 2012 02:21:39 +0400 Subject: doxygen: Use proper syntax to document enum --- Source/cmake.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Source/cmake.h b/Source/cmake.h index 31b1bb7..cfa747e 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -66,21 +66,24 @@ class cmake }; - /** Describes the working modes of cmake. - * NORMAL_MODE: cmake runs to create project files - * SCRIPT_MODE: in script mode there is no generator and no cache. Also, - * language are not enabled, so add_executable and things do - * not do anything. Started by using -P - * FIND_PACKAGE_MODE: cmake runs in pkg-config like mode, i.e. it just - * searches for a package and prints the results to stdout. - * This is similar to SCRIPT_MODE, but commands like - * add_library() work too, since they may be used e.g. in - * exported target files. Started via --find-package - */ + /** \brief Describes the working modes of cmake */ enum WorkingMode { - NORMAL_MODE, + NORMAL_MODE, ///< Cmake runs to create project files + /** \brief Script mode (started by using -P). + * + * In script mode there is no generator and no cache. Also, + * languages are not enabled, so add_executable and things do + * nothing. + */ SCRIPT_MODE, + /** \brief A pkg-config like mode + * + * In this mode cmake just searches for a package and prints the results to + * stdout. This is similar to SCRIPT_MODE, but commands like add_library() + * work too, since they may be used e.g. in exported target files. Started + * via --find-package. + */ FIND_PACKAGE_MODE }; typedef std::map RegisteredCommandsMap; -- cgit v0.12 From 4a48be323bfc9e7e3089bd1bef3141cd1b397f7f Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sun, 26 Feb 2012 02:36:38 +0400 Subject: doxygen: Small fixes in cmake.h apidocs --- Source/cmake.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmake.h b/Source/cmake.h index cfa747e..3558374 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -88,12 +88,11 @@ class cmake }; typedef std::map RegisteredCommandsMap; - ///! construct an instance of cmake + /// Default constructor cmake(); - ///! destruct an instance of cmake + /// Destructor ~cmake(); - ///! construct an instance of cmake static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";}; static const char *GetCMakeFilesDirectoryPostSlash() { return "CMakeFiles/";}; -- cgit v0.12 From 4fd479816da0a0ff21c6634ea7c82ff27b321b85 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 29 Feb 2012 00:01:02 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 92a27dc..620d90a 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 02) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 28) +SET(KWSYS_DATE_STAMP_DAY 29) -- cgit v0.12 From 89403bf87f21d9bccb9c73afb5df914cb88ec9ee Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Wed, 29 Feb 2012 11:49:42 +0400 Subject: Rename UsedCommands to FinalPassCommands When I read 'UsedCommands' I thought that it holds all commands used in the file, not only those that have FinalPass(). --- Source/cmMakefile.cxx | 10 +++++----- Source/cmMakefile.h | 8 +------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fdf5b31..a715f06 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -210,9 +210,9 @@ cmMakefile::~cmMakefile() { delete *i; } - for(unsigned int i=0; i < this->UsedCommands.size(); i++) + for(unsigned int i=0; i < this->FinalPassCommands.size(); i++) { - delete this->UsedCommands[i]; + delete this->FinalPassCommands[i]; } std::vector::iterator pos; for (pos = this->FunctionBlockers.begin(); @@ -421,7 +421,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, else if(pcmd->HasFinalPass()) { // use the command - this->UsedCommands.push_back(pcmd.release()); + this->FinalPassCommands.push_back(pcmd.release()); } } else if ( this->GetCMakeInstance()->GetWorkingMode() == cmake::SCRIPT_MODE @@ -813,8 +813,8 @@ void cmMakefile::FinalPass() // give all the commands a chance to do something // after the file has been parsed before generation - for(std::vector::iterator i = this->UsedCommands.begin(); - i != this->UsedCommands.end(); ++i) + for(std::vector::iterator i = this->FinalPassCommands.begin(); + i != this->FinalPassCommands.end(); ++i) { (*i)->FinalPass(); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1c46a73..f1f318a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -620,12 +620,6 @@ public: */ bool CanIWriteThisFile(const char* fileName); - /** - * Get the vector of used command instances. - */ - const std::vector& GetUsedCommands() const - {return this->UsedCommands;} - #if defined(CMAKE_BUILD_WITH_CMAKE) /** * Get the vector source groups. @@ -913,7 +907,7 @@ protected: std::vector SourceGroups; #endif - std::vector UsedCommands; + std::vector FinalPassCommands; cmLocalGenerator* LocalGenerator; bool IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus &status); -- cgit v0.12 From ab9661c1dd4340af5a84244c920d94bddd1c8e90 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 29 Feb 2012 07:55:31 -0700 Subject: Remove QtGui dependency in Qt4Deploy test and verify QtSql existance. --- Tests/CMakeLists.txt | 2 +- Tests/Qt4Deploy/CMakeLists.txt | 2 +- Tests/Qt4Deploy/testdeploy.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cc2ae5e..13e57d9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -268,7 +268,7 @@ IF(BUILD_TESTING) # run test for DeployQt4 on supported platforms/compilers (which depends on BundleUtilities) # this test also depends on the existence of the standard qtiff plugin - if(QT4_WORKS) + if(QT4_WORKS AND QT_QTSQL_FOUND) ADD_TEST(Qt4Deploy ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4Deploy" diff --git a/Tests/Qt4Deploy/CMakeLists.txt b/Tests/Qt4Deploy/CMakeLists.txt index ccacf74..646ea9f 100644 --- a/Tests/Qt4Deploy/CMakeLists.txt +++ b/Tests/Qt4Deploy/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8) project(Qt4Deploy) set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install) -find_package(Qt4 REQUIRED QtMain QtCore QtGui QtSql) +find_package(Qt4 REQUIRED QtMain QtCore QtSql) include(${QT_USE_FILE}) add_executable(testdeploy MACOSX_BUNDLE testdeploy.cpp) diff --git a/Tests/Qt4Deploy/testdeploy.cpp b/Tests/Qt4Deploy/testdeploy.cpp index bcf77a2..8b9c8d6 100644 --- a/Tests/Qt4Deploy/testdeploy.cpp +++ b/Tests/Qt4Deploy/testdeploy.cpp @@ -1,8 +1,8 @@ #include -#include #include #include #include +#include int main(int argc, char** argv) { -- cgit v0.12 From 5663e436abe7395f4269ba8269d2a869e0b83fab Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 29 Feb 2012 08:29:46 -0700 Subject: DragNDrop: Fix problem with relocated files in Xcode 4.3 Remove dependency on /Developer/Headers/FlatCarbon when creating SLAs for DMG images. Instead, of adding those .r files on the command line, include the necessary .r files from the generated .r file. --- Source/CPack/cmCPackDragNDropGenerator.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 83b6b64..3b6135e 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -421,6 +421,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, if(ifs.is_open()) { cmGeneratedFileStream osf(sla_r.c_str()); + osf << "#include \n\n"; osf << SLAHeader; osf << "\n"; osf << "data 'TEXT' (5002, \"English\") {\n"; @@ -481,13 +482,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Rez the SLA cmOStringStream embed_sla_command; - embed_sla_command << "/bin/bash -c \""; // need expansion of "*.r" embed_sla_command << this->GetOption("CPACK_COMMAND_REZ"); - embed_sla_command << " /Developer/Headers/FlatCarbon/*.r "; - embed_sla_command << "'" << sla_r << "'"; + embed_sla_command << " \"" << sla_r << "\""; embed_sla_command << " -a -o "; - embed_sla_command << "'" << temp_udco << "'\""; - + embed_sla_command << "\"" << temp_udco << "\""; + if(!this->RunCommand(embed_sla_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, -- cgit v0.12 From 95f50940cc10c22077435326db14904d1a06408b Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 29 Feb 2012 18:46:47 +0100 Subject: document when version detection will not work --- Modules/FindGnuplot.cmake | 2 ++ Modules/FindImageMagick.cmake | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index 3e36e4b..b8dc3f4 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -5,6 +5,8 @@ # GNUPLOT_FOUND - system has Gnuplot # GNUPLOT_EXECUTABLE - the Gnuplot executable # GNUPLOT_VERSION_STRING - the version of Gnuplot found (since CMake 2.8.8) +# +# GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1. #============================================================================= # Copyright 2002-2009 Kitware, Inc. diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 52d575b..40760e5 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -27,6 +27,8 @@ # ImageMagick_VERSION_STRING - the version of ImageMagick found # (since CMake 2.8.8) # +# ImageMagick_VERSION_STRING will not work for old versions like 5.2.3. +# # There are also components for the following ImageMagick APIs: # # Magick++ -- cgit v0.12 From 737c49a357e7a97b213857fd899081d42f38c143 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sat, 25 Feb 2012 10:49:24 +0400 Subject: Add 'const' qualifier to some cmCommand members Use const_cast for the special case in cmFindBase where GetFullDocumentation calls GenerateDocumentation. --- Source/CTest/cmCTestBuildCommand.h | 6 +++--- Source/CTest/cmCTestConfigureCommand.h | 6 +++--- Source/CTest/cmCTestCoverageCommand.h | 6 +++--- Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h | 6 +++--- Source/CTest/cmCTestMemCheckCommand.h | 6 +++--- Source/CTest/cmCTestReadCustomFilesCommand.h | 6 +++--- Source/CTest/cmCTestRunScriptCommand.h | 6 +++--- Source/CTest/cmCTestSleepCommand.h | 6 +++--- Source/CTest/cmCTestStartCommand.h | 6 +++--- Source/CTest/cmCTestSubmitCommand.h | 6 +++--- Source/CTest/cmCTestTestCommand.h | 6 +++--- Source/CTest/cmCTestTestHandler.cxx | 24 +++++++++++------------ Source/CTest/cmCTestUpdateCommand.h | 6 +++--- Source/CTest/cmCTestUploadCommand.h | 6 +++--- Source/cmAddCustomCommandCommand.h | 6 +++--- Source/cmAddCustomTargetCommand.h | 6 +++--- Source/cmAddDefinitionsCommand.h | 6 +++--- Source/cmAddDependenciesCommand.h | 6 +++--- Source/cmAddExecutableCommand.h | 6 +++--- Source/cmAddLibraryCommand.h | 6 +++--- Source/cmAddSubDirectoryCommand.h | 6 +++--- Source/cmAddTestCommand.h | 6 +++--- Source/cmAuxSourceDirectoryCommand.h | 6 +++--- Source/cmBreakCommand.h | 8 ++++---- Source/cmBuildCommand.h | 6 +++--- Source/cmBuildNameCommand.h | 10 +++++----- Source/cmCMakeMinimumRequired.h | 8 ++++---- Source/cmCMakePolicyCommand.h | 8 ++++---- Source/cmCommand.h | 14 ++++++------- Source/cmConfigureFileCommand.h | 8 ++++---- Source/cmCreateTestSourceList.h | 6 +++--- Source/cmDefinePropertyCommand.h | 6 +++--- Source/cmElseCommand.h | 8 ++++---- Source/cmElseIfCommand.h | 8 ++++---- Source/cmEnableLanguageCommand.h | 6 +++--- Source/cmEnableTestingCommand.h | 6 +++--- Source/cmEndForEachCommand.h | 8 ++++---- Source/cmEndFunctionCommand.h | 8 ++++---- Source/cmEndIfCommand.h | 8 ++++---- Source/cmEndMacroCommand.h | 8 ++++---- Source/cmEndWhileCommand.h | 8 ++++---- Source/cmExecProgramCommand.h | 10 +++++----- Source/cmExecuteProcessCommand.h | 8 ++++---- Source/cmExportCommand.h | 6 +++--- Source/cmExportLibraryDependencies.h | 8 ++++---- Source/cmFLTKWrapUICommand.h | 6 +++--- Source/cmFileCommand.h | 8 ++++---- Source/cmFindBase.cxx | 4 ++-- Source/cmFindBase.h | 2 +- Source/cmFindFileCommand.h | 4 ++-- Source/cmFindLibraryCommand.h | 6 +++--- Source/cmFindPackageCommand.cxx | 4 ++-- Source/cmFindPackageCommand.h | 8 ++++---- Source/cmFindPathCommand.h | 6 +++--- Source/cmFindProgramCommand.h | 6 +++--- Source/cmForEachCommand.h | 8 ++++---- Source/cmFunctionCommand.cxx | 10 +++++----- Source/cmFunctionCommand.h | 8 ++++---- Source/cmGetCMakePropertyCommand.h | 8 ++++---- Source/cmGetDirectoryPropertyCommand.h | 8 ++++---- Source/cmGetFilenameComponentCommand.h | 8 ++++---- Source/cmGetPropertyCommand.h | 8 ++++---- Source/cmGetSourceFilePropertyCommand.h | 6 +++--- Source/cmGetTargetPropertyCommand.h | 6 +++--- Source/cmGetTestPropertyCommand.h | 6 +++--- Source/cmIfCommand.h | 8 ++++---- Source/cmIncludeCommand.h | 8 ++++---- Source/cmIncludeDirectoryCommand.h | 6 +++--- Source/cmIncludeExternalMSProjectCommand.h | 6 +++--- Source/cmIncludeRegularExpressionCommand.h | 6 +++--- Source/cmInstallCommand.h | 6 +++--- Source/cmInstallFilesCommand.h | 8 ++++---- Source/cmInstallProgramsCommand.h | 8 ++++---- Source/cmInstallTargetsCommand.h | 8 ++++---- Source/cmLinkDirectoriesCommand.h | 6 +++--- Source/cmLinkLibrariesCommand.h | 8 ++++---- Source/cmListCommand.h | 8 ++++---- Source/cmLoadCacheCommand.h | 6 +++--- Source/cmLoadCommandCommand.cxx | 6 +++--- Source/cmLoadCommandCommand.h | 6 +++--- Source/cmMacroCommand.cxx | 10 +++++----- Source/cmMacroCommand.h | 8 ++++---- Source/cmMakeDirectoryCommand.h | 10 +++++----- Source/cmMarkAsAdvancedCommand.h | 8 ++++---- Source/cmMathCommand.h | 8 ++++---- Source/cmMessageCommand.h | 8 ++++---- Source/cmOptionCommand.h | 8 ++++---- Source/cmOutputRequiredFilesCommand.h | 8 ++++---- Source/cmProjectCommand.h | 6 +++--- Source/cmQTWrapCPPCommand.h | 6 +++--- Source/cmQTWrapUICommand.h | 6 +++--- Source/cmRemoveCommand.h | 10 +++++----- Source/cmRemoveDefinitionsCommand.h | 6 +++--- Source/cmReturnCommand.h | 8 ++++---- Source/cmSeparateArgumentsCommand.h | 8 ++++---- Source/cmSetCommand.h | 8 ++++---- Source/cmSetDirectoryPropertiesCommand.h | 8 ++++---- Source/cmSetPropertyCommand.h | 8 ++++---- Source/cmSetSourceFilesPropertiesCommand.h | 6 +++--- Source/cmSetTargetPropertiesCommand.h | 6 +++--- Source/cmSetTestsPropertiesCommand.h | 6 +++--- Source/cmSiteNameCommand.h | 8 ++++---- Source/cmSourceGroupCommand.h | 6 +++--- Source/cmStringCommand.h | 8 ++++---- Source/cmSubdirCommand.h | 8 ++++---- Source/cmSubdirDependsCommand.h | 8 ++++---- Source/cmTargetLinkLibrariesCommand.h | 6 +++--- Source/cmTryCompileCommand.h | 6 +++--- Source/cmTryRunCommand.h | 6 +++--- Source/cmUnsetCommand.h | 8 ++++---- Source/cmUseMangledMesaCommand.h | 10 +++++----- Source/cmUtilitySourceCommand.h | 8 ++++---- Source/cmVariableRequiresCommand.h | 8 ++++---- Source/cmVariableWatchCommand.h | 8 ++++---- Source/cmWhileCommand.h | 8 ++++---- Source/cmWriteFileCommand.h | 10 +++++----- 116 files changed, 420 insertions(+), 420 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 9eb4907..cabc39b 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_build";} + virtual const char* GetName() const { return "ctest_build";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Build the project."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res]\n" diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 156e6f2..b343fc1 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -38,12 +38,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_configure";} + virtual const char* GetName() const { return "ctest_configure";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Configure the project build tree."; } @@ -51,7 +51,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_configure([BUILD build_dir] [SOURCE source_dir] [APPEND]\n" diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 25c10dc..2fe762c 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_coverage";} + virtual const char* GetName() const { return "ctest_coverage";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Collect coverage tool results."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_coverage([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index cf61045..a763fe9 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_empty_binary_directory";} + virtual const char* GetName() const { return "ctest_empty_binary_directory";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "empties the binary directory"; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_empty_binary_directory( directory )\n" diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 8fa142f..399fe8b 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_memcheck";} + virtual const char* GetName() const { return "ctest_memcheck";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Run tests with a dynamic analysis tool."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_memcheck([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 2213c8f..f382b0f 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -46,12 +46,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_read_custom_files";} + virtual const char* GetName() const { return "ctest_read_custom_files";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "read CTestCustom files."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_read_custom_files( directory ... )\n" diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 5765150..6df69af 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -47,12 +47,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_run_script";} + virtual const char* GetName() const { return "ctest_run_script";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "runs a ctest -S script"; } @@ -60,7 +60,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_run_script([NEW_PROCESS] script_file_name script_file_name1 \n" diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 468cd85..80fd6af 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -47,12 +47,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_sleep";} + virtual const char* GetName() const { return "ctest_sleep";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "sleeps for some amount of time"; } @@ -60,7 +60,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_sleep()\n" diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index afbc77b..6be4770 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -55,12 +55,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_start";} + virtual const char* GetName() const { return "ctest_start";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Starts the testing for a given model"; } @@ -68,7 +68,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_start(Model [TRACK ] [APPEND] [source [binary]])\n" diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index edc9c65..53ee875 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_submit";} + virtual const char* GetName() const { return "ctest_submit";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Submit results to a dashboard server."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_submit([PARTS ...] [FILES ...] [RETRY_COUNT count] " diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index c6fd631..d184ff2 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_test";} + virtual const char* GetName() const { return "ctest_test";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Run tests in the project build tree."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_test([BUILD build_dir] [APPEND]\n" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9b12393..ead449e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -59,11 +59,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "subdirs";} + virtual const char* GetName() const { return "subdirs";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestSubdirCommand, cmCommand); @@ -161,11 +161,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_subdirectory";} + virtual const char* GetName() const { return "add_subdirectory";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); @@ -251,11 +251,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ADD_TEST";} + virtual const char* GetName() const { return "ADD_TEST";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestAddTestCommand, cmCommand); @@ -299,11 +299,11 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "SET_TESTS_PROPERTIES";} + virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";} // Unused methods - virtual const char* GetTerseDocumentation() { return ""; } - virtual const char* GetFullDocumentation() { return ""; } + virtual const char* GetTerseDocumentation() const { return ""; } + virtual const char* GetFullDocumentation() const { return ""; } cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 7f36928..c578fff 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_update";} + virtual const char* GetName() const { return "ctest_update";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Update the work tree from version control."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_update([SOURCE source] [RETURN_VALUE res])\n" diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 6c2a4c2..62f379f 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "ctest_upload";} + virtual const char* GetName() const { return "ctest_upload";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Upload files to a dashboard server."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " ctest_upload(FILES ...)\n" diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 05e7dc2..1f770ed 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -44,12 +44,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "add_custom_command";} + virtual const char* GetName() const {return "add_custom_command";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a custom build rule to the generated build system."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "There are two main signatures for add_custom_command " diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index 6d94fb2..50bffef 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -42,13 +42,13 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() + virtual const char* GetName() const {return "add_custom_target";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a target with no output so it will always be built."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_custom_target(Name [ALL] [command1 [args1...]]\n" diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index 0617f04..7bb3767 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "add_definitions";} + virtual const char* GetName() const {return "add_definitions";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Adds -D define flags to the compilation of source files."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_definitions(-DFOO -DBAR ...)\n" diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index fee011c..14a7741 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_dependencies";} + virtual const char* GetName() const { return "add_dependencies";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a dependency between top-level targets."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_dependencies(target-name depend-target1\n" diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 6834f58..1e9f9b3 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_executable";} + virtual const char* GetName() const { return "add_executable";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add an executable to the project using the specified source files."; @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_executable( [WIN32] [MACOSX_BUNDLE]\n" diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index edca1bb..9ca9cbe 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_library";} + virtual const char* GetName() const { return "add_library";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a library to the project using the specified source files."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_library( [STATIC | SHARED | MODULE]\n" diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index dae705e..3d6f51e 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_subdirectory";} + virtual const char* GetName() const { return "add_subdirectory";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a subdirectory to the build."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_subdirectory(source_dir [binary_dir] \n" diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index edaf12c..59f10f6 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "add_test";} + virtual const char* GetName() const { return "add_test";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add a test to the project with the specified arguments."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " add_test(testname Exename arg1 arg2 ... )\n" diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index 704e2ed..f059e44 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -44,12 +44,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "aux_source_directory";} + virtual const char* GetName() const { return "aux_source_directory";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find all source files in a directory."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " aux_source_directory( )\n" diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 72796e8..67ef37e 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "break";} + virtual const char* GetName() const {return "break";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Break from an enclosing foreach or while loop."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " break()\n" diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 1d247d2..a333c5d 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -50,12 +50,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "build_command";} + virtual const char* GetName() const {return "build_command";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get the command line to build this project."; } @@ -63,7 +63,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " build_command(\n" diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 29a680f..26505a2 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "build_name";} + virtual const char* GetName() const {return "build_name";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use ${CMAKE_SYSTEM} and ${CMAKE_CXX_COMPILER} instead."; @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " build_name(variable)\n" @@ -69,7 +69,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 1121386..d23ce79 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "cmake_minimum_required";} + virtual const char* GetName() const {return "cmake_minimum_required";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set the minimum required version of cmake for a project."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]]\n" diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index afd3001..4f1ed36 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -41,17 +41,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "cmake_policy";} + virtual const char* GetName() const {return "cmake_policy";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Manage CMake Policy settings."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "As CMake evolves it is sometimes necessary to change existing " diff --git a/Source/cmCommand.h b/Source/cmCommand.h index e046096..4faaee3 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -96,7 +96,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() + virtual bool IsScriptable() const { return false; } @@ -105,7 +105,7 @@ public: * This determines if usage of the method is discouraged or not. * This is currently only used for generating the documentation. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return false; } @@ -116,7 +116,7 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() + virtual bool ShouldAppearInDocumentation() const { return true; } @@ -124,17 +124,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() = 0; + virtual const char* GetName() const = 0; /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() = 0; + virtual const char* GetTerseDocumentation() const = 0; /** * More documentation. */ - virtual const char* GetFullDocumentation() = 0; + virtual const char* GetFullDocumentation() const = 0; /** * Enable the command. @@ -151,7 +151,7 @@ public: /** * Query whether the command is enabled. */ - bool GetEnabled() + bool GetEnabled() const {return this->Enabled;} /** diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index be33569..de497a9 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -34,17 +34,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "configure_file";} + virtual const char* GetName() const { return "configure_file";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Copy a file to another location and modify its contents."; } @@ -52,7 +52,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " configure_file( \n" diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index c4c6ae7..806e5a9 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "create_test_sourcelist";} + virtual const char* GetName() const {return "create_test_sourcelist";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create a test driver and source list for building test programs."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " create_test_sourcelist(sourceListName driverName\n" diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 1fb7801..55ef521 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "define_property";} + virtual const char* GetName() const { return "define_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Define and document custom properties."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " define_property( [args1...]]\n" diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index eb19d2e..ae67b47 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -45,12 +45,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "export";} + virtual const char* GetName() const { return "export";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Export targets from the build tree for use by outside projects."; @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " export(TARGETS [target1 [target2 [...]]] [NAMESPACE ]\n" diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index 32c262f..2a2ff21 100644 --- a/Source/cmExportLibraryDependencies.h +++ b/Source/cmExportLibraryDependencies.h @@ -48,12 +48,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "export_library_dependencies";} + virtual const char* GetName() const { return "export_library_dependencies";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use INSTALL(EXPORT) or EXPORT command."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command generates an old-style library dependencies file. " @@ -83,7 +83,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index 6ecdbcc..cb0f9d5 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -52,12 +52,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "fltk_wrap_ui";} + virtual const char* GetName() const { return "fltk_wrap_ui";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create FLTK user interfaces Wrappers."; } @@ -65,7 +65,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " fltk_wrap_ui(resultingLibraryName source1\n" diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 9e2ed0f..3b368fa 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -41,17 +41,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "file";} + virtual const char* GetName() const { return "file";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "File manipulation command."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " file(WRITE filename \"message to write\"... )\n" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 183da4a..fb8bcf7 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -108,11 +108,11 @@ void cmFindBase::GenerateDocumentation() } //---------------------------------------------------------------------------- -const char* cmFindBase::GetFullDocumentation() +const char* cmFindBase::GetFullDocumentation() const { if(this->GenericDocumentation.empty()) { - this->GenerateDocumentation(); + const_cast(this)->GenerateDocumentation(); } return this->GenericDocumentation.c_str(); } diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index de319b1..37ab2ec 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -31,7 +31,7 @@ public: virtual bool ParseArguments(std::vector const& args); cmTypeMacro(cmFindBase, cmFindCommon); - virtual const char* GetFullDocumentation(); + virtual const char* GetFullDocumentation() const; protected: virtual void GenerateDocumentation(); diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index dd2e01d..7d349d3 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -33,12 +33,12 @@ public: { return new cmFindFileCommand; } - virtual const char* GetName() { return "find_file";} + virtual const char* GetName() const { return "find_file";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find the full path to a file."; } diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index 7930f52..b880be2 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -44,17 +44,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "find_library";} + virtual const char* GetName() const {return "find_library";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find a library."; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 22bb628..6f32c35 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -348,11 +348,11 @@ void cmFindPackageCommand::GenerateDocumentation() } //---------------------------------------------------------------------------- -const char* cmFindPackageCommand::GetFullDocumentation() +const char* cmFindPackageCommand::GetFullDocumentation() const { if(this->CommandDocumentation.empty()) { - this->GenerateDocumentation(); + const_cast(this)->GenerateDocumentation(); } return this->CommandDocumentation.c_str(); } diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index e736352..fb3591d 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -44,17 +44,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "find_package";} + virtual const char* GetName() const { return "find_package";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Load settings for an external project."; } @@ -62,7 +62,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation(); + virtual const char* GetFullDocumentation() const; cmTypeMacro(cmFindPackageCommand, cmFindCommon); protected: diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index bd94779..a612990 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -44,17 +44,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "find_path";} + virtual const char* GetName() const {return "find_path";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find the directory containing a file."; } diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 654e834..c1b14f9 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -43,17 +43,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "find_program";} + virtual const char* GetName() const { return "find_program";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Find an executable program."; } diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 026fd31..0386981 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -63,17 +63,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "foreach";} + virtual const char* GetName() const { return "foreach";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Evaluate a group of commands for each value in a list."; } @@ -81,7 +81,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " foreach(loop_var arg1 arg2 ...)\n" diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 7a80a1c..ce36145 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -28,7 +28,7 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() + virtual bool ShouldAppearInDocumentation() const { return false; } @@ -49,7 +49,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * This is called when the command is first encountered in @@ -64,12 +64,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return this->Args[0].c_str(); } + virtual const char* GetName() const { return this->Args[0].c_str(); } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { std::string docs = "Function named: "; docs += this->GetName(); @@ -79,7 +79,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return this->GetTerseDocumentation(); } diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index a169244..815a693 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -61,17 +61,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "function";} + virtual const char* GetName() const { return "function";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Start recording a function for later invocation as a command."; } @@ -79,7 +79,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " function( [arg1 [arg2 [arg3 ...]]])\n" diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index d82be70..0a5917c 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -32,17 +32,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_cmake_property";} + virtual const char* GetName() const { return "get_cmake_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property of the CMake instance."; } @@ -50,7 +50,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_cmake_property(VAR property)\n" diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index b7a5f71..901b90c 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -32,17 +32,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_directory_property";} + virtual const char* GetName() const { return "get_directory_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property of DIRECTORY scope."; } @@ -50,7 +50,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_directory_property( [DIRECTORY ] )\n" diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index aff4d7e..0c8e57a 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -41,17 +41,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_filename_component";} + virtual const char* GetName() const { return "get_filename_component";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a specific component of a full filename."; } @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_filename_component( FileName\n" diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index d318b19..dca2627 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -34,17 +34,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_property";} + virtual const char* GetName() const { return "get_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property."; } @@ -52,7 +52,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_property(\n" diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 56469f8..6d52503 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_source_file_property";} + virtual const char* GetName() const { return "get_source_file_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property for a source file."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_source_file_property(VAR file property)\n" diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 71c75ef..b60abea 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_target_property";} + virtual const char* GetName() const { return "get_target_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property from a target."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_target_property(VAR target property)\n" diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index d9f5d9b..af6bafa 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -32,12 +32,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "get_test_property";} + virtual const char* GetName() const { return "get_test_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Get a property of the test."; } @@ -45,7 +45,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " get_test_property(test property VAR)\n" diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 4996bc4..ba97922 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -72,12 +72,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "if";} + virtual const char* GetName() const { return "if";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Conditionally execute a group of commands."; } @@ -85,12 +85,12 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " if(expression)\n" diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index d933ef3..c46c02d 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -43,17 +43,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "include";} + virtual const char* GetName() const {return "include";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Read CMake listfile code from the given file."; } @@ -61,7 +61,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include( [OPTIONAL] [RESULT_VARIABLE ]\n" diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 3b35d55..b90fe42 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "include_directories";} + virtual const char* GetName() const { return "include_directories";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Add include directories to the build."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n" diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 5269041..911a772 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "include_external_msproject";} + virtual const char* GetName() const {return "include_external_msproject";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Include an external Microsoft project file in a workspace."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include_external_msproject(projectname location\n" diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 6ddbbed..7c633c0 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "include_regular_expression";} + virtual const char* GetName() const {return "include_regular_expression";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set the regular expression used for dependency checking."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " include_regular_expression(regex_match [regex_complain])\n" diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 377b43a..3403c38 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install";} + virtual const char* GetName() const { return "install";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Specify rules to run at install time."; } @@ -54,7 +54,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command generates installation rules for a project. " diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index da43920..d3c7ed6 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install_files";} + virtual const char* GetName() const { return "install_files";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the install(FILES ) command instead."; } @@ -63,7 +63,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command has been superceded by the install command. It " @@ -92,7 +92,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 1d0d25e..29c84a0 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -41,12 +41,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install_programs";} + virtual const char* GetName() const { return "install_programs";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the install(PROGRAMS ) command instead."; } @@ -64,7 +64,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command has been superceded by the install command. It " @@ -89,7 +89,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index 32641f8..e05462f 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "install_targets";} + virtual const char* GetName() const { return "install_targets";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the install(TARGETS ) command instead."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command has been superceded by the install command. It " @@ -69,7 +69,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index aa13589..a7cd583 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "link_directories";} + virtual const char* GetName() const { return "link_directories";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Specify directories in which the linker will look for libraries."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " link_directories(directory1 directory2 ...)\n" diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index e435126..2c0212c 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "link_libraries";} + virtual const char* GetName() const { return "link_libraries";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the target_link_libraries() command instead."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Link libraries to all targets added later.\n" @@ -70,7 +70,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index d215295..f20aa8a 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -39,17 +39,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "list";} + virtual const char* GetName() const { return "list";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "List operations."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " list(LENGTH )\n" diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index 8ecee4a..ac50f8d 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "load_cache";} + virtual const char* GetName() const { return "load_cache";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Load in the values from another project's CMake cache."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " load_cache(pathToCacheFile READ_WITH_PREFIX\n" diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 98de411..3a0115c 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -69,12 +69,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return info.Name; } + virtual const char* GetName() const { return info.Name; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { if (this->info.GetTerseDocumentation) { @@ -123,7 +123,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { if (this->info.GetFullDocumentation) { diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index db18428..6517019 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "load_command";} + virtual const char* GetName() const {return "load_command";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Load a command into a running CMake."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " load_command(COMMAND_NAME [loc2 ...])\n" diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index f81a63d..2599227 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -28,7 +28,7 @@ public: * cmMacroHelperCommand and cmFunctionHelperCommand * which cannot provide appropriate documentation. */ - virtual bool ShouldAppearInDocumentation() + virtual bool ShouldAppearInDocumentation() const { return false; } @@ -50,7 +50,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * This is called when the command is first encountered in @@ -65,12 +65,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return this->Args[0].c_str(); } + virtual const char* GetName() const { return this->Args[0].c_str(); } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { std::string docs = "Macro named: "; docs += this->GetName(); @@ -80,7 +80,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return this->GetTerseDocumentation(); } diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 93e10b2..65ad5b9 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -61,17 +61,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "macro";} + virtual const char* GetName() const { return "macro";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Start recording a macro for later invocation as a command."; } @@ -79,7 +79,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " macro( [arg1 [arg2 [arg3 ...]]])\n" diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 63b91d1..4e6e1d5 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -44,17 +44,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "make_directory";} + virtual const char* GetName() const { return "make_directory";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the file(MAKE_DIRECTORY ) command instead."; } @@ -62,7 +62,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " make_directory(directory)\n" @@ -72,7 +72,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 26e0a07..3658dbb 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "mark_as_advanced";} + virtual const char* GetName() const {return "mark_as_advanced";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Mark cmake cached variables as advanced."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...)\n" @@ -75,7 +75,7 @@ public: * make many of the modules usable in cmake/ctest scripts, (among them * FindUnixMake.cmake used by the CTEST_BUILD command. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } cmTypeMacro(cmMarkAsAdvancedCommand, cmCommand); }; diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index d31f34b..88654dd 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -39,17 +39,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "math";} + virtual const char* GetName() const { return "math";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Mathematical expressions."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " math(EXPR )\n" diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 932ee77..03ab94b 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -39,17 +39,17 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "message";} + virtual const char* GetName() const { return "message";} /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Display a message to the user."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " message([STATUS|WARNING|AUTHOR_WARNING|FATAL_ERROR|SEND_ERROR]\n" diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index fa5abd8..da31332 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "option";} + virtual const char* GetName() const {return "option";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Provides an option that the user can optionally select."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " option( \"help string describing option\"\n" @@ -68,7 +68,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } cmTypeMacro(cmOptionCommand, cmCommand); }; diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index 6038472..85d9095 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "output_required_files";} + virtual const char* GetName() const { return "output_required_files";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Approximate C preprocessor dependency scanning."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "This command exists only because ancient CMake versions provided it. " @@ -67,7 +67,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index fc2b7a2..25b75df 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "project";} + virtual const char* GetName() const {return "project";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a name for the entire project."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " project( [languageName1 languageName2 ... ] )\n" diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index f972e10..0184927 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -45,12 +45,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "qt_wrap_cpp";} + virtual const char* GetName() const { return "qt_wrap_cpp";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create Qt Wrappers."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " qt_wrap_cpp(resultingLibraryName DestName\n" diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 67e914f..744ae98 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -43,12 +43,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "qt_wrap_ui";} + virtual const char* GetName() const { return "qt_wrap_ui";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Create Qt user interfaces Wrappers."; } @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " qt_wrap_ui(resultingLibraryName HeadersDestName\n" diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index bae2ee1..c62d58f 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "remove";} + virtual const char* GetName() const {return "remove";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the list(REMOVE_ITEM ) command instead."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " remove(VAR VALUE VALUE ...)\n" @@ -68,7 +68,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 519bc42..f0e906d 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "remove_definitions";} + virtual const char* GetName() const {return "remove_definitions";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Removes -D define flags added by add_definitions."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " remove_definitions(-DFOO -DBAR ...)\n" diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 3739e83..690ab79 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "return";} + virtual const char* GetName() const {return "return";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Return from a file, directory or function."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " return()\n" diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 736f066..6a51a92 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "separate_arguments";} + virtual const char* GetName() const {return "separate_arguments";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Parse space-separated arguments into a semicolon-separated list."; @@ -59,7 +59,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " separate_arguments( _COMMAND \"\")\n" diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 2990d24..66b129e 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "set";} + virtual const char* GetName() const {return "set";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a CMAKE variable to a given value."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set( \n" diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 227571f..ee40158 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -32,17 +32,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_directory_properties";} + virtual const char* GetName() const { return "set_directory_properties";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a property of the directory."; } @@ -58,7 +58,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_directory_properties(PROPERTIES prop1 value1 prop2 value2)\n" diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 3a0169e..830299d 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -34,12 +34,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "set_property";} + virtual const char* GetName() const { return "set_property";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Set a named property in a given scope."; } @@ -47,7 +47,7 @@ public: /** * Longer documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " set_property(\n" diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index 3dad67d..eedbfff 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "subdirs";} + virtual const char* GetName() const { return "subdirs";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the add_subdirectory() command instead."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Add a list of subdirectories to the build.\n" @@ -79,7 +79,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index 347f97a..daf97cd 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "subdir_depends";} + virtual const char* GetName() const { return "subdir_depends";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Does nothing."; } @@ -55,7 +55,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " subdir_depends(subdir dep1 dep2 ...)\n" @@ -64,7 +64,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 8df4ac0..be866c3 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -42,12 +42,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "target_link_libraries";} + virtual const char* GetName() const { return "target_link_libraries";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Link a target to given libraries."; @@ -56,7 +56,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " target_link_libraries( [item1 [item2 [...]]]\n" diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 0d57633..68ec666 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -40,19 +40,19 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "try_compile";} + virtual const char* GetName() const { return "try_compile";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Try building some code."; } /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " try_compile(RESULT_VAR \n" diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index f86d863..06a9118 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -40,12 +40,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "try_run";} + virtual const char* GetName() const { return "try_run";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Try compiling and then running some code."; } @@ -53,7 +53,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR\n" diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index 28f8cf4..9cf95d9 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -40,17 +40,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() {return "unset";} + virtual const char* GetName() const {return "unset";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Unset a variable, cache variable, or environment variable."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " unset( [CACHE])\n" diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index fec2265..2f52960 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -45,12 +45,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "use_mangled_mesa";} + virtual const char* GetName() const { return "use_mangled_mesa";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Copy mesa headers for use in combination with system GL."; } @@ -58,7 +58,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " use_mangled_mesa(PATH_TO_MESA OUTPUT_DIRECTORY)\n" @@ -71,10 +71,10 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 6c23814..32afdda 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -44,12 +44,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "utility_source";} + virtual const char* GetName() const { return "utility_source";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Specify the source tree of a third-party utility."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " utility_source(cache_entry executable_name\n" @@ -76,7 +76,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index f165f39..91c351e 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -39,12 +39,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "variable_requires";} + virtual const char* GetName() const { return "variable_requires";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the if() command instead."; } @@ -52,7 +52,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return "Assert satisfaction of an option's required variables.\n" @@ -70,7 +70,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index e2fb934..cb80736 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -49,7 +49,7 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** This command does not really have a final pass but it needs to stay alive since it owns variable watch callback information. */ @@ -58,12 +58,12 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "variable_watch";} + virtual const char* GetName() const { return "variable_watch";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Watch the CMake variable for change."; } @@ -71,7 +71,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " variable_watch( [])\n" diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 04649a3..3a1bd5b 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -70,17 +70,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "while";} + virtual const char* GetName() const { return "while";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Evaluate a group of commands while a condition is true"; } @@ -88,7 +88,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " while(condition)\n" diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 97ec727..8808d32 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -39,17 +39,17 @@ public: /** * This determines if the command is invoked when in script mode. */ - virtual bool IsScriptable() { return true; } + virtual bool IsScriptable() const { return true; } /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() { return "write_file";} + virtual const char* GetName() const { return "write_file";} /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() const { return "Deprecated. Use the file(WRITE ) command instead."; } @@ -57,7 +57,7 @@ public: /** * More documentation. */ - virtual const char* GetFullDocumentation() + virtual const char* GetFullDocumentation() const { return " write_file(filename \"message to write\"... [APPEND])\n" @@ -73,7 +73,7 @@ public: } /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() + virtual bool IsDiscouraged() const { return true; } -- cgit v0.12 From 43d60114a57b12766106cd264f358b9bfa098bba Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sun, 26 Feb 2012 22:44:20 +0400 Subject: Run vim spellcheck on some files --- Source/cmComputeLinkDepends.cxx | 6 +++--- Source/cmComputeTargetDepends.cxx | 2 +- Source/cmCoreTryCompile.cxx | 4 ++-- Source/cmCreateTestSourceList.cxx | 2 +- Source/cmDependsFortran.cxx | 12 ++++++------ Source/cmake.cxx | 18 ++++++++++-------- Source/cmakexbuild.cxx | 2 +- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 9a075bd..ddff2d9 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -27,7 +27,7 @@ This file computes an ordered list of link items to use when linking a single target in one configuration. Each link item is identified by the string naming it. A graph of dependencies is created in which -each node corresponds to one item and directed eges lead from nodes to +each node corresponds to one item and directed edges lead from nodes to those which must *follow* them on the link line. For example, the graph @@ -42,7 +42,7 @@ search of the link dependencies starting from the main target. There are two types of items: those with known direct dependencies and those without known dependencies. We will call the two types "known -items" and "unknown items", respecitvely. Known items are those whose +items" and "unknown items", respectively. Known items are those whose names correspond to targets (built or imported) and those for which an old-style _LIB_DEPENDS variable is defined. All other items are unknown and we must infer dependencies for them. For items that look @@ -150,7 +150,7 @@ times the component needs to be seen (once for trivial components, twice for non-trivial). If at any time another component finishes and re-adds an already pending component, the pending component is reset so that it needs to be seen in its entirety again. This ensures that -all dependencies of a component are satisified no matter where it +all dependencies of a component are satisfied no matter where it appears. After the original link line has been completed, we append to it the diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 8e701c4..ab77c6b 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -31,7 +31,7 @@ dependencies for each target such that no cycles are left and the build order is safe. For most target types cyclic dependencies are not allowed. However -STATIC libraries may depend on each other in a cyclic fasion. In +STATIC libraries may depend on each other in a cyclic fashion. In general the directed dependency graph forms a directed-acyclic-graph of strongly connected components. All strongly connected components should consist of only STATIC_LIBRARY targets. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7d84ba6..48f644b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -153,11 +153,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt"; cmSystemTools::RemoveFile(ccFile.c_str()); - // we need to create a directory and CMakeList file etc... + // we need to create a directory and CMakeLists file etc... // first create the directories sourceDirectory = this->BinaryDirectory.c_str(); - // now create a CMakeList.txt file in that directory + // now create a CMakeLists.txt file in that directory FILE *fout = fopen(outFileName.c_str(),"w"); if (!fout) { diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 953328a..de20cb7 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -70,7 +70,7 @@ bool cmCreateTestSourceList if (cmSystemTools::GetFilenameExtension(*i).size() < 2) { this->SetError( - "You must specify a file extenion for the test driver file."); + "You must specify a file extension for the test driver file."); return false; } std::string driver = this->Makefile->GetCurrentOutputDirectory(); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 9e4726c..c1b6090 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -30,7 +30,7 @@ class cmDependsFortranSourceInfo { public: - // The name of the soruce file. + // The name of the source file. std::string Source; // Set of provided and required modules. @@ -810,8 +810,8 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, * -GNU * -Intel * - * Eat the stream content until all recompile only realated changes - * are left bedind. + * Eat the stream content until all recompile only related changes + * are left behind. */ if (strcmp(compilerId, "GNU") == 0 ) { @@ -852,7 +852,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, } } - // Compare the remainng content. If no compiler id matched above, + // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. if(!cmDependsFortranStreamsDiffer(finModFile, finStampFile)) @@ -1209,7 +1209,7 @@ void cmDependsFortranParser_RuleElif(cmDependsFortranParser* parser) * cmDependsFortranParser_RuleIf(..) */ - // Allways taken unless an #ifdef or #ifndef-branch has been taken + // Always taken unless an #ifdef or #ifndef-branch has been taken // already. If the second condition isn't meet already // (parser->InPPFalseBranch == 0) correct it. if(!parser->SkipToEnd.empty() && @@ -1228,7 +1228,7 @@ void cmDependsFortranParser_RuleElse(cmDependsFortranParser* parser) return; } - // parser->InPPFalseBranch is either 0 or 1. We change it denpending on + // parser->InPPFalseBranch is either 0 or 1. We change it depending on // parser->SkipToEnd.top() if(!parser->SkipToEnd.empty() && parser->SkipToEnd.top()) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cce5080..0b7a996 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -131,7 +131,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable, " that has not been defined. Some variables were always defined " "by CMake in versions prior to 1.6. To fix this you might need to set " "the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.4 or less. If " - "you are writing a CMakeList file, (or have already set " + "you are writing a CMakeLists file, (or have already set " "CMAKE_BACKWARDS_COMPATABILITY to 1.4 or less) then you probably need " "to include a CMake module to test for the feature this variable " "defines."; @@ -1433,7 +1433,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) // Command to start progress for a build else if (args[1] == "cmake_progress_start" && args.size() == 4) { - // bascially remove the directory + // basically remove the directory std::string dirName = args[2]; dirName += "/Progress"; cmSystemTools::RemoveADirectory(dirName.c_str()); @@ -1930,7 +1930,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { delete this->GlobalGenerator; // restore the original environment variables CXX and CC - // Restor CC + // Restore CC std::string env = "CC="; if(this->CCEnvironment.size()) { @@ -2608,7 +2608,7 @@ int cmake::LoadCache() // could we not read the cache if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory())) { - // if it does exist, but isn;t readable then warn the user + // if it does exist, but isn't readable then warn the user std::string cacheFile = this->GetHomeOutputDirectory(); cacheFile += "/CMakeCache.txt"; if(cmSystemTools::FileExists(cacheFile.c_str())) @@ -3369,19 +3369,21 @@ void cmake::DefineProperties(cmake *cm) cm->DefineProperty ("ENABLED_FEATURES", cmProperty::GLOBAL, "List of features which are enabled during the CMake run.", - "List of features which are enabled during the CMake run. Be default " + "List of features which are enabled during the CMake run. By default " "it contains the names of all packages which were found. This is " "determined using the _FOUND variables. Packages which are " "searched QUIET are not listed. A project can add its own features to " - "this list.This property is used by the macros in FeatureSummary.cmake."); + "this list. " + "This property is used by the macros in FeatureSummary.cmake."); cm->DefineProperty ("DISABLED_FEATURES", cmProperty::GLOBAL, "List of features which are disabled during the CMake run.", - "List of features which are disabled during the CMake run. Be default " + "List of features which are disabled during the CMake run. By default " "it contains the names of all packages which were not found. This is " "determined using the _FOUND variables. Packages which are " "searched QUIET are not listed. A project can add its own features to " - "this list.This property is used by the macros in FeatureSummary.cmake."); + "this list. " + "This property is used by the macros in FeatureSummary.cmake."); cm->DefineProperty ("PACKAGES_FOUND", cmProperty::GLOBAL, "List of packages which were found during the CMake run.", diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx index 89d0ec5..8eaae47 100644 --- a/Source/cmakexbuild.cxx +++ b/Source/cmakexbuild.cxx @@ -15,7 +15,7 @@ // This is a wrapper program for xcodebuild // it calls xcodebuild, and does two things -// it removes much of the output, all the setevn +// it removes much of the output, all the setenv // stuff. Also, it checks for the text file busy // error, and re-runs xcodebuild until that error does // not show up. -- cgit v0.12 From 4689eedcc0a1cd73a95dbce583c9470319312b80 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 29 Feb 2012 21:35:20 +0100 Subject: reflect that the QtAutomoc depends on QtGui --- Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 13e57d9..7e56588 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -888,7 +888,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment") - IF(QT4_WORKS) + IF(QT4_WORKS AND QT_QTGUI_FOUND) ADD_TEST(QtAutomoc ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutomoc" -- cgit v0.12 From 477459010f78d0d6d563080466a63490b6b99eb9 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sun, 26 Feb 2012 15:54:41 +0400 Subject: doxygen: fix some comments in cmPolicies.h --- Source/cmPolicies.h | 63 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2160f37..3106248 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -21,8 +21,9 @@ class cmPolicy; /** \class cmPolicies * \brief Handles changes in CMake behavior and policies * - * See the cmake wiki section on policies for an overview of this class's - * purpose + * See the cmake wiki section on + * policies + * for an overview of this class's purpose */ class cmPolicies { @@ -30,32 +31,46 @@ public: cmPolicies(); ~cmPolicies(); - enum PolicyStatus { OLD, WARN, NEW, REQUIRED_IF_USED, REQUIRED_ALWAYS }; + /// Status of a policy + enum PolicyStatus { + OLD, ///< Use old behavior + WARN, ///< Use old behavior but issue a warning + NEW, ///< Use new behavior + /// Issue an error if user doesn't set policy status to NEW and hits the + /// check + REQUIRED_IF_USED, + REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW. + }; static const char* PolicyStatusNames[]; + /// Policy identifiers enum PolicyID { - CMP0000, // Policy version specification - CMP0001, // Ignore old compatibility variable - CMP0002, // Target names must be unique - CMP0003, // Linking does not include extra -L paths - CMP0004, // Libraries linked may not have leading or trailing whitespace - CMP0005, // Definition value escaping - CMP0006, // BUNDLE install rules needed for MACOSX_BUNDLE targets - CMP0007, // list command handling of empty elements - CMP0008, // Full-path libraries must be a valid library file name - CMP0009, // GLOB_RECURSE should not follow symlinks by default - CMP0010, // Bad variable reference syntax is an error - CMP0011, // Strong policy scope for include and find_package - CMP0012, // Recognize numbers and boolean constants in if() - CMP0013, // Duplicate binary directories not allowed - CMP0014, // Input directories must have CMakeLists.txt - CMP0015, // link_directories() treats paths relative to source dir - CMP0016, // target_link_libraries() fails if only argument is not a target - CMP0017, // Prefer files in CMAKE_ROOT when including from CMAKE_ROOT - - // Always the last entry. Useful mostly to avoid adding a comma - // the last policy when adding a new one. + CMP0000, ///< Policy version specification + CMP0001, ///< Ignore old compatibility variable + CMP0002, ///< Target names must be unique + CMP0003, ///< Linking does not include extra -L paths + CMP0004, ///< Libraries linked may not have leading or trailing whitespace + CMP0005, ///< Definition value escaping + CMP0006, ///< BUNDLE install rules needed for MACOSX_BUNDLE targets + CMP0007, ///< list command handling of empty elements + CMP0008, ///< Full-path libraries must be a valid library file name + CMP0009, ///< GLOB_RECURSE should not follow symlinks by default + CMP0010, ///< Bad variable reference syntax is an error + CMP0011, ///< Strong policy scope for include and find_package + CMP0012, ///< Recognize numbers and boolean constants in if() + CMP0013, ///< Duplicate binary directories not allowed + CMP0014, ///< Input directories must have CMakeLists.txt + CMP0015, ///< link_directories() treats paths relative to source dir + /// target_link_libraries() fails if only argument is not a target + CMP0016, + CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT + + /** \brief Always the last entry. + * + * Useful mostly to avoid adding a comma the last policy when adding a new + * one. + */ CMPCOUNT }; -- cgit v0.12 From 937bb4bebf560fddeb2a1438939fd50d177ae2bf Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Tue, 28 Feb 2012 01:54:43 +0400 Subject: doxygen: remove a few comments These comments were either wrong or non-informative. Replace some of them by brief comments --- Source/cmForEachCommand.h | 11 +---------- Source/cmFunctionBlocker.h | 5 ----- Source/cmFunctionCommand.h | 11 +---------- Source/cmIfCommand.h | 11 +---------- Source/cmMacroCommand.h | 11 +---------- Source/cmWhileCommand.h | 11 +---------- 6 files changed, 5 insertions(+), 55 deletions(-) diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 026fd31..e702173 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -16,11 +16,6 @@ #include "cmFunctionBlocker.h" #include "cmListFileCache.h" -/** \class cmForEachFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmForEachFunctionBlocker : public cmFunctionBlocker { public: @@ -37,11 +32,7 @@ private: int Depth; }; -/** \class cmForEachCommand - * \brief starts an if block - * - * cmForEachCommand starts an if block - */ +/// Starts foreach() ... endforeach() block class cmForEachCommand : public cmCommand { public: diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index c3b29e1..9ee0b5c 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -17,11 +17,6 @@ #include "cmListFileCache.h" class cmMakefile; -/** \class cmFunctionBlocker - * \brief A class that defines an interface for blocking cmake functions - * - * This is the superclass for any classes that need to block a cmake function - */ class cmFunctionBlocker { public: diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index a169244..9873964 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -15,11 +15,6 @@ #include "cmCommand.h" #include "cmFunctionBlocker.h" -/** \class cmFunctionFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmFunctionFunctionBlocker : public cmFunctionBlocker { public: @@ -35,11 +30,7 @@ public: int Depth; }; -/** \class cmFunctionCommand - * \brief starts an if block - * - * cmFunctionCommand starts an if block - */ +/// Starts function() ... endfunction() block class cmFunctionCommand : public cmCommand { public: diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 4996bc4..f412442 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -15,11 +15,6 @@ #include "cmCommand.h" #include "cmFunctionBlocker.h" -/** \class cmIfFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmIfFunctionBlocker : public cmFunctionBlocker { public: @@ -39,11 +34,7 @@ public: unsigned int ScopeDepth; }; -/** \class cmIfCommand - * \brief starts an if block - * - * cmIfCommand starts an if block - */ +/// Starts an if block class cmIfCommand : public cmCommand { public: diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 93e10b2..03aa72d 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -15,11 +15,6 @@ #include "cmCommand.h" #include "cmFunctionBlocker.h" -/** \class cmMacroFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmMacroFunctionBlocker : public cmFunctionBlocker { public: @@ -35,11 +30,7 @@ public: int Depth; }; -/** \class cmMacroCommand - * \brief starts an if block - * - * cmMacroCommand starts an if block - */ +/// Starts macro() ... endmacro() block class cmMacroCommand : public cmCommand { public: diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 04649a3..1947fcf 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -16,11 +16,6 @@ #include "cmFunctionBlocker.h" #include "cmListFileCache.h" -/** \class cmWhileFunctionBlocker - * \brief subclass of function blocker - * - * - */ class cmWhileFunctionBlocker : public cmFunctionBlocker { public: @@ -37,11 +32,7 @@ private: int Depth; }; -/** \class cmWhileCommand - * \brief starts a while loop - * - * cmWhileCommand starts a while loop - */ +/// \brief Starts a while loop class cmWhileCommand : public cmCommand { public: -- cgit v0.12 From 486033aef302d122938e6f52fd1c7ad29a5e75a5 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Tue, 28 Feb 2012 16:44:54 +0400 Subject: doxygen: review cmake.h * Move top-level comment to class apidocs * Remove misleading comment --- Source/cmake.h | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/Source/cmake.h b/Source/cmake.h index 3558374..161e656 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -9,28 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -// This class represents a cmake invocation. It is the top level class when -// running cmake. Most cmake based GUIS should primarily create an instance -// of this class and communicate with it. -// -// The basic process for a GUI is as follows: -// -// 1) Create a cmake instance -// 2) Set the Home & Start directories, generator, and cmake command. this -// can be done using the Set methods or by using SetArgs and passing in -// command line arguments. -// 3) Load the cache by calling LoadCache (duh) -// 4) if you are using command line arguments with -D or -C flags then -// call SetCacheArgs (or if for some other reason you want to modify the -// cache, do it now. -// 5) Finally call Configure -// 6) Let the user change values and go back to step 5 -// 7) call Generate -// -// If your GUI allows the user to change the start & home directories then -// you must at a minimum redo steps 2 through 7. -// - #ifndef cmake_h #define cmake_h @@ -53,6 +31,30 @@ class cmListFileBacktrace; class cmTarget; class cmGeneratedFileStream; +/** \brief Represents a cmake invocation. + * + * This class represents a cmake invocation. It is the top level class when + * running cmake. Most cmake based GUIS should primarily create an instance + * of this class and communicate with it. + * + * The basic process for a GUI is as follows: + * + * -# Create a cmake instance + * -# Set the Home & Start directories, generator, and cmake command. this + * can be done using the Set methods or by using SetArgs and passing in + * command line arguments. + * -# Load the cache by calling LoadCache (duh) + * -# if you are using command line arguments with -D or -C flags then + * call SetCacheArgs (or if for some other reason you want to modify the + * cache), do it now. + * -# Finally call Configure + * -# Let the user change values and go back to step 5 + * -# call Generate + + * If your GUI allows the user to change the start & home directories then + * you must at a minimum redo steps 2 through 7. + */ + class cmake { public: @@ -166,12 +168,6 @@ class cmake int Configure(); int ActualConfigure(); - /** - * Configure the cmMakefiles. This routine will create a GlobalGenerator if - * one has not already been set. It will then Call Configure on the - * GlobalGenerator. This in turn will read in an process all the CMakeList - * files for the tree. It will not produce any actual Makefiles, or - * workspaces. Generate does that. */ int LoadCache(); void PreLoadCMakeFiles(); -- cgit v0.12 From 31ab25c0c9298aa833edd118752e97f15f7d8e2a Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Wed, 29 Feb 2012 17:34:17 +0400 Subject: doxygen: MathCommand is not about string operators --- Source/cmMathCommand.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index d31f34b..d45e4fc 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -14,10 +14,7 @@ #include "cmCommand.h" -/** \class cmMathCommand - * \brief Common string operations - * - */ +/// Mathematical expressions: math(EXPR ...) command. class cmMathCommand : public cmCommand { public: -- cgit v0.12 From 2557a080543a37f92e1908420842db8c90685304 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 29 Feb 2012 22:28:06 -0500 Subject: Fix typo in error message, and remove redundent test. --- Source/cmProjectCommand.cxx | 2 +- Tests/CMakeOnly/CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 4c1abcf..fcf0a49 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -88,7 +88,7 @@ bool cmProjectCommand if(!readit && !cmSystemTools::GetFatalErrorOccured()) { std::string m = - "could not find load file:\n" + "could not find file:\n" " "; m += include; this->SetError(m.c_str()); diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 629f578..a1551ca 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -23,8 +23,6 @@ add_CMakeOnly_test(AllFindModules) add_CMakeOnly_test(TargetScope) -add_CMakeOnly_test(ProjectInclude) - add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectInclude -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake -- cgit v0.12 From 3d8028841d6a257d0bd33b71518ae8800a716ffb Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 1 Mar 2012 00:01:09 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 620d90a..b184bf8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 02) +SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 29) +SET(KWSYS_DATE_STAMP_DAY 01) -- cgit v0.12 From 5cd879c4e75405ab404a2e6c4e77caa36877baf1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Feb 2012 14:29:16 -0500 Subject: bootstrap: Convert MSYS paths to Windows format (#13001) We set CMAKE_PREFIX_PATH from the --prefix= option. The calling shell might not translate "/c/..." to "c:/..." paths but we need to store Windows paths in CMake cache variables. Pass the specified path through the MSYS shell in a form it will convert to a Windows path using the MSYS fstab. Some MSYS bash implementations leave trailing space on the command line to 'cmd /c echo ...' after quoting the message. The Windows echo tool preserves both the quotes and the trailing space. Use a sed expression that strips quotes and trailing spaces after the end quote. --- bootstrap | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bootstrap b/bootstrap index f5eacbd..665c6c5 100755 --- a/bootstrap +++ b/bootstrap @@ -127,10 +127,20 @@ fi cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}" # Helper function to fix windows paths. -cmake_fix_slashes () -{ - echo "$1" | sed 's/\\/\//g' -} +case "${cmake_system}" in +*MINGW*) + cmake_fix_slashes() + { + cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//' + } + ;; +*) + cmake_fix_slashes() + { + echo "$1" | sed 's/\\/\//g' + } + ;; +esac # Choose the default install prefix. if ${cmake_system_mingw}; then -- cgit v0.12 From 9271d2f6975c2f4cca81d4306c49e96089e88910 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 24 Feb 2012 20:35:42 +0100 Subject: AllFindModules test: once again expand version checking --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 42 +++++++++++++++------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 9257fcc..e6e4c74 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -45,25 +45,31 @@ if (NOT QT4_FOUND) endforeach(FIND_MODULE) endif (NOT QT4_FOUND) -# If any of these modules reported that it was found a version number should have been -# reported. -set(VERSIONS_REQUIRED - ALSA BISON BZIP2 CUPS CURL DOXYGEN EXPAT FLEX FREETYPE GETTEXT GIF GIT - ImageMagick JASPER LibArchive LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL - SWIG TIFF ZLIB) - -foreach(VTEST ${VERSIONS_REQUIRED}) - if (${VTEST}_FOUND) - if (DEFINED ${VTEST}_VERSION_STRING) - if (NOT ${VTEST}_VERSION_STRING MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$") - message(SEND_ERROR "${VTEST}_VERSION_STRING has unexpected content ${${VTEST}_VERSION_STRING}") - endif() - elseif (DEFINED ${VTEST}_VERSION) - if (NOT ${VTEST}_VERSION MATCHES "^[0-9][0-9\\.]*[A-Za-z_]*[0-9\\.]*$") - message(SEND_ERROR "${VTEST}_VERSION has unexpected content ${${VTEST}_VERSION}") +macro(check_version_string MODULE_NAME VERSION_VAR) + if (${MODULE_NAME}_FOUND) + if (DEFINED ${VERSION_VAR}) + if (NOT ${VERSION_VAR} MATCHES "^[0-9][0-9\\.]*[-A-Za-z_\\+]*[0-9\\.]*$") + message(SEND_ERROR "${VERSION_VAR} has unexpected content ${${VERSION_VAR}}") endif() else() - message(SEND_ERROR "${VTEST}_FOUND is set but no version number is defined") + message(SEND_ERROR "${MODULE_NAME}_FOUND is set but no version number is defined") endif() - endif(${VTEST}_FOUND) + endif () +endmacro(check_version_string) + +# If any of these modules reported that it was found a version number should have been +# reported. + +foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HSPELL + JASPER LIBXML2 LIBXSLT PERL PostgreSQL TCLSH TIFF ZLIB) + check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach(VTEST) + +foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 LibArchive OPENSCENEGRAPH + RUBY SWIG) + check_version_string(${VTEST} ${VTEST}_VERSION) +endforeach(VTEST) + +check_version_string(PYTHONINTERP PYTHON_VERSION_STRING) +check_version_string(SUBVERSION Subversion_VERSION_SVN) +check_version_string(PKGCONFIG PKG_CONFIG_VERSION_STRING) -- cgit v0.12 From f605b92dec414311936ff62afb0ab7847f08974e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 1 Mar 2012 19:32:38 +0100 Subject: improve error message on a stray "endwhile()" --- Source/cmEndWhileCommand.cxx | 17 +++++++++++++---- Source/cmEndWhileCommand.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index bb4d40a..abb9e5e 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -12,12 +12,21 @@ #include "cmEndWhileCommand.h" bool cmEndWhileCommand -::InvokeInitialPass(std::vector const&, +::InvokeInitialPass(std::vector const& args, cmExecutionStatus &) { - this->SetError("An ENDWHILE command was found outside of a proper " - "WHILE ENDWHILE structure. Or its arguments did not " - "match the opening WHILE command."); + if (args.empty()) + { + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure."); + } + else + { + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure. Or its arguments did not " + "match the opening WHILE command."); + } + return false; } diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 8e0b488..61ac7e4 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -34,7 +34,7 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&, + virtual bool InvokeInitialPass(std::vector const& args, cmExecutionStatus &status); /** -- cgit v0.12 From 944b90be60ab7888a76d76acbb0200f511db3d60 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 1 Mar 2012 21:12:55 +0100 Subject: add testcases for while()/endwhile() errors --- Tests/CMakeTests/CMakeLists.txt | 1 + Tests/CMakeTests/While-Endwhile-Alone-Args.cmake | 1 + Tests/CMakeTests/While-Endwhile-Alone.cmake | 1 + Tests/CMakeTests/While-Endwhile-Mismatch.cmake | 2 + Tests/CMakeTests/While-Missing-Argument.cmake | 1 + Tests/CMakeTests/While-Missing-Endwhile.cmake | 1 + Tests/CMakeTests/WhileTest.cmake.in | 53 ++++++++++++++++++++++++ 7 files changed, 60 insertions(+) create mode 100644 Tests/CMakeTests/While-Endwhile-Alone-Args.cmake create mode 100644 Tests/CMakeTests/While-Endwhile-Alone.cmake create mode 100644 Tests/CMakeTests/While-Endwhile-Mismatch.cmake create mode 100644 Tests/CMakeTests/While-Missing-Argument.cmake create mode 100644 Tests/CMakeTests/While-Missing-Endwhile.cmake create mode 100644 Tests/CMakeTests/WhileTest.cmake.in diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index fc1426e..aa4d52e 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -29,6 +29,7 @@ AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CompilerIdVendor "") AddCMakeTest(ProcessorCount "") AddCMakeTest(PushCheckState "") +AddCMakeTest(While "") AddCMakeTest(FileDownload "") set_property(TEST CMake.FileDownload PROPERTY diff --git a/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake b/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake new file mode 100644 index 0000000..886d98c --- /dev/null +++ b/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake @@ -0,0 +1 @@ +endwhile(a) diff --git a/Tests/CMakeTests/While-Endwhile-Alone.cmake b/Tests/CMakeTests/While-Endwhile-Alone.cmake new file mode 100644 index 0000000..82c09a0 --- /dev/null +++ b/Tests/CMakeTests/While-Endwhile-Alone.cmake @@ -0,0 +1 @@ +endwhile() diff --git a/Tests/CMakeTests/While-Endwhile-Mismatch.cmake b/Tests/CMakeTests/While-Endwhile-Mismatch.cmake new file mode 100644 index 0000000..5c338d6 --- /dev/null +++ b/Tests/CMakeTests/While-Endwhile-Mismatch.cmake @@ -0,0 +1,2 @@ +while(a) +endwhile(b) diff --git a/Tests/CMakeTests/While-Missing-Argument.cmake b/Tests/CMakeTests/While-Missing-Argument.cmake new file mode 100644 index 0000000..32eaa26 --- /dev/null +++ b/Tests/CMakeTests/While-Missing-Argument.cmake @@ -0,0 +1 @@ +while() diff --git a/Tests/CMakeTests/While-Missing-Endwhile.cmake b/Tests/CMakeTests/While-Missing-Endwhile.cmake new file mode 100644 index 0000000..1abaaaf --- /dev/null +++ b/Tests/CMakeTests/While-Missing-Endwhile.cmake @@ -0,0 +1 @@ +while(a) diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in new file mode 100644 index 0000000..4693f2d --- /dev/null +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -0,0 +1,53 @@ +set(NUMBERS "") +set(COUNT 0) + +while(COUNT LESS 200) + set(NUMBERS "${NUMBERS} ${COUNT}") + set(COUNT "2${COUNT}") + + set(NCOUNT 3) + while(NCOUNT LESS 31) + set(NUMBERS "${NUMBERS} ${NCOUNT}") + set(NCOUNT "${NCOUNT}0") + endwhile() +endwhile(COUNT LESS 200) + +if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30") + message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") +endif() + +set(Missing-Argument-RESULT 1) +set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Argument.cmake:1 \\(while\\):.*while called with incorrect number of arguments.*") + +include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") +check_cmake_test(While + Missing-Argument +) + +set(Missing-Endwhile-RESULT 1) +set(Missing-Endwhile-STDERR ".*CMake Error in (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Endwhile.cmake:.*A logical block opening on the line.*(@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Endwhile.cmake:1 \\(while\\).*is not closed\\..*") + +check_cmake_test(While + Missing-Endwhile +) + +set(Endwhile-Mismatch-RESULT 0) +set(Endwhile-Mismatch-STDERR ".*CMake Warning \\(dev\\) in (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Mismatch.cmake:.*A logical block opening on the line.*(@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Mismatch.cmake:1 \\(while\\).*with mis-matching arguments\\..*") + +check_cmake_test(While + Endwhile-Mismatch +) + +set(Endwhile-Alone-RESULT 1) +set(Endwhile-Alone-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Alone.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\.\n.*$") + +check_cmake_test(While + Endwhile-Alone +) + +set(Endwhile-Alone-Args-RESULT 1) +set(Endwhile-Alone-Args-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Alone-Args.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\. Or its arguments did not.*$") + +check_cmake_test(While + Endwhile-Alone-Args +) -- cgit v0.12 From 65dfe9e5bebae6dd7b9d1d43f0d3075ee55de198 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 2 Mar 2012 00:01:08 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index b184bf8..4c91b5c 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 01) +SET(KWSYS_DATE_STAMP_DAY 02) -- cgit v0.12 From 0916cc888a086293f4c17e9c927f2267e1fdb755 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Mar 2012 08:07:47 -0500 Subject: CTest.UpdateHG: Fix repo URL for local filesystem (#13001) Use "file:///c:/" instead of "file://c:/" because the latter looks like a machine:port URL instead of a local file URL. --- Tests/CTestUpdateHG.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index 543ddd9..5a9daae 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -28,7 +28,7 @@ run_child( WORKING_DIRECTORY ${TOP}/repo.hg COMMAND ${HG} init ) -set(REPO file://${TOP}/repo.hg) +set(REPO file:///${TOP}/repo.hg) #----------------------------------------------------------------------------- # Import initial content into the repository. -- cgit v0.12 From 2d59c9ab17c4af84ddb09ef7da89a37871d381a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Mar 2012 10:14:00 -0500 Subject: cmcurl: Do not hard-coded Windows check results for MinGW (#13001) The WindowsCache.cmake file hard-codes results for MS and similar Windows toolchains. They are not valid for MinGW tools and also interfere with cmlibarchive checks. Allow the checks to run. --- Utilities/cmcurl/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 29ce25d6..caa44f1 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -126,9 +126,9 @@ IF(CURL_MALLOC_DEBUG) ENDIF(CURL_MALLOC_DEBUG) # On windows preload settings -IF(WIN32) +IF(WIN32 AND NOT MINGW) INCLUDE(${LIBCURL_SOURCE_DIR}/Platforms/WindowsCache.cmake) -ENDIF(WIN32) +ENDIF() # This macro checks if the symbol exists in the library and if it # does, it appends library to the list. -- cgit v0.12 From 9012be20c526445e0d2e2ca6878308bb88dba9cf Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Mar 2012 10:24:43 -0500 Subject: CheckSourceTree: Remove CVS checkout support (#13001) We no longer support CVS checkouts from the Git repository. Drop the case from the CheckSourceTree test. This will also prevent the test from running and failing when CVS is found but Git is not. --- Tests/CMakeTests/CMakeLists.txt | 5 +- Tests/CMakeTests/CheckSourceTreeTest.cmake.in | 87 ++------------------------- 2 files changed, 7 insertions(+), 85 deletions(-) diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index fc1426e..e473c42 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -55,14 +55,13 @@ AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") # suite. It detects if any changes have been made to the CMake source tree # by any previous configure, build or test steps. # -if(do_cvs_tests OR GIT_EXECUTABLE) +if(GIT_EXECUTABLE) string(REPLACE "\\" "/" ENV_HOME "$ENV{HOME}") set(CheckSourceTree_PreArgs "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}" "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" - "-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}" "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}" "-DHOME:STRING=${ENV_HOME}" ) AddCMakeTest(CheckSourceTree "${CheckSourceTree_PreArgs}") -endif(do_cvs_tests OR GIT_EXECUTABLE) +endif() diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in index 73f8b01..59b2890 100644 --- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in +++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in @@ -5,7 +5,6 @@ message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") message("") message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'") message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'") -message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'") message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'") message("HOME='${HOME}'") message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'") @@ -43,7 +42,7 @@ message("in_source_build='${in_source_build}'") message("") -# If this does not appear to be a git or CVS checkout, just pass the test here +# If this does not appear to be a git checkout, just pass the test here # and now. (Do not let the test fail if it is run in a tree *exported* from a # repository or unpacked from a .zip file source installer...) # @@ -52,29 +51,13 @@ if(EXISTS "${CMake_SOURCE_DIR}/.git") set(is_git_checkout 1) endif() -set(is_cvs_checkout 0) -if(EXISTS "${CMake_SOURCE_DIR}/CVS/Root") - set(is_cvs_checkout 1) -endif() - message("is_git_checkout='${is_git_checkout}'") -message("is_cvs_checkout='${is_cvs_checkout}'") message("") -if(NOT is_cvs_checkout) if(NOT is_git_checkout) - message("source tree is neither git nor CVS checkout... test passes by early return...") + message("source tree is not a git checkout... test passes by early return...") return() endif() -endif() - -if(is_cvs_checkout) -if(is_git_checkout) - message("warning: source tree has both git *and* CVS file system bits???") - # should this condition be a FATAL_ERROR test failure...? -endif() -endif() - # This test looks for the following types of changes in the source tree: # @@ -83,51 +66,13 @@ set(conflicts 0) set(modifications 0) set(nonadditions 0) -# ov == output variable... conditionally filled in by either cvs or git below: +# ov == output variable... conditionally filled in by either git below: # set(cmd "") set(ov "") set(ev "") set(rv "") - -if(is_cvs_checkout AND CVS_EXECUTABLE) - # Check with "cvs -q -n up -dP" if there are any local modifications to the - # CMake source tree: - # - message("=============================================================================") - message("This is a cvs checkout, using cvs to verify source tree....") - message("") - - execute_process(COMMAND ${CVS_EXECUTABLE} --version - WORKING_DIRECTORY ${CMake_SOURCE_DIR} - OUTPUT_VARIABLE version_output - OUTPUT_STRIP_TRAILING_WHITESPACE) - message("=== output of 'cvs --version' ===") - message("${version_output}") - message("=== end output ===") - message("") - - file(READ "${CMake_SOURCE_DIR}/CVS/Root" contents) - message("=== content of CVS/Root ===") - message("${contents}") - message("=== end content ===") - message("") - - file(READ "${CMake_SOURCE_DIR}/CVS/Repository" contents) - message("=== content of CVS/Repository ===") - message("${contents}") - message("=== end content ===") - message("") - - message("Copy/paste this command to reproduce:") - message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP") - message("") - - set(cmd ${CVS_EXECUTABLE} -q -n up -dP) -endif() - - # If no GIT_EXECUTABLE, see if we can figure out which git was used # for the ctest_update step on this dashboard... # @@ -268,8 +213,8 @@ endif() if(cmd) - # Use the HOME value passed in to the script for calling cvs/git so it can - # find its .cvspass or user/global config settings... + # Use the HOME value passed in to the script for calling git so it can + # find its user/global config settings... # set(original_ENV_HOME "$ENV{HOME}") set(ENV{HOME} "${HOME}") @@ -322,28 +267,6 @@ if(NOT ov STREQUAL "") endif() if(consider) - if(is_cvs_checkout) - if(line MATCHES "^A ") - message(" locally added file/directory detected...") - set(additions 1) - endif() - - if(line MATCHES "^C ") - message(" conflict detected...") - set(conflicts 1) - endif() - - if(line MATCHES "^M ") - message(" locally modified file detected...") - set(modifications 1) - endif() - - if(line MATCHES "^\\? ") - message(" locally non-added file/directory detected...") - set(nonadditions 1) - endif() - endif() - if(is_git_checkout) if(line MATCHES "^#[ \t]*modified:") message(" locally modified file detected...") -- cgit v0.12 From 2cd898d54b7068d78d719ad23131707b300624a7 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 2 Mar 2012 16:55:17 +0100 Subject: FindQt3: fix warning when Qt3 is not found -- Could NOT find Qt3 (missing: QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE) CreateProcess failed QT_MOC_EXECUTABLE-NOTFOUND -v CreateProcess failed QT_UIC_EXECUTABLE-NOTFOUND -version --- Modules/FindQt3.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 86236cc..69d2f65 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -296,8 +296,16 @@ IF(QT_FOUND) ENDIF(QT_QT_LIBRARY MATCHES "qt-mt") ENDIF(QT_FOUND) -EXEC_PROGRAM(${QT_MOC_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE QTVERSION_MOC) -EXEC_PROGRAM(${QT_UIC_EXECUTABLE} ARGS "-version" OUTPUT_VARIABLE QTVERSION_UIC) +IF(QT_MOC_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${QT_MOC_EXECUTABLE} "-v" + OUTPUT_VARIABLE QTVERSION_MOC + ERROR_QUIET) +ENDIF(QT_MOC_EXECUTABLE) +IF(QT_UIC_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${QT_UIC_EXECUTABLE} "-version" + OUTPUT_VARIABLE QTVERSION_UIC + ERROR_QUIET) +ENDIF(QT_UIC_EXECUTABLE) SET(_QT_UIC_VERSION_3 FALSE) IF("${QTVERSION_UIC}" MATCHES ".* 3..*") -- cgit v0.12 From 9dae4d65d7e1ae0348478c6c2f4d2f0f307bf573 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 2 Mar 2012 18:06:57 +0100 Subject: FindQt3: fix version extraction for versions with letters --- Modules/FindQt3.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 69d2f65..5ee2d06 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -71,8 +71,8 @@ ENDIF(NOT EXISTS ${QT_INCLUDE_DIR}/qglobal.h) IF(QT_INCLUDE_DIR) #extract the version string from qglobal.h FILE(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H) - STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" QGLOBAL_H "${QGLOBAL_H}") - STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" qt_version_str "${QGLOBAL_H}") + STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"[0-9]+.[0-9]+.[0-9]+[a-z]*\"" QGLOBAL_H "${QGLOBAL_H}") + STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+[a-z]*)\".*" "\\1" qt_version_str "${QGLOBAL_H}") # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the # version X.Y.Z, so we need to remove the dots from version -- cgit v0.12 From 91a1670f47c0836c93d7bf355591bf84ecb3f99f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 2 Mar 2012 16:56:41 +0100 Subject: FindQt3: let FPHSA handle the version selection --- Modules/FindQt3.cmake | 68 +++++++++++---------------------------------------- 1 file changed, 14 insertions(+), 54 deletions(-) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 5ee2d06..89276ef 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -1,10 +1,11 @@ # - Locate Qt include paths and libraries # This module defines: -# QT_INCLUDE_DIR - where to find qt.h, etc. -# QT_LIBRARIES - the libraries to link against to use Qt. -# QT_DEFINITIONS - definitions to use when -# compiling code that uses Qt. -# QT_FOUND - If false, don't try to use Qt. +# QT_INCLUDE_DIR - where to find qt.h, etc. +# QT_LIBRARIES - the libraries to link against to use Qt. +# QT_DEFINITIONS - definitions to use when +# compiling code that uses Qt. +# QT_FOUND - If false, don't try to use Qt. +# QT_VERSION_STRING - the version of Qt found # # If you need the multithreaded version of Qt, set QT_MT_REQUIRED to TRUE # @@ -77,6 +78,7 @@ IF(QT_INCLUDE_DIR) # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the # version X.Y.Z, so we need to remove the dots from version STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}") + SET(QT_VERSION_STRING "${qt_version_str}") ENDIF(QT_INCLUDE_DIR) FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/) @@ -195,58 +197,16 @@ IF (WIN32) ) ENDIF (WIN32) - -IF (QT_MIN_VERSION) - - STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" qt_major_vers "${qt_version_str}") - STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" qt_minor_vers "${qt_version_str}") - STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" qt_patch_vers "${qt_version_str}") - - #now parse the parts of the user given version string into variables - STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" req_qt_major_vers "${QT_MIN_VERSION}") - IF (NOT req_qt_major_vers) - error_message( "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"3.1.5\"") - ENDIF (NOT req_qt_major_vers) - - STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}") - STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}") - STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}") - - # req = "6.5.4", qt = "3.2.1" - MACRO(error_message msg) - IF(QT3_REQUIRED) - MESSAGE( FATAL_ERROR ${msg}) - ELSE(QT3_REQUIRED) - MESSAGE( STATUS ${msg}) - ENDIF(QT3_REQUIRED) - ENDMACRO(error_message) - - IF (req_qt_major_vers GREATER qt_major_vers) # (6 > 3) ? - ERROR_MESSAGE( "Qt major version not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes - ELSE (req_qt_major_vers GREATER qt_major_vers) # no - IF (req_qt_major_vers LESS qt_major_vers) # (6 < 3) ? - SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes - ELSE (req_qt_major_vers LESS qt_major_vers) # ( 6==3) ? - IF (req_qt_minor_vers GREATER qt_minor_vers) # (5>2) ? - ERROR_MESSAGE( "Qt minor version not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes - ELSE (req_qt_minor_vers GREATER qt_minor_vers) # no - IF (req_qt_minor_vers LESS qt_minor_vers) # (5<2) ? - SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes - ELSE (req_qt_minor_vers LESS qt_minor_vers) # (5==2) - IF (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? - ERROR_MESSAGE( "Qt patch level not matched (required: ${QT_MIN_VERSION}, found: ${qt_version_str})") # yes - ELSE (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? - SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes - ENDIF (req_qt_patch_vers GREATER qt_patch_vers) # (4>1) ? - ENDIF (req_qt_minor_vers LESS qt_minor_vers) - ENDIF (req_qt_minor_vers GREATER qt_minor_vers) - ENDIF (req_qt_major_vers LESS qt_major_vers) - ENDIF (req_qt_major_vers GREATER qt_major_vers) -ENDIF (QT_MIN_VERSION) +#support old QT_MIN_VERSION if set, but not if version is supplied by find_package() +IF(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION) + SET(Qt3_FIND_VERSION ${QT_MIN_VERSION}) +ENDIF(NOT Qt3_FIND_VERSION AND QT_MIN_VERSION) # if the include a library are found then we have it INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3 DEFAULT_MSG QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3 + REQUIRED_VARS QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE + VERSION_VAR QT_VERSION_STRING) SET(QT_FOUND ${QT3_FOUND} ) IF(QT_FOUND) -- cgit v0.12 From 678c24d230d7abcdb2ace778d59b8c1286d86a8a Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 2 Mar 2012 17:31:34 +0100 Subject: FindQt3: fix detection of Qt3 include directory The include directory is likely not inside ../bin --- Modules/FindQt3.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 89276ef..2d8dbde 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -47,13 +47,16 @@ IF(QT4_FOUND) ENDIF(QT4_FOUND) -FILE(GLOB GLOB_PATHS_BIN /usr/lib/qt-3*/bin/) +FILE(GLOB GLOB_PATHS /usr/lib/qt-3*) +FOREACH(GLOB_PATH ${GLOB_PATHS}) + LIST(APPEND GLOB_PATHS_BIN "${GLOB_PATH}/bin") +ENDFOREACH(GLOB_PATH) FIND_PATH(QT_INCLUDE_DIR qt.h "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt" $ENV{QTDIR}/include - ${GLOB_PATHS_BIN} + ${GLOB_PATHS} /usr/local/qt/include /usr/lib/qt/include /usr/lib/qt3/include -- cgit v0.12 From e3336025672383c6345989af9539943a74850614 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Mar 2012 14:20:58 -0500 Subject: Fix MSYS CVS local test repo path format (#13001) The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH. Detect the MSYS cvs by looking for the string "msys" in the executable file itself. Then convert the repo path to an MSYS path such as "/c/...". Fix both the CTest.UpdateCVS and ExternalProject tests that use local CVS repositories. --- Tests/CTestUpdateCVS.cmake.in | 13 +++++++++++++ Tests/ExternalProject/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index a04673e..f7f5db6 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -18,6 +18,19 @@ set(CVS "@CVS_EXECUTABLE@") message(" cvs = ${CVS}") set(REPO ${TOP}/repo) + +# The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH. +# Detect the MSYS cvs and convert the repo path to an MSYS path. +if(WIN32) + if(EXISTS "${CVS}") + file(STRINGS "${CVS}" cvs_is_msys LIMIT_COUNT 1 REGEX "[Mm][Ss][Yy][Ss]") + if(cvs_is_msys) + message(" '${CVS}' is from MSYS (contains '${cvs_is_msys}')") + string(REGEX REPLACE "^([A-Za-z]):" "/\\1" REPO "${REPO}") + endif() + endif() +endif() + set(CVSCMD ${CVS} -d${REPO}) # CVSNT requires an extra option to 'cvs init'. diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index ac70129..7a76261 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -280,6 +280,18 @@ if(do_cvs_tests) set_property(TARGET ${proj} PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing") + # The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH. + # Detect the MSYS cvs and convert the repo path to an MSYS path. + if(WIN32) + if(EXISTS "${CVS_EXECUTABLE}") + file(STRINGS "${CVS_EXECUTABLE}" cvs_is_msys LIMIT_COUNT 1 REGEX "[Mm][Ss][Yy][Ss]") + if(cvs_is_msys) + message(STATUS "'${CVS_EXECUTABLE}' is from MSYS (contains '${cvs_is_msys}')") + string(REGEX REPLACE "^([A-Za-z]):" "/\\1" local_cvs_repo "${local_cvs_repo}") + endif() + endif() + endif() + # CVS by date stamp: # set(proj TutorialStep1-CVS-20090626) -- cgit v0.12 From 234b7cad1ce7239bc57560309a913576a6b07a5a Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 2 Mar 2012 20:32:54 +0100 Subject: AllFindModules test: do not require TCLSH version --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index e6e4c74..22b1b7b 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -61,7 +61,7 @@ endmacro(check_version_string) # reported. foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HSPELL - JASPER LIBXML2 LIBXSLT PERL PostgreSQL TCLSH TIFF ZLIB) + JASPER LIBXML2 LIBXSLT PERL PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach(VTEST) -- cgit v0.12 From ac2979e4b36577e10b2180624050e600179a53da Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 3 Mar 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 4c91b5c..e424fec 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 02) +SET(KWSYS_DATE_STAMP_DAY 03) -- cgit v0.12 From e26657103fa95b2a898e438ec6eb982a3c0bf3cc Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Wed, 29 Feb 2012 17:44:02 +0400 Subject: Remove UnionsAvailable member from 2 classes These classes were copied from cmDependsJavaParserHelper that really needs this member. --- Source/cmCommandArgumentParserHelper.h | 1 - Source/cmExprParserHelper.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index a211e95..cdb832b 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -81,7 +81,6 @@ private: cmStdString InputBuffer; std::vector OutputBuffer; int CurrentLine; - int UnionsAvailable; int Verbose; void Print(const char* place, const char* str); diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 0c36b44..f3fd4f6 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -55,7 +55,6 @@ private: cmStdString InputBuffer; std::vector OutputBuffer; int CurrentLine; - int UnionsAvailable; int Verbose; void Print(const char* place, const char* str); -- cgit v0.12 From aef248a4ff675aeb4af6aa44322bed76f4bcf990 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Wed, 29 Feb 2012 21:56:13 +0400 Subject: Remove cmExprParserHelper::SetLineFile() --- Source/cmExprParserHelper.cxx | 6 ------ Source/cmExprParserHelper.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index ee37352..7728d74 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -30,12 +30,6 @@ cmExprParserHelper::~cmExprParserHelper() this->CleanupParser(); } -void cmExprParserHelper::SetLineFile(long line, const char* file) -{ - this->FileLine = line; - this->FileName = file; -} - int cmExprParserHelper::ParseString(const char* str, int verb) { if ( !str) diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index f3fd4f6..690426d 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -46,8 +46,6 @@ public: int GetResult() { return this->Result; } - void SetLineFile(long line, const char* file); - const char* GetError() { return this->ErrorString.c_str(); } private: -- cgit v0.12 From 76bff6029222449e0194b9348ac146ab8adfe4e9 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 4 Mar 2012 00:01:11 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index e424fec..92b9f64 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 03) +SET(KWSYS_DATE_STAMP_DAY 04) -- cgit v0.12 From b43cd1252c9e7d5dfe7ed9ef9bbd4671b38a535d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 4 Mar 2012 13:43:23 +0100 Subject: add test for get_property() errors --- Tests/CMakeTests/CMakeLists.txt | 1 + Tests/CMakeTests/GetProperty-Bad-Argument.cmake | 1 + Tests/CMakeTests/GetProperty-Bad-Directory.cmake | 1 + Tests/CMakeTests/GetProperty-Bad-Scope.cmake | 1 + Tests/CMakeTests/GetProperty-Bad-Target.cmake | 1 + Tests/CMakeTests/GetProperty-Bad-Test.cmake | 1 + Tests/CMakeTests/GetProperty-Doc-Properties.cmake | 10 +++ Tests/CMakeTests/GetProperty-Global-Name.cmake | 1 + .../CMakeTests/GetProperty-Missing-Argument.cmake | 1 + Tests/CMakeTests/GetProperty-No-Cache.cmake | 1 + Tests/CMakeTests/GetProperty-No-Property.cmake | 1 + Tests/CMakeTests/GetProperty-No-Source.cmake | 1 + Tests/CMakeTests/GetProperty-No-Target.cmake | 1 + Tests/CMakeTests/GetProperty-No-Test.cmake | 1 + Tests/CMakeTests/GetProperty-Variable-Name.cmake | 1 + Tests/CMakeTests/GetPropertyTest.cmake.in | 98 ++++++++++++++++++++++ 16 files changed, 122 insertions(+) create mode 100644 Tests/CMakeTests/GetProperty-Bad-Argument.cmake create mode 100644 Tests/CMakeTests/GetProperty-Bad-Directory.cmake create mode 100644 Tests/CMakeTests/GetProperty-Bad-Scope.cmake create mode 100644 Tests/CMakeTests/GetProperty-Bad-Target.cmake create mode 100644 Tests/CMakeTests/GetProperty-Bad-Test.cmake create mode 100644 Tests/CMakeTests/GetProperty-Doc-Properties.cmake create mode 100644 Tests/CMakeTests/GetProperty-Global-Name.cmake create mode 100644 Tests/CMakeTests/GetProperty-Missing-Argument.cmake create mode 100644 Tests/CMakeTests/GetProperty-No-Cache.cmake create mode 100644 Tests/CMakeTests/GetProperty-No-Property.cmake create mode 100644 Tests/CMakeTests/GetProperty-No-Source.cmake create mode 100644 Tests/CMakeTests/GetProperty-No-Target.cmake create mode 100644 Tests/CMakeTests/GetProperty-No-Test.cmake create mode 100644 Tests/CMakeTests/GetProperty-Variable-Name.cmake create mode 100644 Tests/CMakeTests/GetPropertyTest.cmake.in diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index aa4d52e..7450dc5 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -22,6 +22,7 @@ AddCMakeTest(ConfigureFile "") AddCMakeTest(SeparateArguments "") AddCMakeTest(ImplicitLinkInfo "") AddCMakeTest(ModuleNotices "") +AddCMakeTest(GetProperty "") AddCMakeTest(If "") AddCMakeTest(String "") AddCMakeTest(Math "") diff --git a/Tests/CMakeTests/GetProperty-Bad-Argument.cmake b/Tests/CMakeTests/GetProperty-Bad-Argument.cmake new file mode 100644 index 0000000..382dabb --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Bad-Argument.cmake @@ -0,0 +1 @@ +get_property(FOO GLOBAL PROPERTY FOO FOO) diff --git a/Tests/CMakeTests/GetProperty-Bad-Directory.cmake b/Tests/CMakeTests/GetProperty-Bad-Directory.cmake new file mode 100644 index 0000000..cdbfa80 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Bad-Directory.cmake @@ -0,0 +1 @@ +get_property(FOO DIRECTORY NonExistentSubDir PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-Bad-Scope.cmake b/Tests/CMakeTests/GetProperty-Bad-Scope.cmake new file mode 100644 index 0000000..ea8566b --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Bad-Scope.cmake @@ -0,0 +1 @@ +get_property(FOO FOO FOO) diff --git a/Tests/CMakeTests/GetProperty-Bad-Target.cmake b/Tests/CMakeTests/GetProperty-Bad-Target.cmake new file mode 100644 index 0000000..9992dab --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Bad-Target.cmake @@ -0,0 +1 @@ +get_property(FOO TARGET FOO PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-Bad-Test.cmake b/Tests/CMakeTests/GetProperty-Bad-Test.cmake new file mode 100644 index 0000000..44bf3eb --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Bad-Test.cmake @@ -0,0 +1 @@ +get_property(FOO TEST FOO PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-Doc-Properties.cmake b/Tests/CMakeTests/GetProperty-Doc-Properties.cmake new file mode 100644 index 0000000..6c2c362 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Doc-Properties.cmake @@ -0,0 +1,10 @@ +get_property(FOO_BRIEF GLOBAL PROPERTY FOO BRIEF_DOCS) +get_property(FOO_FULL GLOBAL PROPERTY FOO FULL_DOCS) + +if (NOT FOO_BRIEF STREQUAL "NOTFOUND") + message(SEND_ERROR "property FOO has BRIEF_DOCS set to '${FOO_BRIEF}'") +endif () + +if (NOT FOO_FULL STREQUAL "NOTFOUND") + message(SEND_ERROR "property FOO has FULL_DOCS set to '${FOO_FULL}'") +endif () diff --git a/Tests/CMakeTests/GetProperty-Global-Name.cmake b/Tests/CMakeTests/GetProperty-Global-Name.cmake new file mode 100644 index 0000000..497700c --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Global-Name.cmake @@ -0,0 +1 @@ +get_property(FOO GLOBAL FOO PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-Missing-Argument.cmake b/Tests/CMakeTests/GetProperty-Missing-Argument.cmake new file mode 100644 index 0000000..f0d004d --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Missing-Argument.cmake @@ -0,0 +1 @@ +get_property() diff --git a/Tests/CMakeTests/GetProperty-No-Cache.cmake b/Tests/CMakeTests/GetProperty-No-Cache.cmake new file mode 100644 index 0000000..9719fe7 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-No-Cache.cmake @@ -0,0 +1 @@ +get_property(FOO CACHE PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-No-Property.cmake b/Tests/CMakeTests/GetProperty-No-Property.cmake new file mode 100644 index 0000000..bee230d --- /dev/null +++ b/Tests/CMakeTests/GetProperty-No-Property.cmake @@ -0,0 +1 @@ +get_property(FOO GLOBAL PROPERTY) diff --git a/Tests/CMakeTests/GetProperty-No-Source.cmake b/Tests/CMakeTests/GetProperty-No-Source.cmake new file mode 100644 index 0000000..89773c8 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-No-Source.cmake @@ -0,0 +1 @@ +get_property(FOO SOURCE PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-No-Target.cmake b/Tests/CMakeTests/GetProperty-No-Target.cmake new file mode 100644 index 0000000..8f1fa23 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-No-Target.cmake @@ -0,0 +1 @@ +get_property(FOO TARGET PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-No-Test.cmake b/Tests/CMakeTests/GetProperty-No-Test.cmake new file mode 100644 index 0000000..045bd56 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-No-Test.cmake @@ -0,0 +1 @@ +get_property(FOO TEST PROPERTY FOO) diff --git a/Tests/CMakeTests/GetProperty-Variable-Name.cmake b/Tests/CMakeTests/GetProperty-Variable-Name.cmake new file mode 100644 index 0000000..9190f80 --- /dev/null +++ b/Tests/CMakeTests/GetProperty-Variable-Name.cmake @@ -0,0 +1 @@ +get_property(FOO VARIABLE FOO PROPERTY FOO) diff --git a/Tests/CMakeTests/GetPropertyTest.cmake.in b/Tests/CMakeTests/GetPropertyTest.cmake.in new file mode 100644 index 0000000..ab96e5b --- /dev/null +++ b/Tests/CMakeTests/GetPropertyTest.cmake.in @@ -0,0 +1,98 @@ +include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") + +set(Missing-Argument-RESULT 1) +set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Missing-Argument.cmake:1 \\(get_property\\):.*get_property called with incorrect number of arguments.*") + +check_cmake_test(GetProperty + Missing-Argument +) + +set(Bad-Scope-RESULT 1) +set(Bad-Scope-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Scope.cmake:1 \\(get_property\\):.*get_property given invalid scope FOO\\..*") + +check_cmake_test(GetProperty + Bad-Scope +) + +set(Bad-Argument-RESULT 1) +set(Bad-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Argument.cmake:1 \\(get_property\\):.*get_property given invalid argument \"FOO\"\\..*") + +check_cmake_test(GetProperty + Bad-Argument +) + +set(No-Property-RESULT 1) +set(No-Property-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Property.cmake:1 \\(get_property\\):.*get_property not given a PROPERTY argument\\..*") + +check_cmake_test(GetProperty + No-Property +) + +set(Doc-Properties-RESULT 0) + +check_cmake_test(GetProperty + Doc-Properties +) + +set(Global-Name-RESULT 1) +set(Global-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Global-Name.cmake:1 \\(get_property\\):.*get_property given name for GLOBAL scope\\..*") + +check_cmake_test(GetProperty + Global-Name +) + +set(Bad-Directory-RESULT 1) +set(Bad-Directory-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Directory.cmake:1 \\(get_property\\):.*get_property DIRECTORY scope provided but requested directory was not.*found\\..*") + +check_cmake_test(GetProperty + Bad-Directory +) + +set(No-Target-RESULT 1) +set(No-Target-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Target.cmake:1 \\(get_property\\):.*get_property not given name for TARGET scope\\..*") + +check_cmake_test(GetProperty + No-Target +) + +set(Bad-Target-RESULT 1) +set(Bad-Target-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Target.cmake:1 \\(get_property\\):.*get_property could not find TARGET FOO\\..*") + +check_cmake_test(GetProperty + Bad-Target +) + +set(No-Source-RESULT 1) +set(No-Source-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Source.cmake:1 \\(get_property\\):.*get_property not given name for SOURCE scope\\..*") + +check_cmake_test(GetProperty + No-Source +) + +set(No-Test-RESULT 1) +set(No-Test-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Test.cmake:1 \\(get_property\\):.*get_property not given name for TEST scope\\..*") + +check_cmake_test(GetProperty + No-Test +) + +set(Bad-Test-RESULT 1) +set(Bad-Test-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Bad-Test.cmake:1 \\(get_property\\):.*get_property given TEST name that does not exist: FOO.*") + +check_cmake_test(GetProperty + Bad-Test +) + +set(Variable-Name-RESULT 1) +set(Variable-Name-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-Variable-Name.cmake:1 \\(get_property\\):.*get_property given name for VARIABLE scope\\..*") + +check_cmake_test(GetProperty + Variable-Name +) + +set(No-Cache-RESULT 1) +set(No-Cache-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?GetProperty-No-Cache.cmake:1 \\(get_property\\):.*get_property not given name for CACHE scope\\..*") + +check_cmake_test(GetProperty + No-Cache +) -- cgit v0.12 From 17a099dd1379051eaa6c0a66a5ee6df5aea49089 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 5 Mar 2012 00:01:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 92b9f64..d4dcea9 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 04) +SET(KWSYS_DATE_STAMP_DAY 05) -- cgit v0.12 From 761c146a4c02c76adafb233606dfe50157857c87 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 5 Mar 2012 15:36:46 +0100 Subject: Add default initializers for WIN32_EXECUTABLE and MACOSX_BUNDLE This allows downstreams to use set(CMAKE_WIN32_EXECUTABLE ON) set(CMAKE_MACOSX_BUNDLE ON) to create executables with the WIN32_EXECUTABLE and MACOSX_BUNDLE properties set on by default. --- Source/cmDocumentVariables.cxx | 16 ++++++++++++++++ Source/cmTarget.cxx | 10 ++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index a31dd01..80f6b87 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1278,6 +1278,22 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "See that target property for additional information.", false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_WIN32_EXECUTABLE", cmProperty::VARIABLE, + "Default value for WIN32_EXECUTABLE of targets.", + "This variable is used to initialize the " + "WIN32_EXECUTABLE property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_MACOSX_BUNDLE", cmProperty::VARIABLE, + "Default value for MACOSX_BUNDLE of targets.", + "This variable is used to initialize the " + "MACOSX_BUNDLE property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); // Variables defined when the a language is enabled These variables will // also be defined whenever CMake has loaded its support for compiling (LANG) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index da99eb9..817375e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -861,7 +861,9 @@ void cmTarget::DefineProperties(cmake *cm) "of of just main()." "This makes it a GUI executable instead of a console application. " "See the CMAKE_MFC_FLAG variable documentation to configure use " - "of MFC for WinMain executables."); + "of MFC for WinMain executables. " + "This property is initialized by the value of the variable " + "CMAKE_WIN32_EXECUTABLE if it is set when a target is created."); cm->DefineProperty ("MACOSX_BUNDLE", cmProperty::TARGET, @@ -871,7 +873,9 @@ void cmTarget::DefineProperties(cmake *cm) "This makes it a GUI executable that can be launched from " "the Finder. " "See the MACOSX_BUNDLE_INFO_PLIST target property for information " - "about creation of the Info.plist file for the application bundle."); + "about creation of the Info.plist file for the application bundle. " + "This property is initialized by the value of the variable " + "CMAKE_MACOSX_BUNDLE if it is set when a target is created."); cm->DefineProperty ("MACOSX_BUNDLE_INFO_PLIST", cmProperty::TARGET, @@ -1224,6 +1228,8 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("AUTOMOC", 0); this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0); this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0); + this->SetPropertyDefault("WIN32_EXECUTABLE", 0); + this->SetPropertyDefault("MACOSX_BUNDLE", 0); // Collect the set of configuration types. std::vector configNames; -- cgit v0.12 From 635bf50c27aef184bfa1698953dd44361e1fb2f9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 20 Feb 2012 00:34:11 +0100 Subject: Add an option to skip RPATH during installation. --- Modules/CMakeGenericSystem.cmake | 3 +++ Source/cmComputeLinkInformation.cxx | 1 + Source/cmDocumentVariables.cxx | 18 +++++++++++++++++- Source/cmTarget.cxx | 6 ++++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 6cd8fe6..ee8040e 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -39,6 +39,8 @@ SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL "If set, runtime paths are not added when using shared libraries.") +SET (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL + "If set, runtime paths are not added when installing shared libraries, but are added when building.") SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") @@ -168,5 +170,6 @@ ENDIF(CMAKE_HOST_UNIX) MARK_AS_ADVANCED( CMAKE_SKIP_RPATH + CMAKE_SKIP_INSTALL_RPATH CMAKE_VERBOSE_MAKEFILE ) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index edf6c35..c57b85d 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1760,6 +1760,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, !linking_for_install); bool use_link_rpath = outputRuntime && linking_for_install && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") && this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 1cab2b5..fb15615 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -355,7 +355,9 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "If this is set to TRUE, then the rpath information " "is not added to compiled executables. The default " "is to add rpath information if the platform supports it. " - "This allows for easy running from the build tree.",false, + "This allows for easy running from the build tree. To omit RPATH" + "in the install step, but not the build step, use " + "CMAKE_SKIP_INSTALL_RPATH instead.",false, "Variables that Provide Information"); cm->DefineProperty ("CMAKE_SOURCE_DIR", cmProperty::VARIABLE, @@ -1181,6 +1183,20 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables that Control the Build"); cm->DefineProperty + ("CMAKE_SKIP_INSTALL_RPATH", cmProperty::VARIABLE, + "Do not include RPATHs in the install tree.", + "Normally CMake uses the build tree for the RPATH when building " + "executables etc on systems that use RPATH. When the software " + "is installed the executables etc are relinked by CMake to have " + "the install RPATH. If this variable is set to true then the software " + "is always installed without RPATH, even if RPATH is enabled when " + "building. This can be useful for example to allow running tests from " + "the build directory with RPATH enabled before the installation step. " + "To omit RPATH in both the build and install steps, use " + "CMAKE_SKIP_RPATH instead.",false, + "Variables that Control the Build"); + + cm->DefineProperty ("CMAKE_EXE_LINKER_FLAGS", cmProperty::VARIABLE, "Linker flags used to create executables.", "Flags used by the linker when creating an executable.",false, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ae5596b..b87c086 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3602,7 +3602,8 @@ bool cmTarget::HaveBuildTreeRPATH() bool cmTarget::HaveInstallTreeRPATH() { const char* install_rpath = this->GetProperty("INSTALL_RPATH"); - return install_rpath && *install_rpath; + return (install_rpath && *install_rpath) && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"); } //---------------------------------------------------------------------------- @@ -3709,7 +3710,8 @@ std::string cmTarget::GetInstallNameDirForInstallTree(const char* config, { std::string dir; - if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH")) + if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH") && + !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH")) { const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR"); if(install_name_dir && *install_name_dir) -- cgit v0.12 From ec50093be768c9fa9384cc42a4d1f331f0264b39 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 6 Mar 2012 00:01:07 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index d4dcea9..617f126 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 05) +SET(KWSYS_DATE_STAMP_DAY 06) -- cgit v0.12 From 1b996e736090c91e849c53ee8a40447aba57ec86 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 6 Mar 2012 08:59:57 -0500 Subject: Remove trailing white space --- Utilities/Release/Cygwin/cygwin-setup.hint.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Utilities/Release/Cygwin/cygwin-setup.hint.in b/Utilities/Release/Cygwin/cygwin-setup.hint.in index 9706c0d..ad99c5e 100644 --- a/Utilities/Release/Cygwin/cygwin-setup.hint.in +++ b/Utilities/Release/Cygwin/cygwin-setup.hint.in @@ -1,5 +1,5 @@ # CMake setup.hint file for cygwin setup.exe program -category: Devel +category: Devel requires: @CMAKE_NCURSES_VERSION@ cygwin -sdesc: "A cross platform build manager" -ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files." +sdesc: "A cross platform build manager" +ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files." -- cgit v0.12 From 208c3f84e2254b8f6158780c21d918f86537e3ea Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 6 Mar 2012 09:04:46 -0500 Subject: Use correct "requires" line in cygwin setup hint file Reference: email thread between Bill Hoffman and Yaakov Selkowitz from Mar. 5, 2012. --- Utilities/Release/Cygwin/cygwin-setup.hint.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Release/Cygwin/cygwin-setup.hint.in b/Utilities/Release/Cygwin/cygwin-setup.hint.in index ad99c5e..a2532fc 100644 --- a/Utilities/Release/Cygwin/cygwin-setup.hint.in +++ b/Utilities/Release/Cygwin/cygwin-setup.hint.in @@ -1,5 +1,5 @@ # CMake setup.hint file for cygwin setup.exe program category: Devel -requires: @CMAKE_NCURSES_VERSION@ cygwin +requires: libgcc1 libidn11 @CMAKE_NCURSES_VERSION@ libstdc++6 sdesc: "A cross platform build manager" ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files." -- cgit v0.12 From 4ae7f3656b6ebe7c878716b95ef5eb3d924d4173 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 27 Feb 2012 11:45:33 -0500 Subject: Remove unused partial OBJECT_FILES property implementation Remove partial implementation added by commit ca0230a3 (check in initial conv library stuff, 2007-02-16) since it was never finished. It does not make sense for multi-configuration generators since no specific build configuration is processed at CMake time. --- Source/cmGlobalXCodeGenerator.cxx | 33 ------------------ Source/cmGlobalXCodeGenerator.h | 3 -- Source/cmLocalGenerator.cxx | 11 ------ Source/cmLocalGenerator.h | 8 ----- Source/cmLocalUnixMakefileGenerator3.cxx | 11 ------ Source/cmLocalUnixMakefileGenerator3.h | 3 -- Source/cmLocalVisualStudio6Generator.cxx | 11 ------ Source/cmLocalVisualStudio6Generator.h | 3 -- Source/cmLocalVisualStudio7Generator.cxx | 13 ------- Source/cmLocalVisualStudio7Generator.h | 3 -- Source/cmLocalXCodeGenerator.cxx | 13 ------- Source/cmLocalXCodeGenerator.h | 3 -- Source/cmTarget.cxx | 59 -------------------------------- Source/cmTarget.h | 3 -- 14 files changed, 177 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 859503f..d164be2 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -179,8 +179,6 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& mf->AddDefinition("CMAKE_GENERATOR_CC", "gcc"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "g++"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); - // initialize Architectures so it can be used by - // GetTargetObjectFileDirectories this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); @@ -3363,37 +3361,6 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) } //---------------------------------------------------------------------------- -void cmGlobalXCodeGenerator:: -GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs) -{ - std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->CurrentMakefile->GetProjectName(); - dir += ".build/"; - dir += this->GetCMakeCFGInitDirectory(); - dir += "/"; - dir += target->GetName(); - dir += ".build/Objects-normal/"; - std::string dirsave = dir; - if(this->Architectures.size()) - { - for(std::vector::iterator i = this->Architectures.begin(); - i != this->Architectures.end(); ++i) - { - dir += *i; - dirs.push_back(dir); - dir = dirsave; - } - } - else - { - dirs.push_back(dir); - } -} - -//---------------------------------------------------------------------------- void cmGlobalXCodeGenerator ::AppendDirectoryForConfig(const char* prefix, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ed54be3..45f62eb 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -76,9 +76,6 @@ public: ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGInitDirectory(); - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs); void SetCurrentLocalGenerator(cmLocalGenerator*); /** Return true if the generated build tree may contain multiple builds. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3f98045..0fa1e5f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2970,17 +2970,6 @@ cmLocalGenerator::GetTargetDirectory(cmTarget const&) const return ""; } - -//---------------------------------------------------------------------------- -void -cmLocalGenerator::GetTargetObjectFileDirectories(cmTarget* , - std::vector& - ) -{ - cmSystemTools::Error("GetTargetObjectFileDirectories" - " called on cmLocalGenerator"); -} - //---------------------------------------------------------------------------- unsigned int cmLocalGenerator::GetBackwardsCompatibility() { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 0c5b9d0..97f3ada 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -257,14 +257,6 @@ public: }; FortranFormat GetFortranFormat(const char* value); - /** Return the directories into which object files will be put. - * There maybe more than one for fat binary systems like OSX. - */ - virtual void - GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs); - /** * Convert the given remote path to a relative path with respect to * the given local path. The local path must be given in component diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index dd313ca..5cc4e1c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2289,14 +2289,3 @@ void cmLocalUnixMakefileGenerator3 } } } - - -void cmLocalUnixMakefileGenerator3 -::GetTargetObjectFileDirectories(cmTarget* target, - std::vector& dirs) -{ - std::string dir = this->Makefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->GetTargetDirectory(*target); - dirs.push_back(dir); -} diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 45ac21d..4754f11 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -257,9 +257,6 @@ public: { return !this->SkipAssemblySourceRules; } - // Get the directories into which the .o files will go for this target - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector& dirs); // Fill the vector with the target names for the object files, // preprocessed files and assembly files. Currently only used by the diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1dfcbea..56b9869 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1778,17 +1778,6 @@ cmLocalVisualStudio6Generator return ""; } -void cmLocalVisualStudio6Generator -::GetTargetObjectFileDirectories(cmTarget* , - std::vector& - dirs) -{ - std::string dir = this->Makefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory(); - dirs.push_back(dir); -} - std::string cmLocalVisualStudio6Generator ::GetConfigName(std::string const& configuration) const diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 195d654..b912690 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -50,9 +50,6 @@ public: void SetBuildType(BuildType, const char* libName, cmTarget&); virtual std::string GetTargetDirectory(cmTarget const& target) const; - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs); private: std::string DSPHeaderTemplate; std::string DSPFooterTemplate; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 11a0387..7ff8892 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2114,19 +2114,6 @@ std::string cmLocalVisualStudio7Generator return dir; } -void cmLocalVisualStudio7Generator:: -GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs) -{ - std::string dir = this->Makefile->GetCurrentOutputDirectory(); - dir += "/"; - dir += this->GetTargetDirectory(*target); - dir += "/"; - dir += this->GetGlobalGenerator()->GetCMakeCFGInitDirectory(); - dirs.push_back(dir); -} - //---------------------------------------------------------------------------- #include static bool cmLVS6G_IsFAT(const char* dir) diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 5b634b8..6ddf82a 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -54,9 +54,6 @@ public: void SetBuildType(BuildType,const char *name); void SetPlatformName(const char* n) { this->PlatformName = n;} - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs); void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index b989870..551ebd3 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -33,16 +33,3 @@ cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const // No per-target directory for this generator (yet). return ""; } - -//---------------------------------------------------------------------------- -void cmLocalXCodeGenerator:: -GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs) -{ - cmGlobalXCodeGenerator* g = - (cmGlobalXCodeGenerator*)this->GetGlobalGenerator(); - g->SetCurrentLocalGenerator(this); - g->GetTargetObjectFileDirectories(target, - dirs); -} diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 1ab805d..eab228f 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -27,9 +27,6 @@ public: cmLocalXCodeGenerator(); virtual ~cmLocalXCodeGenerator(); - void GetTargetObjectFileDirectories(cmTarget* target, - std::vector& - dirs); virtual std::string GetTargetDirectory(cmTarget const& target) const; private: diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 57f5a94..2bf35b1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1077,17 +1077,6 @@ void cmTarget::DefineProperties(cmake *cm) "better if VS_GLOBAL_QtVersion is set to the version " "FindQt4.cmake found. For example, \"4.7.3\""); -#if 0 - cm->DefineProperty - ("OBJECT_FILES", cmProperty::TARGET, - "Used to get the resulting list of object files that make up a " - "target.", - "This can be used to put object files from one library " - "into another library. It is a read only property. It " - "converts the source list for the target into a list of full " - "paths to object names that will be produced by the target."); -#endif - #define CM_TARGET_FILE_TYPES_DOC \ "There are three kinds of target files that may be built: " \ "archive, library, and runtime. " \ @@ -2582,54 +2571,6 @@ const char *cmTarget::GetProperty(const char* prop) } //---------------------------------------------------------------------------- -void cmTarget::ComputeObjectFiles() -{ - if (this->IsImported()) - { - return; - } -#if 0 - std::vector dirs; - this->Makefile->GetLocalGenerator()-> - GetTargetObjectFileDirectories(this, - dirs); - std::string objectFiles; - std::string objExtensionLookup1 = "CMAKE_"; - std::string objExtensionLookup2 = "_OUTPUT_EXTENSION"; - - for(std::vector::iterator d = dirs.begin(); - d != dirs.end(); ++d) - { - for(std::vector::iterator s = this->SourceFiles.begin(); - s != this->SourceFiles.end(); ++s) - { - cmSourceFile* sf = *s; - if(const char* lang = sf->GetLanguage()) - { - std::string lookupObj = objExtensionLookup1 + lang; - lookupObj += objExtensionLookup2; - const char* obj = this->Makefile->GetDefinition(lookupObj.c_str()); - if(obj) - { - if(objectFiles.size()) - { - objectFiles += ";"; - } - std::string objFile = *d; - objFile += "/"; - objFile += this->Makefile->GetLocalGenerator()-> - GetSourceObjectName(*sf); - objFile += obj; - objectFiles += objFile; - } - } - } - } - this->SetProperty("OBJECT_FILES", objectFiles.c_str()); -#endif -} - -//---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const char* prop, cmProperty::ScopeType scope) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f4b6955..8ebb137 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -403,9 +403,6 @@ public: // Define the properties static void DefineProperties(cmake *cm); - // Compute the OBJECT_FILES property only when requested - void ComputeObjectFiles(); - /** Get the macro to define when building sources in this target. If no macro should be defined null is returned. */ const char* GetExportMacro(); -- cgit v0.12 From 67734be8cf4cb7fa1c29ec62a19ef04dd898a08c Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 6 Mar 2012 09:31:43 -0500 Subject: VS: Simplify object name computation Simplify cmLocalVisualStudioGenerator::ComputeObjectNameRequirements to loop over the original vector of source files instead of recursively traversing source groups just to find the same files. Drop from cmVisualStudio10TargetGenerator::ComputeObjectNames temporary source group calculation now that it is not needed for computing object names. --- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmLocalVisualStudioGenerator.cxx | 87 +++++++++++------------------- Source/cmLocalVisualStudioGenerator.h | 6 +-- Source/cmVisualStudio10TargetGenerator.cxx | 8 +-- 5 files changed, 34 insertions(+), 71 deletions(-) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 56b9869..dd51a2d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -380,7 +380,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, } // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(sourceGroups); + this->ComputeObjectNameRequirements(classes); // Write the DSP file's header. this->WriteDSPHeader(fout, libName, target, sourceGroups); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7ff8892..ee5d407 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1307,7 +1307,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, } // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(sourceGroups); + this->ComputeObjectNameRequirements(classes); // open the project this->WriteProjectStart(fout, libName, target, sourceGroups); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index de1ac30..f389b35 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -83,77 +83,50 @@ bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf) } //---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::CountObjectNames( - const std::vector& groups, - std::map& counts) +void +cmLocalVisualStudioGenerator::ComputeObjectNameRequirements( + std::vector const& sources + ) { - for(unsigned int i = 0; i < groups.size(); ++i) + // Clear the current set of requirements. + this->NeedObjectName.clear(); + + // Count the number of object files with each name. Note that + // windows file names are not case sensitive. + std::map counts; + for(std::vector::const_iterator s = sources.begin(); + s != sources.end(); ++s) { - cmSourceGroup sg = groups[i]; - std::vector const& srcs = sg.GetSourceFiles(); - for(std::vector::const_iterator s = srcs.begin(); - s != srcs.end(); ++s) + const cmSourceFile* sf = *s; + if(this->SourceFileCompiles(sf)) { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) - { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension( - sf->GetFullPath())); - objectName += ".obj"; - counts[objectName] += 1; - } + std::string objectName = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension( + sf->GetFullPath())); + objectName += ".obj"; + counts[objectName] += 1; } - this->CountObjectNames(sg.GetGroupChildren(), counts); } -} -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::InsertNeedObjectNames( - const std::vector& groups, - std::map& count) -{ - for(unsigned int i = 0; i < groups.size(); ++i) + // For all source files producing duplicate names we need unique + // object name computation. + for(std::vector::const_iterator s = sources.begin(); + s != sources.end(); ++s) { - cmSourceGroup sg = groups[i]; - std::vector const& srcs = sg.GetSourceFiles(); - for(std::vector::const_iterator s = srcs.begin(); - s != srcs.end(); ++s) + const cmSourceFile* sf = *s; + if(this->SourceFileCompiles(sf)) { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) + std::string objectName = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectName += ".obj"; + if(counts[objectName] > 1) { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectName += ".obj"; - if(count[objectName] > 1) - { - this->NeedObjectName.insert(sf); - } + this->NeedObjectName.insert(sf); } } - this->InsertNeedObjectNames(sg.GetGroupChildren(), count); } } - -//---------------------------------------------------------------------------- -void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements -(std::vector const& sourceGroups) -{ - // Clear the current set of requirements. - this->NeedObjectName.clear(); - - // Count the number of object files with each name. Note that - // windows file names are not case sensitive. - std::map objectNameCounts; - this->CountObjectNames(sourceGroups, objectNameCounts); - - // For all source files producing duplicate names we need unique - // object name computation. - this->InsertNeedObjectNames(sourceGroups, objectNameCounts); -} - //---------------------------------------------------------------------------- const char* cmLocalVisualStudioGenerator::ReportErrorLabel() const { diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index fcf1f21..e58c757 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -65,12 +65,8 @@ protected: MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran); // Safe object file name generation. - void ComputeObjectNameRequirements(std::vector const&); + void ComputeObjectNameRequirements(std::vector const&); bool SourceFileCompiles(const cmSourceFile* sf); - void CountObjectNames(const std::vector& groups, - std::map& count); - void InsertNeedObjectNames(const std::vector& groups, - std::map& count); std::set NeedObjectName; friend class cmVisualStudio10TargetGenerator; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9418761..c3629f9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -872,9 +872,6 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() void cmVisualStudio10TargetGenerator::ComputeObjectNames() { - // We may be modifying the source groups temporarily, so make a copy. - std::vector sourceGroups = this->Makefile->GetSourceGroups(); - // get the classes from the source lists then add them to the groups std::vectorconst & classes = this->Target->GetSourceFiles(); for(std::vector::const_iterator i = classes.begin(); @@ -886,13 +883,10 @@ void cmVisualStudio10TargetGenerator::ComputeObjectNames() { this->ModuleDefinitionFile = (*i)->GetFullPath(); } - cmSourceGroup& sourceGroup = - this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); - sourceGroup.AssignSource(*i); } // Compute which sources need unique object computation. - this->LocalGenerator->ComputeObjectNameRequirements(sourceGroups); + this->LocalGenerator->ComputeObjectNameRequirements(classes); } bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( -- cgit v0.12 From c91a54db3766aea8f8ab9d5a011db3bba67b12d4 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 6 Mar 2012 21:16:24 +0100 Subject: find_package: error out if REQUIRED Config has not been found If in Config mode a configuration file could not be found, cmake printed an error, but did not actually stop processing. With SetFatalErrorOccured it does. Alex --- Source/cmFindPackageCommand.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 9177162..f8139f9 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1062,6 +1062,10 @@ bool cmFindPackageCommand::HandlePackageMode() this->Makefile->IssueMessage( this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str()); + if (this->Required) + { + cmSystemTools::SetFatalErrorOccured(); + } if (!aw.str().empty()) { -- cgit v0.12 From b0cb29bb06918d3d6a60d22c0e54b8ca6e6b4f36 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 6 Mar 2012 21:23:11 +0100 Subject: Fix some typos in CPACK_SET_DESTDIR doc --- Source/CPack/cmCPackDocumentVariables.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index 23e99f8..d2e3802 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -44,14 +44,14 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) "Boolean toggle to make CPack use DESTDIR mechanism when" " packaging.", "DESTDIR means DESTination DIRectory." " It is commonly used by makefile " - "users in order to install software at non-default location. It a" - "basic relocation mechanism. " + "users in order to install software at non-default location. It " + "is a basic relocation mechanism. " "It is usually invoked like this:\n" " make DESTDIR=/home/john install\n" "which will install the concerned software using the" " installation prefix, e.g. \"/usr/local\" prepended with " "the DESTDIR value which finally gives \"/home/john/usr/local\"." - " When preparing a package CPack first installs the items to be " + " When preparing a package, CPack first installs the items to be " "packaged in a local (to the build tree) directory by using the " "same DESTDIR mechanism. Nevertheless, if " "CPACK_SET_DESTDIR is set then CPack will set DESTDIR before" @@ -63,7 +63,7 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) "Manually setting CPACK_SET_DESTDIR may help (or simply be" " necessary) if some install rules uses absolute " "DESTINATION (see CMake INSTALL command)." - "However, starting with" + " However, starting with" " CPack/CMake 2.8.3 RPM and DEB installers tries to handle DESTDIR" " automatically so that it is seldom necessary for the user to set" " it.", false, -- cgit v0.12 From d4719a8d369466eae7aa4d9491a4729376292e3c Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Tue, 6 Mar 2012 23:23:08 +0100 Subject: Add some missing CPACK_NSIS_xxx doc and move some to common CPack section. --- Modules/CPack.cmake | 14 ++++++++++++++ Modules/CPackNSIS.cmake | 19 +++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index b506711..571770e 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -101,6 +101,11 @@ ##end # ##variable +# CPACK_PACKAGE_ICON - A branding image that will be displayed inside +# the installer (used by GUI installers). +##end +# +##variable # CPACK_PROJECT_CONFIG_FILE - CPack-time project CPack configuration # file. This file included at cpack time, once per # generator after CPack has set CPACK_GENERATOR to the actual generator @@ -247,6 +252,15 @@ # CPACK_INSTALLED_DIRECTORIES - Extra directories to install. ##end # +##variable +# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when +# installing this project. This is only used +# by installer for Windows. +##end +##variable +# CPACK_CREATE_DESKTOP_LINKS - List of desktop links to create. +##end +# #============================================================================= # Copyright 2006-2009 Kitware, Inc. diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index 97179d7..7d9f29b 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -8,11 +8,6 @@ ##end # ##variable -# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when -# installing this project. -##end -# -##variable # CPACK_NSIS_INSTALL_ROOT - The default installation directory presented # to the end user by the NSIS installer is under this root dir. The full # directory presented to the end user is: @@ -30,11 +25,6 @@ ##end # ##variable -# CPACK_PACKAGE_ICON - A branding image that will be displayed inside -# the installer. -##end -# -##variable # CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will # be added to the install Section. ##end @@ -107,6 +97,15 @@ # CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option # to run on the finish page of the NSIS installer. ##end +##variable +# CPACK_NSIS_MENU_LINKS - Specify links in [application] menu. +# This should contain a list of pair "link" "link name". The link +# may be an URL or a path relative to installation prefix. +# Like: +# set(CPACK_NSIS_MENU_LINKS +# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" "CMake Help" +# "http://www.cmake.org" "CMake Web Site") +##end #============================================================================= # Copyright 2006-2009 Kitware, Inc. -- cgit v0.12 From b28e7fa174798717ebf8e18b8d97755d3568b04d Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 6 Mar 2012 18:41:56 -0500 Subject: VS6: Avoid SBCS test on VS6 (#12189) The previous commit, df19b9ca, assumed that the corresponding _UNICODE functionality in the VS6 generator actually worked. That turns out not to be the case. Unicode definition does not actually suppress _MBCS definition, so neither does this new code... Don't test it here, since the patch submitter for _SBCS does not need VS6 support. If somebody needs _UNICODE and _SBCS support to suppress the definition of _MBCS in the VS6 generator, it is work yet to do. Patches welcome. --- Tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index da656d4..3e1a962 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1306,7 +1306,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") - ADD_TEST_MACRO(SBCS SBCS) + IF(NOT MSVC60) + ADD_TEST_MACRO(SBCS SBCS) + ENDIF(NOT MSVC60) ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND} --build-and-test -- cgit v0.12 From 285f0db9f4871262360b50c870aef8bdabd853e8 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 7 Mar 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 617f126..1c9ce43 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 06) +SET(KWSYS_DATE_STAMP_DAY 07) -- cgit v0.12 From 204f5d443c68317b8a24439035bf1f6c39cc001c Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 16 Feb 2012 23:12:14 +0100 Subject: add CMakePackageConfigHelpers: configure_package_config_file() The function configure_package_config_file() may be used instead of configure_file() for generating the Config.cmake files for installation, they help to make those files relocatable. Alex --- Modules/CMakePackageConfigHelpers.cmake | 154 +++++++++++++++++++++++ Tests/FindPackageTest/CMakeLists.txt | 28 +++++ Tests/FindPackageTest/RelocatableConfig.cmake.in | 5 + 3 files changed, 187 insertions(+) create mode 100644 Modules/CMakePackageConfigHelpers.cmake create mode 100644 Tests/FindPackageTest/RelocatableConfig.cmake.in diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake new file mode 100644 index 0000000..063f5e0 --- /dev/null +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -0,0 +1,154 @@ +# - CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() +# +# CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL_DESTINATION +# [PATH_VARS ... ] +# [NO_SET_AND_CHECK_MACRO] ) +# +# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain +# CONFIGURE_FILE() command when creating the Config.cmake or -config.cmake +# file for installing a project or library. It helps making the resulting package +# relocatable by avoiding hardcoded paths in the installed Config.cmake file. +# +# In a FooConfig.cmake file there may be code like this to make the +# install destinations know to the using project: +# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) +# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) +# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) +# ...logic to determine installedPrefix from the own location... +# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) +# All 4 options shown above are not sufficient, since the first 3 hardcode +# the absolute directory locations, and the 4th case works only if the logic +# to determine the installedPrefix is correct, and if CONFIG_INSTALL_DIR contains +# a relative path, which in general cannot be guaranteed. +# This has the effect that the resulting FooConfig.cmake file would work poorly +# under Windows and OSX, where users are used to choose the install location +# of a binary package at install time, independent from how CMAKE_INSTALL_PREFIX +# was set at build/cmake time. +# +# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it makes the +# resulting FooConfig.cmake file relocatable. +# Usage: +# 1. write a FooConfig.cmake.in file as you are used to +# 2. insert a line containing only the string "@PACKAGE_INIT@" +# 3. instead of SET(FOO_DIR "@SOME_INSTALL_DIR@"), use SET(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") +# (this must be after the @PACKAGE_INIT@ line) +# 4. instead of using the normal CONFIGURE_FILE(), use CONFIGURE_PACKAGE_CONFIG_FILE() +# +# The and arguments are the input and output file, the same way +# as in CONFIGURE_FILE(). +# +# The given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake +# file will be installed to. This can either be a relative or absolute path, both work. +# +# The variables to given as PATH_VARS are the variables which contain +# install destinations. For each of them the macro will create a helper variable +# PACKAGE_. These helper variables must be used +# in the FooConfig.cmake.in file for setting the installed location. They are calculated +# by CONFIGURE_PACKAGE_CONFIG_FILE() so that they are always relative to the +# installed location of the package. This works both for relative and also for absolute locations. +# For absolute locations it works only if the absolute location is a subdirectory +# of CMAKE_INSTALL_PREFIX. +# +# By default configure_package_config_file() also generates a macro set_and_check() +# into the FooConfig.cmake file. This should be used instead of the normal set() +# command for setting directories and file locations. Additionally to setting the +# variable it also checks that the referenced file or directory actually exists +# and fails with a FATAL_ERROR otherwise. This makes sure that the created +# FooConfig.cmake file does not contain wrong references. +# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the +# FooConfig.cmake file. +# +# Example: +# CMakeLists.txt: +# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) +# set(LIB_INSTALL_DIR lib/ ... CACHE ) +# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) +# ... +# include(CMakePackageConfigHelpers) +# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) +# +# FooConfig.cmake.in: +# set(FOO_VERSION x.y.z) +# ... +# @PACKAGE_INIT@ +# ... +# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") + + +#============================================================================= +# Copyright 2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + + +function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) + set(options NO_SET_AND_CHECK_MACRO) + set(oneValueArgs INSTALL_DESTINATION ) + set(multiValueArgs PATH_VARS ) + + cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CCF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CCF_INSTALL_DESTINATION) + message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") + endif() + + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") + set(absInstallDir "${CCF_INSTALL_DESTINATION}") + else() + set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") + endif() + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) + + foreach(var ${CCF_PATH_VARS}) + if(NOT DEFINED ${var}) + message(FATAL_ERROR "Variable ${var} does not exist") + else() + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() + endif() + endforeach() + + set(PACKAGE_INIT " +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) +") + + if(NOT CCF_NO_SET_AND_CHECK_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(set_and_check _var _file) + set(\${_var} \"\${_file}\") + if(NOT EXISTS \"\${_file}\") + message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") + endif() +endmacro() +") + endif() + + set(PACKAGE_INIT "${PACKAGE_INIT} +####################################################################################") + + configure_file("${_inputFile}" "${_outputFile}" @ONLY) + +endfunction() diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 9a4bdfe..19255bf 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -305,6 +305,34 @@ STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION}) FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED) #----------------------------------------------------------------------------- +# Test configure_package_config_file(). + +include(CMakePackageConfigHelpers) + +set(INCLUDE_INSTALL_DIR include ) +set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" ) +set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) + +configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + ) + +include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake") + +if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include") + message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")") +endif() + +if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/") + message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")") +endif() + +if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")") +endif() + +#----------------------------------------------------------------------------- # Test write_basic_config_version_file(). include(WriteBasicConfigVersionFile) diff --git a/Tests/FindPackageTest/RelocatableConfig.cmake.in b/Tests/FindPackageTest/RelocatableConfig.cmake.in new file mode 100644 index 0000000..7a34b2f --- /dev/null +++ b/Tests/FindPackageTest/RelocatableConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +set(RELOC_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set(RELOC_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@") +set_and_check(RELOC_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@") -- cgit v0.12 From 6973e2d5a8be4d19aeb26fa67c0ed501ed81364e Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Fri, 17 Feb 2012 00:36:18 +0100 Subject: wrap write_basic_config_version_file as write_basic_package_version_file() So the name fits better with configure_package_config_file(), as discussed on the mailing list. Adapt the documentation accordingly. Alex --- Modules/CMakePackageConfigHelpers.cmake | 41 ++++++++++++++++++++++++++++--- Modules/WriteBasicConfigVersionFile.cmake | 27 +------------------- Source/cmFindPackageCommand.cxx | 2 +- Tests/FindPackageTest/CMakeLists.txt | 9 +++---- 4 files changed, 44 insertions(+), 35 deletions(-) diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 063f5e0..b174e98 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -58,7 +58,32 @@ # When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the # FooConfig.cmake file. # -# Example: +# For an example see below the documentation for WRITE_BASIC_PACKAGE_VERSION_FILE(). +# +# +# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) ) +# +# Writes a file for use as ConfigVersion.cmake file to . +# See the documentation of FIND_PACKAGE() for details on this. +# filename is the output filename, it should be in the build tree. +# major.minor.patch is the version number of the project to be installed +# The COMPATIBILITY mode AnyNewerVersion means that the installed package version +# will be considered compatible if it is newer or exactly the same as the requested version. +# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion +# in that the major version number must be the same as requested, e.g. version 2.0 will +# not be considered compatible if 1.0 is requested. +# If your project has more elaborated version matching rules, you will need to write your +# own custom ConfigVersion.cmake file instead of using this macro. +# +# Internally, this macro executes configure_file() to create the resulting +# version file. Depending on the COMPATIBLITY, either the file +# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in +# is used. Please note that these two files are internal to CMake and you should +# not call configure_file() on them yourself, but they can be used as starting +# point to create more sophisticted custom ConfigVersion.cmake files. +# +# +# Example using both configure_package_config_file() and write_basic_package_version_file(): # CMakeLists.txt: # set(INCLUDE_INSTALL_DIR include/ ... CACHE ) # set(LIB_INSTALL_DIR lib/ ... CACHE ) @@ -68,9 +93,13 @@ # configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake # INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake # PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) +# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# VERSION 1.2.3 +# COMPATIBILITY SameMajorVersion ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) # -# FooConfig.cmake.in: +# With a FooConfig.cmake.in: # set(FOO_VERSION x.y.z) # ... # @PACKAGE_INIT@ @@ -94,6 +123,12 @@ include(CMakeParseArguments) +include(WriteBasicConfigVersionFile) + +macro(WRITE_BASIC_PACKAGE_VERSION_FILE) + write_basic_config_version_file(${ARGN}) +endmacro() + function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) set(options NO_SET_AND_CHECK_MACRO) diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake index 0b6519d..038cb57 100644 --- a/Modules/WriteBasicConfigVersionFile.cmake +++ b/Modules/WriteBasicConfigVersionFile.cmake @@ -1,31 +1,6 @@ # WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) ) # -# Writes a file for use as ConfigVersion.cmake file to . -# See the documentation of FIND_PACKAGE() for details on this. -# filename is the output filename, it should be in the build tree. -# major.minor.patch is the version number of the project to be installed -# The COMPATIBILITY mode AnyNewerVersion means that the installed package version -# will be considered compatible if it is newer or exactly the same as the requested version. -# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion -# in that the major version number must be the same as requested, e.g. version 2.0 will -# not be considered compatible if 1.0 is requested. -# If your project has more elaborated version matching rules, you will need to write your -# own custom ConfigVersion.cmake file instead of using this macro. -# -# Example: -# write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# VERSION 1.2.3 -# COMPATIBILITY SameMajorVersion ) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake -# DESTINATION lib/cmake/Foo ) -# -# Internally, this macro executes configure_file() to create the resulting -# version file. Depending on the COMPATIBLITY, either the file -# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in -# is used. Please note that these two files are internal to CMake and you should -# not call configure_file() on them yourself, but they can be used as starting -# point to create more sophisticted custom ConfigVersion.cmake files. +# Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical. #============================================================================= # Copyright 2008-2011 Alexander Neundorf, diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 22bb628..04432ca 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -192,7 +192,7 @@ void cmFindPackageCommand::GenerateDocumentation() "If no such version file is available then the configuration file " "is assumed to not be compatible with any requested version. " "A basic version file containing generic version matching code can be " - "created using the macro write_basic_config_version_file(), see its " + "created using the macro write_basic_package_version_file(), see its " "documentation for more details. " "When a version file is found it is loaded to check the requested " "version number. " diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 19255bf..a4f213b 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -335,11 +335,9 @@ endif() #----------------------------------------------------------------------------- # Test write_basic_config_version_file(). -include(WriteBasicConfigVersionFile) - -write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake - VERSION 1.2.3 - COMPATIBILITY AnyNewerVersion) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake + VERSION 1.2.3 + COMPATIBILITY AnyNewerVersion) set(PACKAGE_FIND_VERSION 2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake) @@ -373,6 +371,7 @@ endif() ####################### +include(WriteBasicConfigVersionFile) write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake VERSION 1.2.3 -- cgit v0.12 From c5ae73316634b0d1fe56272ab011eefd9cb80e47 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 11:34:59 -0500 Subject: find_package: Test that REQUIRED aborts processing correctly Verify that the command produces a FATAL_ERROR if and only if the missing package is REQUIRED. --- Tests/CMakeCommands/find_package/MissingConfig-stderr.txt | 6 ++++++ Tests/CMakeCommands/find_package/MissingConfig.cmake | 1 + Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt | 2 +- Tests/CMakeCommands/find_package/MissingConfigRequired.cmake | 1 + Tests/CMakeCommands/find_package/MissingModule-stderr.txt | 5 +++++ Tests/CMakeCommands/find_package/MissingModule.cmake | 1 + Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt | 2 +- Tests/CMakeCommands/find_package/MissingModuleRequired.cmake | 1 + Tests/CMakeCommands/find_package/MissingNormal-stderr.txt | 6 ++++++ Tests/CMakeCommands/find_package/MissingNormal.cmake | 1 + Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt | 2 +- Tests/CMakeCommands/find_package/MissingNormalRequired.cmake | 1 + 12 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt index 0d14dcb..1eae0bb 100644 --- a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt +++ b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt @@ -11,3 +11,9 @@ CMake Warning at MissingConfig.cmake:1 \(find_package\): been installed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + + +CMake Warning at MissingConfig.cmake:2 \(message\): + This warning must be reachable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingConfig.cmake b/Tests/CMakeCommands/find_package/MissingConfig.cmake index 3cebef1..238e7e4 100644 --- a/Tests/CMakeCommands/find_package/MissingConfig.cmake +++ b/Tests/CMakeCommands/find_package/MissingConfig.cmake @@ -1 +1,2 @@ find_package(NotHere CONFIG) +message(WARNING "This warning must be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt index 56325d8..2ba774a 100644 --- a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt +++ b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt @@ -10,4 +10,4 @@ CMake Error at MissingConfigRequired.cmake:1 \(find_package\): "NotHere" provides a separate development package or SDK, be sure it has been installed. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake index 3c28552..0ae6702 100644 --- a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake +++ b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake @@ -1 +1,2 @@ find_package(NotHere CONFIG REQUIRED) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt index 71b5eae..2ad460f 100644 --- a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt +++ b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt @@ -19,3 +19,8 @@ CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning at MissingModule.cmake:2 \(message\): + This warning must be reachable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingModule.cmake b/Tests/CMakeCommands/find_package/MissingModule.cmake index 420539f..76bcef2 100644 --- a/Tests/CMakeCommands/find_package/MissingModule.cmake +++ b/Tests/CMakeCommands/find_package/MissingModule.cmake @@ -1 +1,2 @@ find_package(NotHere MODULE) +message(WARNING "This warning must be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt index c3cd350..fec05f1 100644 --- a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt +++ b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt @@ -18,4 +18,4 @@ CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake index 07f36c5..897eda6 100644 --- a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake +++ b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake @@ -1 +1,2 @@ find_package(NotHere MODULE REQUIRED) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt index e5cbd97..f4c6fba 100644 --- a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt +++ b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt @@ -15,3 +15,9 @@ CMake Warning at MissingNormal.cmake:1 \(find_package\): been installed. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + + +CMake Warning at MissingNormal.cmake:2 \(message\): + This warning must be reachable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingNormal.cmake b/Tests/CMakeCommands/find_package/MissingNormal.cmake index 778cd38..fb90e01 100644 --- a/Tests/CMakeCommands/find_package/MissingNormal.cmake +++ b/Tests/CMakeCommands/find_package/MissingNormal.cmake @@ -1 +1,2 @@ find_package(NotHere) +message(WARNING "This warning must be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt index ac52aec..7bb7902 100644 --- a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt +++ b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt @@ -14,4 +14,4 @@ CMake Error at MissingNormalRequired.cmake:1 \(find_package\): "NotHere" provides a separate development package or SDK, be sure it has been installed. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake index 5c33fca..33353d8 100644 --- a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake +++ b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake @@ -1 +1,2 @@ find_package(NotHere REQUIRED) +message(FATAL_ERROR "This error must not be reachable.") -- cgit v0.12 From 2c601c100bb1f822da923c31bb4f2c123f1b7edd Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 7 Mar 2012 11:03:36 -0700 Subject: DeployQt4: Add path to Qt dlls on Windows. --- Modules/DeployQt4.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 8a5e9c5..b37695d 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -126,6 +126,9 @@ function(fixup_qt4_executable executable) if(QT_LIBRARY_DIR) list(APPEND dirs "${QT_LIBRARY_DIR}") endif() + if(QT_BINARY_DIR) + list(APPEND dirs "${QT_BINARY_DIR}") + endif() if(APPLE) set(qt_conf_dir "${executable}/Contents/Resources") @@ -258,6 +261,9 @@ function(install_qt4_executable executable) if(QT_LIBRARY_DIR) list(APPEND dirs "${QT_LIBRARY_DIR}") endif() + if(QT_BINARY_DIR) + list(APPEND dirs "${QT_BINARY_DIR}") + endif() if(component) set(component COMPONENT ${component}) else() -- cgit v0.12 From 3a36fa99715df39ae8fe5deabf000df201682136 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 8 Mar 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 1c9ce43..1946a39 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 07) +SET(KWSYS_DATE_STAMP_DAY 08) -- cgit v0.12 From 0996f2a228a834d75ba9845ea6b899b60eb84712 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 6 Mar 2012 14:42:40 -0500 Subject: Hide Makefile local object info inside local generator Make cmLocalUnixMakefileGenerator3::LocalObjectInfo private and add cmLocalUnixMakefileGenerator3::AddLocalObjectFile to create entries. --- Source/cmLocalUnixMakefileGenerator3.cxx | 14 ++++++++++ Source/cmLocalUnixMakefileGenerator3.h | 44 +++++++++++++++++--------------- Source/cmMakefileTargetGenerator.cxx | 12 ++------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5cc4e1c..d032a93 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -145,6 +145,20 @@ void cmLocalUnixMakefileGenerator3::Generate() } //---------------------------------------------------------------------------- +void cmLocalUnixMakefileGenerator3::AddLocalObjectFile( + cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir, + bool hasSourceExtension) +{ + if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) + { + objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); + } + LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir]; + info.HasSourceExtension = hasSourceExtension; + info.push_back(LocalObjectEntry(target, sf->GetLanguage())); +} + +//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets (std::vector& targets) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4754f11..4bde082 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -225,24 +225,9 @@ public: // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); - struct LocalObjectEntry - { - cmTarget* Target; - std::string Language; - LocalObjectEntry(): Target(0), Language() {} - LocalObjectEntry(cmTarget* t, const char* lang): - Target(t), Language(lang) {} - }; - struct LocalObjectInfo: public std::vector - { - bool HasSourceExtension; - bool HasPreprocessRule; - bool HasAssembleRule; - LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), - HasAssembleRule(false) {} - }; - std::map const& GetLocalObjectFiles() - { return this->LocalObjectFiles;} + void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf, + std::string objNoTargetDir, + bool hasSourceExtension); std::vector const& GetLocalHelp() { return this->LocalHelp; } @@ -298,9 +283,6 @@ protected: void WriteTargetRequiresRule(std::ostream& ruleFileStream, cmTarget& target, const std::vector& objects); - void WriteObjectConvenienceRule(std::ostream& ruleFileStream, - const char* comment, const char* output, - LocalObjectInfo const& info); std::string GetObjectFileName(cmTarget& target, const cmSourceFile& source, @@ -375,7 +357,27 @@ private: bool SkipPreprocessedSourceRules; bool SkipAssemblySourceRules; + struct LocalObjectEntry + { + cmTarget* Target; + std::string Language; + LocalObjectEntry(): Target(0), Language() {} + LocalObjectEntry(cmTarget* t, const char* lang): + Target(t), Language(lang) {} + }; + struct LocalObjectInfo: public std::vector + { + bool HasSourceExtension; + bool HasPreprocessRule; + bool HasAssembleRule; + LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), + HasAssembleRule(false) {} + }; std::map LocalObjectFiles; + void WriteObjectConvenienceRule(std::ostream& ruleFileStream, + const char* comment, const char* output, + LocalObjectInfo const& info); + std::vector LocalHelp; /* does the work for each target */ diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a3a832b..d33861c 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -489,16 +489,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) srcFullPath.c_str()); // add this to the list of objects for this local generator - if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) - { - objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); - } - cmLocalUnixMakefileGenerator3::LocalObjectInfo& info = - this->LocalGenerator->LocalObjectFiles[objNoTargetDir]; - info.HasSourceExtension = hasSourceExtension; - info.push_back( - cmLocalUnixMakefileGenerator3::LocalObjectEntry(this->Target, lang) - ); + this->LocalGenerator->AddLocalObjectFile( + this->Target, &source, objNoTargetDir, hasSourceExtension); } //---------------------------------------------------------------------------- -- cgit v0.12 From c7bdef5b48fe74f92d75f538e702257e7de1a998 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 9 Mar 2012 00:01:03 -0500 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 1946a39..b00f782 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 03) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 08) +SET(KWSYS_DATE_STAMP_DAY 09) -- cgit v0.12 From 11d9b211266865f0ce4a1005bbb18748c0806bce Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 11:44:48 -0500 Subject: Add cmGeneratorTarget to represent a target during generation Some per-target information and logic is common to all generators. Some of that information is currently stored in cmTarget but that should be reserved for the configure step. Create a class to hold per-target information for generators. On construction classify sources from the target and store them in separate members. This classification is already implemented separately in each generator. --- Source/CMakeLists.txt | 2 ++ Source/cmGeneratorTarget.cxx | 74 ++++++++++++++++++++++++++++++++++++++++++++ Source/cmGeneratorTarget.h | 50 ++++++++++++++++++++++++++++++ bootstrap | 1 + 4 files changed, 127 insertions(+) create mode 100644 Source/cmGeneratorTarget.cxx create mode 100644 Source/cmGeneratorTarget.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 0c420b9..af74ead 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -185,6 +185,8 @@ SET(SRCS cmGeneratedFileStream.cxx cmGeneratorExpression.cxx cmGeneratorExpression.h + cmGeneratorTarget.cxx + cmGeneratorTarget.h cmGlobalGenerator.cxx cmGlobalGenerator.h cmGlobalUnixMakefileGenerator3.cxx diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx new file mode 100644 index 0000000..afb1f39 --- /dev/null +++ b/Source/cmGeneratorTarget.cxx @@ -0,0 +1,74 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGeneratorTarget.h" + +#include "cmTarget.h" +#include "cmMakefile.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" +#include "cmSourceFile.h" + +//---------------------------------------------------------------------------- +cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) +{ + this->Makefile = this->Target->GetMakefile(); + this->LocalGenerator = this->Makefile->GetLocalGenerator(); + this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); + this->ClassifySources(); +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::ClassifySources() +{ + std::vector const& sources = this->Target->GetSourceFiles(); + for(std::vector::const_iterator si = sources.begin(); + si != sources.end(); ++si) + { + cmSourceFile* sf = *si; + cmTarget::SourceFileFlags tsFlags = + this->Target->GetTargetSourceFileFlags(sf); + if(sf->GetCustomCommand()) + { + this->CustomCommands.push_back(sf); + } + else if(tsFlags.Type != cmTarget::SourceFileTypeNormal) + { + this->OSXContent.push_back(sf); + } + else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY")) + { + this->HeaderSources.push_back(sf); + } + else if(sf->GetPropertyAsBool("EXTERNAL_OBJECT")) + { + this->ExternalObjects.push_back(sf); + } + else if(cmSystemTools::LowerCase(sf->GetExtension()) == "def") + { + this->ModuleDefinitionFile = sf->GetFullPath(); + } + else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) + { + // We only get here if a source file is not an external object + // and has an extension that is listed as an ignored file type. + // No message or diagnosis should be given. + } + else if(sf->GetLanguage()) + { + this->ObjectSources.push_back(sf); + } + else + { + this->ExtraSources.push_back(sf); + } + } +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h new file mode 100644 index 0000000..d93b052 --- /dev/null +++ b/Source/cmGeneratorTarget.h @@ -0,0 +1,50 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2012 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGeneratorTarget_h +#define cmGeneratorTarget_h + +#include "cmStandardIncludes.h" + +class cmCustomCommand; +class cmGlobalGenerator; +class cmLocalGenerator; +class cmMakefile; +class cmSourceFile; +class cmTarget; + +class cmGeneratorTarget +{ +public: + cmGeneratorTarget(cmTarget*); + + cmTarget* Target; + cmMakefile* Makefile; + cmLocalGenerator* LocalGenerator; + cmGlobalGenerator* GlobalGenerator; + + /** Sources classified by purpose. */ + std::vector CustomCommands; + std::vector ExtraSources; + std::vector HeaderSources; + std::vector ObjectSources; + std::vector ExternalObjects; + std::vector OSXContent; + std::string ModuleDefinitionFile; + +private: + void ClassifySources(); + + cmGeneratorTarget(cmGeneratorTarget const&); + void operator=(cmGeneratorTarget const&); +}; + +#endif diff --git a/bootstrap b/bootstrap index 665c6c5..3be3d1f 100755 --- a/bootstrap +++ b/bootstrap @@ -208,6 +208,7 @@ CMAKE_CXX_SOURCES="\ cmExportInstallFileGenerator \ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ + cmGeneratorTarget \ cmGeneratorExpression \ cmGlobalGenerator \ cmLocalGenerator \ -- cgit v0.12 From 4b245580913e02ba577d6eb7825866300d364b53 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 11:50:41 -0500 Subject: Create a cmGeneratorTarget for each cmTarget during generation Construct the instances after the final set of targets is known but before computing inter-target dependencies. This order will allow initialization of cmGeneratorTarget instances to adjust and finalize declared inter-target dependencies. --- Source/cmGlobalGenerator.cxx | 47 ++++++++++++++++++++++++++++++++++++++++++++ Source/cmGlobalGenerator.h | 10 ++++++++++ 2 files changed, 57 insertions(+) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a988844..a1f80d9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -24,6 +24,7 @@ #include "cmExportInstallFileGenerator.h" #include "cmComputeTargetDepends.h" #include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" #include @@ -74,6 +75,7 @@ cmGlobalGenerator::~cmGlobalGenerator() delete this->ExtraGenerator; } + this->ClearGeneratorTargets(); this->ClearExportSets(); } @@ -807,6 +809,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project, void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; + this->ClearGeneratorTargets(); this->ClearExportSets(); // Delete any existing cmLocalGenerators unsigned int i; @@ -947,6 +950,9 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->GenerateTargetManifest(); } + // Create per-target generator information. + this->CreateGeneratorTargets(); + // Compute the inter-target dependencies. if(!this->ComputeTargetDepends()) { @@ -1056,6 +1062,47 @@ void cmGlobalGenerator::CreateAutomocTargets() #endif } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::CreateGeneratorTargets() +{ + // Construct per-target generator information. + for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) + { + cmTargets& targets = + this->LocalGenerators[i]->GetMakefile()->GetTargets(); + for(cmTargets::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + cmTarget* t = &ti->second; + this->GeneratorTargets[t] = new cmGeneratorTarget(t); + } + } +} + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ClearGeneratorTargets() +{ + for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); + i != this->GeneratorTargets.end(); ++i) + { + delete i->second; + } + this->GeneratorTargets.clear(); +} + +//---------------------------------------------------------------------------- +cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const +{ + GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); + if(ti == this->GeneratorTargets.end()) + { + this->CMakeInstance->IssueMessage( + cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!", + cmListFileBacktrace()); + return 0; + } + return ti->second; +} void cmGlobalGenerator::CheckLocalGenerators() { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 1a0e41a..b94cc6c 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -19,6 +19,7 @@ #include "cmTargetDepend.h" // For cmTargetDependSet #include "cmSystemTools.h" // for cmSystemTools::OutputOption class cmake; +class cmGeneratorTarget; class cmMakefile; class cmLocalGenerator; class cmExternalMakefileProjectGenerator; @@ -251,6 +252,9 @@ public: // via a target_link_libraries or add_dependencies TargetDependSet const& GetTargetDirectDepends(cmTarget & target); + /** Get per-target generator information. */ + cmGeneratorTarget* GetGeneratorTarget(cmTarget*) const; + const std::map >& GetProjectMap() const {return this->ProjectMap;} @@ -370,6 +374,12 @@ private: typedef std::map TargetDependMap; TargetDependMap TargetDependencies; + // Per-target generator information. + typedef std::map GeneratorTargetsType; + GeneratorTargetsType GeneratorTargets; + void CreateGeneratorTargets(); + void ClearGeneratorTargets(); + // Cache directory content and target files to be built. struct DirectoryContent: public std::set { -- cgit v0.12 From 45c2f93240eb0556b3a8025e154a3dea5e206c7a Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 11:54:52 -0500 Subject: Simplify cmMakefileTargetGenerator using cmGeneratorTarget Replace the classification of source files in this generator using that computed by cmGeneratorTarget. --- Source/cmMakefileTargetGenerator.cxx | 90 ++++++++++++++++-------------------- Source/cmMakefileTargetGenerator.h | 5 +- 2 files changed, 42 insertions(+), 53 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b9120c4..b374bb6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmMakefileTargetGenerator.h" +#include "cmGeneratorTarget.h" #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h" @@ -42,6 +43,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target) this->GlobalGenerator = static_cast( this->LocalGenerator->GetGlobalGenerator()); + this->GeneratorTarget = this->GlobalGenerator->GetGeneratorTarget(target); cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; if(const char* ruleStatus = cm->GetProperty("RULE_MESSAGES")) @@ -131,58 +133,46 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() // First generate the object rule files. Save a list of all object // files for this target. - const std::vector& sources = this->Target->GetSourceFiles(); - for(std::vector::const_iterator source = sources.begin(); - source != sources.end(); ++source) + for(std::vector::const_iterator + si = this->GeneratorTarget->CustomCommands.begin(); + si != this->GeneratorTarget->CustomCommands.end(); ++si) { - cmTarget::SourceFileFlags tsFlags = - this->Target->GetTargetSourceFileFlags(*source); - if(cmCustomCommand* cc = (*source)->GetCustomCommand()) + cmCustomCommand const* cc = (*si)->GetCustomCommand(); + this->GenerateCustomRuleFile(*cc); + if (clean) { - this->GenerateCustomRuleFile(*cc); - if (clean) - { - const std::vector& outputs = cc->GetOutputs(); - for(std::vector::const_iterator o = outputs.begin(); - o != outputs.end(); ++o) - { - this->CleanFiles.push_back - (this->Convert(o->c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::UNCHANGED)); - } - } - } - else if(tsFlags.Type != cmTarget::SourceFileTypeNormal) - { - this->WriteMacOSXContentRules(*(*source), tsFlags.MacFolder); - } - else if(!(*source)->GetPropertyAsBool("HEADER_FILE_ONLY")) - { - if(!this->GlobalGenerator->IgnoreFile - ((*source)->GetExtension().c_str())) - { - // Generate this object file's rule file. - this->WriteObjectRuleFiles(*(*source)); - } - else if((*source)->GetPropertyAsBool("EXTERNAL_OBJECT")) - { - // This is an external object file. Just add it. - this->ExternalObjects.push_back((*source)->GetFullPath()); - } - else if(cmSystemTools::UpperCase((*source)->GetExtension()) == "DEF") - { - this->ModuleDefinitionFile = (*source)->GetFullPath(); - } - else + const std::vector& outputs = cc->GetOutputs(); + for(std::vector::const_iterator o = outputs.begin(); + o != outputs.end(); ++o) { - // We only get here if a source file is not an external object - // and has an extension that is listed as an ignored file type - // for this language. No message or diagnosis should be - // given. + this->CleanFiles.push_back + (this->Convert(o->c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::UNCHANGED)); } } } + for(std::vector::const_iterator + si = this->GeneratorTarget->OSXContent.begin(); + si != this->GeneratorTarget->OSXContent.end(); ++si) + { + cmTarget::SourceFileFlags tsFlags = + this->Target->GetTargetSourceFileFlags(*si); + this->WriteMacOSXContentRules(**si, tsFlags.MacFolder); + } + for(std::vector::const_iterator + si = this->GeneratorTarget->ExternalObjects.begin(); + si != this->GeneratorTarget->ExternalObjects.end(); ++si) + { + this->ExternalObjects.push_back((*si)->GetFullPath()); + } + for(std::vector::const_iterator + si = this->GeneratorTarget->ObjectSources.begin(); + si != this->GeneratorTarget->ObjectSources.end(); ++si) + { + // Generate this object file's rule file. + this->WriteObjectRuleFiles(**si); + } } @@ -1633,9 +1623,9 @@ void cmMakefileTargetGenerator this->BuildFileNameFull.c_str()); // Add a dependency on the link definitions file, if any. - if(!this->ModuleDefinitionFile.empty()) + if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) { - depends.push_back(this->ModuleDefinitionFile); + depends.push_back(this->GeneratorTarget->ModuleDefinitionFile); } // Add dependencies on the external object files. @@ -1971,7 +1961,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) { - if(this->ModuleDefinitionFile.empty()) + if(this->GeneratorTarget->ModuleDefinitionFile.empty()) { return; } @@ -1988,7 +1978,7 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile.c_str())); + this->GeneratorTarget->ModuleDefinitionFile.c_str())); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 8fba13f..dbc607a 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -17,6 +17,7 @@ class cmCustomCommand; class cmDependInformation; class cmDepends; +class cmGeneratorTarget; class cmGeneratedFileStream; class cmGlobalUnixMakefileGenerator3; class cmLocalUnixMakefileGenerator3; @@ -157,6 +158,7 @@ protected: void RemoveForbiddenFlags(const char* flagVar, const char* linkLang, std::string& linkFlags); cmTarget *Target; + cmGeneratorTarget* GeneratorTarget; cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; cmMakefile *Makefile; @@ -198,9 +200,6 @@ protected: std::vector Objects; std::vector ExternalObjects; - // The windows module definition source file (.def), if any. - std::string ModuleDefinitionFile; - // Set of object file names that will be built in this directory. std::set ObjectFiles; -- cgit v0.12 From 62a841b80b5f4b4f9cc0ddba77ae010a29b0e27e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 11:56:21 -0500 Subject: Simplify cmVisualStudio10TargetGenerator using cmGeneratorTarget Use CustomCommands and ModuleDefinitionFile computed in the latter instead of recomputing them from the original target source files. --- Source/cmVisualStudio10TargetGenerator.cxx | 37 ++++++++---------------------- Source/cmVisualStudio10TargetGenerator.h | 4 ++-- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 66f9a36..9168818 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmVisualStudio10TargetGenerator.h" #include "cmGlobalVisualStudio10Generator.h" +#include "cmGeneratorTarget.h" #include "cmTarget.h" #include "cmComputeLinkInformation.h" #include "cmGeneratedFileStream.h" @@ -62,6 +63,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, { this->GlobalGenerator = gg; this->Target = target; + this->GeneratorTarget = gg->GetGeneratorTarget(target); this->Makefile = target->GetMakefile(); this->LocalGenerator = (cmLocalVisualStudio7Generator*) @@ -70,7 +72,8 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); - this->ComputeObjectNames(); + this->LocalGenerator + ->ComputeObjectNameRequirements(target->GetSourceFiles()); this->BuildFileStream = 0; } @@ -421,12 +424,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() void cmVisualStudio10TargetGenerator::WriteCustomCommands() { this->SourcesVisited.clear(); - std::vector const& sources = this->Target->GetSourceFiles(); - for(std::vector::const_iterator source = sources.begin(); - source != sources.end(); ++source) + for(std::vector::const_iterator + si = this->GeneratorTarget->CustomCommands.begin(); + si != this->GeneratorTarget->CustomCommands.end(); ++si) { - cmSourceFile* sf = *source; - this->WriteCustomCommand(sf); + this->WriteCustomCommand(*si); } } @@ -875,25 +877,6 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() this->WriteString("\n", 1); } -void cmVisualStudio10TargetGenerator::ComputeObjectNames() -{ - // get the classes from the source lists then add them to the groups - std::vectorconst & classes = this->Target->GetSourceFiles(); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); i++) - { - // Add the file to the list of sources. - std::string source = (*i)->GetFullPath(); - if(cmSystemTools::UpperCase((*i)->GetExtension()) == "DEF") - { - this->ModuleDefinitionFile = (*i)->GetFullPath(); - } - } - - // Compute which sources need unique object computation. - this->LocalGenerator->ComputeObjectNameRequirements(classes); -} - bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile* source) { @@ -1513,10 +1496,10 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& linkOptions.AddFlag("ImportLibrary", imLib.c_str()); linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str()); linkOptions.Parse(flags.c_str()); - if(!this->ModuleDefinitionFile.empty()) + if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) { linkOptions.AddFlag("ModuleDefinitionFile", - this->ModuleDefinitionFile.c_str()); + this->GeneratorTarget->ModuleDefinitionFile.c_str()); } linkOptions.RemoveFlag("GenerateManifest"); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 90035f2..64fb124 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -15,6 +15,7 @@ class cmTarget; class cmMakefile; +class cmGeneratorTarget; class cmGeneratedFileStream; class cmGlobalVisualStudio10Generator; class cmSourceFile; @@ -75,7 +76,6 @@ private: void WriteEvents(std::string const& configName); void WriteEvent(const char* name, std::vector & commands, std::string const& configName); - void ComputeObjectNames(); void WriteGroupSources(const char* name, std::vector const& sources, std::vector& ); @@ -87,9 +87,9 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map OptionsMap; OptionsMap ClOptions; - std::string ModuleDefinitionFile; std::string PathToVcxproj; cmTarget* Target; + cmGeneratorTarget* GeneratorTarget; cmMakefile* Makefile; std::string Platform; std::string GUID; -- cgit v0.12 From 3baaf6ccecb9117b613fc89cd37206960298dfaa Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 14:01:46 -0500 Subject: Pre-compute object file names before Makefile generation Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked during cmGeneratorTarget construction. Implement it in the Makefile generator to pre-compute all object file names for each target. Use the results during generation instead of re-computing it later. --- Source/cmGeneratorTarget.h | 2 ++ Source/cmGlobalGenerator.cxx | 10 +++++++- Source/cmGlobalGenerator.h | 1 + Source/cmGlobalUnixMakefileGenerator3.cxx | 32 +++++++++++++++++++++++++ Source/cmGlobalUnixMakefileGenerator3.h | 2 ++ Source/cmLocalUnixMakefileGenerator3.cxx | 39 ------------------------------- Source/cmLocalUnixMakefileGenerator3.h | 5 ---- Source/cmMakefileTargetGenerator.cxx | 14 ++++------- 8 files changed, 50 insertions(+), 55 deletions(-) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d93b052..976cac4 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -40,6 +40,8 @@ public: std::vector OSXContent; std::string ModuleDefinitionFile; + std::map Objects; + private: void ClassifySources(); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a1f80d9..d7ba8b6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1074,7 +1074,9 @@ void cmGlobalGenerator::CreateGeneratorTargets() ti != targets.end(); ++ti) { cmTarget* t = &ti->second; - this->GeneratorTargets[t] = new cmGeneratorTarget(t); + cmGeneratorTarget* gt = new cmGeneratorTarget(t); + this->GeneratorTargets[t] = gt; + this->ComputeTargetObjects(gt); } } } @@ -1104,6 +1106,12 @@ cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const return ti->second; } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const +{ + // Implemented in generator subclasses that need this. +} + void cmGlobalGenerator::CheckLocalGenerators() { std::map notFoundMap; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b94cc6c..e818e37 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -379,6 +379,7 @@ private: GeneratorTargetsType GeneratorTargets; void CreateGeneratorTargets(); void ClearGeneratorTargets(); + virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; // Cache directory content and target files to be built. struct DirectoryContent: public std::set diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a23c0d8..059692e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -17,6 +17,7 @@ #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" #include "cmTarget.h" +#include "cmGeneratorTarget.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { @@ -71,6 +72,37 @@ void cmGlobalUnixMakefileGenerator3 } //---------------------------------------------------------------------------- +void +cmGlobalUnixMakefileGenerator3 +::ComputeTargetObjects(cmGeneratorTarget* gt) const +{ + cmTarget* target = gt->Target; + cmLocalUnixMakefileGenerator3* lg = + static_cast(gt->LocalGenerator); + + // Compute full path to object file directory for this target. + std::string dir_max; + dir_max += gt->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += gt->LocalGenerator->GetTargetDirectory(*target); + dir_max += "/"; + + // Compute the name of each object file. + for(std::vector::iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + bool hasSourceExtension = true; + std::string objectName = gt->LocalGenerator + ->GetObjectFileNameWithoutTarget(*sf, dir_max, + &hasSourceExtension); + gt->Objects[sf] = objectName; + lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension); + } +} + +//---------------------------------------------------------------------------- std::string EscapeJSON(const std::string& s) { std::string result; for (std::string::size_type i = 0; i < s.size(); ++i) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 9663b55..e6dd09d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -182,6 +182,8 @@ protected: size_t CountProgressMarksInAll(cmLocalUnixMakefileGenerator3* lg); cmGeneratedFileStream *CommandDatabase; +private: + virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; }; #endif diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fdf59b2..b991b25 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2009,45 +2009,6 @@ void cmLocalUnixMakefileGenerator3 } //---------------------------------------------------------------------------- -std::string -cmLocalUnixMakefileGenerator3 -::GetObjectFileName(cmTarget& target, - const cmSourceFile& source, - std::string* nameWithoutTargetDir, - bool* hasSourceExtension) -{ - // Make sure we never hit this old case. - if(source.GetProperty("MACOSX_PACKAGE_LOCATION")) - { - std::string msg = "MACOSX_PACKAGE_LOCATION set on source file: "; - msg += source.GetFullPath(); - this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, - msg.c_str()); - } - - // Start with the target directory. - std::string obj = this->GetTargetDirectory(target); - obj += "/"; - - // Get the object file name without the target directory. - std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += obj; - std::string objectName = - this->GetObjectFileNameWithoutTarget(source, dir_max, - hasSourceExtension); - if(nameWithoutTargetDir) - { - *nameWithoutTargetDir = objectName; - } - - // Append the object name to the target directory. - obj += objectName; - return obj; -} - -//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) { os diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4bde082..e374959 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -284,11 +284,6 @@ protected: cmTarget& target, const std::vector& objects); - std::string GetObjectFileName(cmTarget& target, - const cmSourceFile& source, - std::string* nameWithoutTargetDir = 0, - bool* hasSourceExtension = 0); - void AppendRuleDepend(std::vector& depends, const char* ruleFileName); void AppendRuleDepends(std::vector& depends, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b374bb6..fc55f1e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -418,12 +418,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) } // Get the full path name of the object file. - bool hasSourceExtension; - std::string objNoTargetDir; - std::string obj = - this->LocalGenerator->GetObjectFileName(*this->Target, source, - &objNoTargetDir, - &hasSourceExtension); + std::string const& objectName = this->GeneratorTarget->Objects[&source]; + std::string obj = this->LocalGenerator->GetTargetDirectory(*this->Target); + obj += "/"; + obj += objectName; // Avoid generating duplicate rules. if(this->ObjectFiles.find(obj) == this->ObjectFiles.end()) @@ -477,10 +475,6 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) AddImplicitDepends(*this->Target, lang, objFullPath.c_str(), srcFullPath.c_str()); - - // add this to the list of objects for this local generator - this->LocalGenerator->AddLocalObjectFile( - this->Target, &source, objNoTargetDir, hasSourceExtension); } //---------------------------------------------------------------------------- -- cgit v0.12 From d57047de33e096eac6fc84976c733b7941c9add3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 7 Mar 2012 14:04:33 -0500 Subject: Pre-compute object file names before VS project generation Implement cmGlobalGenerator::ComputeTargetObjects in the VS generator to pre-compute all the object file names. Use the results during generation instead of re-computing it later. --- Source/cmGeneratorTarget.h | 1 + Source/cmGlobalVisualStudioGenerator.cxx | 46 ++++++++++++++++++++- Source/cmGlobalVisualStudioGenerator.h | 2 + Source/cmLocalVisualStudio6Generator.cxx | 64 ++++++++++++++++-------------- Source/cmLocalVisualStudio6Generator.h | 1 + Source/cmLocalVisualStudio7Generator.cxx | 36 +++++++---------- Source/cmLocalVisualStudio7Generator.h | 6 +-- Source/cmLocalVisualStudioGenerator.cxx | 63 ----------------------------- Source/cmLocalVisualStudioGenerator.h | 8 +--- Source/cmVisualStudio10TargetGenerator.cxx | 13 ++---- 10 files changed, 104 insertions(+), 136 deletions(-) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 976cac4..2bfc037 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -41,6 +41,7 @@ public: std::string ModuleDefinitionFile; std::map Objects; + std::set ExplicitObjectName; private: void ClassifySources(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 449d090..e5a9784 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -12,8 +12,10 @@ #include "cmGlobalVisualStudioGenerator.h" #include "cmCallVisualStudioMacro.h" -#include "cmLocalGenerator.h" +#include "cmGeneratorTarget.h" +#include "cmLocalVisualStudioGenerator.h" #include "cmMakefile.h" +#include "cmSourceFile.h" #include "cmTarget.h" //---------------------------------------------------------------------------- @@ -98,6 +100,48 @@ void cmGlobalVisualStudioGenerator::Generate() } //---------------------------------------------------------------------------- +void +cmGlobalVisualStudioGenerator +::ComputeTargetObjects(cmGeneratorTarget* gt) const +{ + cmLocalVisualStudioGenerator* lg = + static_cast(gt->LocalGenerator); + std::string dir_max = lg->ComputeLongestObjectDirectory(*gt->Target); + + // Count the number of object files with each name. Note that + // windows file names are not case sensitive. + std::map counts; + for(std::vector::const_iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectNameLower = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectNameLower += ".obj"; + counts[objectNameLower] += 1; + } + + // For all source files producing duplicate names we need unique + // object name computation. + for(std::vector::const_iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += ".obj"; + if(counts[cmSystemTools::LowerCase(objectName)] > 1) + { + gt->ExplicitObjectName.insert(sf); + objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); + } + gt->Objects[sf] = objectName; + } +} + +//---------------------------------------------------------------------------- bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, const std::string& regKeyBase, std::string& nextAvailableSubKeyName); diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index bc96f4e..b62ba22 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -97,6 +97,8 @@ protected: typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; private: + void ComputeTargetObjects(cmGeneratorTarget* gt) const; + void FollowLinkDepends(cmTarget* target, std::set& linked); class TargetSetMap: public std::map {}; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 678c5bf..8f5f111 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -15,6 +15,7 @@ #include "cmSystemTools.h" #include "cmSourceFile.h" #include "cmCacheManager.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -336,9 +337,6 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, } } - // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(classes); - // Write the DSP file's header. this->WriteDSPHeader(fout, libName, target, sourceGroups); @@ -358,6 +356,8 @@ void cmLocalVisualStudio6Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, std::ostream &fout, const char *libName) { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); const std::vector &sourceFiles = sg->GetSourceFiles(); // If the group is empty, don't write it at all. @@ -374,28 +374,6 @@ void cmLocalVisualStudio6Generator this->WriteDSPBeginGroup(fout, name.c_str(), ""); } - // Compute the maximum length configuration name. - std::string config_max; - for(std::vector::iterator i = this->Configurations.begin(); - i != this->Configurations.end(); ++i) - { - // Strip the subdirectory name out of the configuration name. - std::string config = this->GetConfigName(*i); - if(config.size() > config_max.size()) - { - config_max = config; - } - } - - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += config_max; - dir_max += "/"; - // Loop through each source in the source group. for(std::vector::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) @@ -406,11 +384,9 @@ void cmLocalVisualStudio6Generator std::string compileFlags; std::vector depends; std::string objectNameDir; - if(this->NeedObjectName.find(*sf) != this->NeedObjectName.end()) + if(gt->ExplicitObjectName.find(*sf) != gt->ExplicitObjectName.end()) { - objectNameDir = - cmSystemTools::GetFilenamePath( - this->GetObjectFileNameWithoutTarget(*(*sf), dir_max)); + objectNameDir = cmSystemTools::GetFilenamePath(gt->Objects[*sf]); } // Add per-source file flags. @@ -1795,6 +1771,36 @@ cmLocalVisualStudio6Generator return ""; } +//---------------------------------------------------------------------------- +std::string +cmLocalVisualStudio6Generator +::ComputeLongestObjectDirectory(cmTarget&) const +{ + // Compute the maximum length configuration name. + std::string config_max; + for(std::vector::const_iterator + i = this->Configurations.begin(); + i != this->Configurations.end(); ++i) + { + // Strip the subdirectory name out of the configuration name. + std::string config = this->GetConfigName(*i); + if(config.size() > config_max.size()) + { + config_max = config; + } + } + + // Compute the maximum length full path to the intermediate + // files directory for any configuration. This is used to construct + // object file names that do not produce paths that are too long. + std::string dir_max; + dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += config_max; + dir_max += "/"; + return dir_max; +} + std::string cmLocalVisualStudio6Generator ::GetConfigName(std::string const& configuration) const diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 4e588c3..d36d633 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -50,6 +50,7 @@ public: void SetBuildType(BuildType, const char* libName, cmTarget&); virtual std::string GetTargetDirectory(cmTarget const& target) const; + virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; private: std::string DSPHeaderTemplate; std::string DSPFooterTemplate; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index c5714cc..ee54433 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -17,6 +17,7 @@ #include "cmSystemTools.h" #include "cmSourceFile.h" #include "cmCacheManager.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -1310,9 +1311,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, sourceGroup.AssignSource(*i); } - // Compute which sources need unique object computation. - this->ComputeObjectNameRequirements(classes); - // open the project this->WriteProjectStart(fout, libName, target, sourceGroups); // write the configuration information @@ -1352,8 +1350,7 @@ public: cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, cmTarget& target, cmSourceFile const& sf, - std::vector* configs, - std::string const& dir_max); + std::vector* configs); std::map FileConfigMap; }; @@ -1361,13 +1358,14 @@ cmLocalVisualStudio7GeneratorFCInfo ::cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, cmTarget& target, cmSourceFile const& sf, - std::vector* configs, - std::string const& dir_max) + std::vector* configs) { + cmGeneratorTarget* gt = + lg->GetGlobalGenerator()->GetGeneratorTarget(&target); std::string objectName; - if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end()) + if(gt->ExplicitObjectName.find(&sf) != gt->ExplicitObjectName.end()) { - objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max); + objectName = gt->Objects[&sf]; } // Compute per-source, per-config information. @@ -1478,11 +1476,11 @@ cmLocalVisualStudio7GeneratorFCInfo } } - -void cmLocalVisualStudio7Generator -::ComputeMaxDirectoryLength(std::string& maxdir, - cmTarget& target) -{ +//---------------------------------------------------------------------------- +std::string +cmLocalVisualStudio7Generator +::ComputeLongestObjectDirectory(cmTarget& target) const +{ std::vector *configs = static_cast (this->GlobalGenerator)->GetConfigurations(); @@ -1507,7 +1505,7 @@ void cmLocalVisualStudio7Generator dir_max += "/"; dir_max += config_max; dir_max += "/"; - maxdir = dir_max; + return dir_max; } void cmLocalVisualStudio7Generator @@ -1530,19 +1528,13 @@ void cmLocalVisualStudio7Generator this->WriteVCProjBeginGroup(fout, name.c_str(), ""); } - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - std::string dir_max; - this->ComputeMaxDirectoryLength(dir_max, target); - // Loop through each source in the source group. std::string objectName; for(std::vector::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); ++sf) { std::string source = (*sf)->GetFullPath(); - FCInfo fcinfo(this, target, *(*sf), configs, dir_max); + FCInfo fcinfo(this, target, *(*sf), configs); if (source != libName || target.GetType() == cmTarget::UTILITY || target.GetType() == cmTarget::GLOBAL_TARGET ) diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 6ddf82a..9d3a9f2 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -60,11 +60,7 @@ public: virtual std::string GetTargetDirectory(cmTarget const&) const; cmSourceFile* CreateVCProjBuildRule(); void WriteStampFiles(); - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - void ComputeMaxDirectoryLength(std::string& maxdir, - cmTarget& target); + virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; virtual void ReadAndStoreExternalGUID(const char* name, const char* path); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index f389b35..4bcf4de 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -65,69 +65,6 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, } //---------------------------------------------------------------------------- -bool cmLocalVisualStudioGenerator::SourceFileCompiles(const cmSourceFile* sf) -{ - // Identify the language of the source file. - if(const char* lang = this->GetSourceFileLanguage(*sf)) - { - // Check whether this source will actually be compiled. - return (!sf->GetCustomCommand() && - !sf->GetPropertyAsBool("HEADER_FILE_ONLY") && - !sf->GetPropertyAsBool("EXTERNAL_OBJECT")); - } - else - { - // Unknown source file language. Assume it will not be compiled. - return false; - } -} - -//---------------------------------------------------------------------------- -void -cmLocalVisualStudioGenerator::ComputeObjectNameRequirements( - std::vector const& sources - ) -{ - // Clear the current set of requirements. - this->NeedObjectName.clear(); - - // Count the number of object files with each name. Note that - // windows file names are not case sensitive. - std::map counts; - for(std::vector::const_iterator s = sources.begin(); - s != sources.end(); ++s) - { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) - { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension( - sf->GetFullPath())); - objectName += ".obj"; - counts[objectName] += 1; - } - } - - // For all source files producing duplicate names we need unique - // object name computation. - for(std::vector::const_iterator s = sources.begin(); - s != sources.end(); ++s) - { - const cmSourceFile* sf = *s; - if(this->SourceFileCompiles(sf)) - { - std::string objectName = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectName += ".obj"; - if(counts[objectName] > 1) - { - this->NeedObjectName.insert(sf); - } - } - } -} - -//---------------------------------------------------------------------------- const char* cmLocalVisualStudioGenerator::ReportErrorLabel() const { return ":VCReportError"; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index e58c757..410cc9a 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -56,6 +56,8 @@ public: /** Version of Visual Studio. */ VSVersion GetVersion() const { return this->Version; } + virtual std::string ComputeLongestObjectDirectory(cmTarget&) const = 0; + protected: virtual const char* ReportErrorLabel() const; virtual bool CustomCommandUseLocal() const { return false; } @@ -64,12 +66,6 @@ protected: cmsys::auto_ptr MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran); - // Safe object file name generation. - void ComputeObjectNameRequirements(std::vector const&); - bool SourceFileCompiles(const cmSourceFile* sf); - std::set NeedObjectName; - friend class cmVisualStudio10TargetGenerator; - VSVersion Version; }; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9168818..b5794d6 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -72,8 +72,6 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); - this->LocalGenerator - ->ComputeObjectNameRequirements(target->GetSourceFiles()); this->BuildFileStream = 0; } @@ -883,16 +881,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile& sf = *source; cmLocalVisualStudio7Generator* lg = this->LocalGenerator; - // Compute the maximum length full path to the intermediate - // files directory for any configuration. This is used to construct - // object file names that do not produce paths that are too long. - std::string dir_max; - lg->ComputeMaxDirectoryLength(dir_max, *this->Target); - std::string objectName; - if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end()) + if(this->GeneratorTarget->ExplicitObjectName.find(&sf) + != this->GeneratorTarget->ExplicitObjectName.end()) { - objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max); + objectName = this->GeneratorTarget->Objects[&sf]; } std::string flags; std::string defines; -- cgit v0.12 From 46f49406759423dcc6f4050c9ad83c7167bd4dfc Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 8 Mar 2012 10:13:30 -0500 Subject: Remove unused cmSourceGroup method The non-const GetSourceFiles method is not needed. --- Source/cmSourceGroup.cxx | 6 ------ Source/cmSourceGroup.h | 1 - 2 files changed, 7 deletions(-) diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 19ae8fc..2b34f2b 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -120,12 +120,6 @@ const std::vector& cmSourceGroup::GetSourceFiles() const } //---------------------------------------------------------------------------- -std::vector& cmSourceGroup::GetSourceFiles() -{ - return this->SourceFiles; -} - -//---------------------------------------------------------------------------- void cmSourceGroup::AddChild(cmSourceGroup child) { this->Internal->GroupChildren.push_back(child); diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 71ccb51..641dcbd 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -100,7 +100,6 @@ public: * source group. */ const std::vector& GetSourceFiles() const; - std::vector& GetSourceFiles(); std::vector const& GetGroupChildren() const; private: -- cgit v0.12 From 9c0a00d6dd6e7419eba61bcac30bdd0715b8b2cd Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 8 Mar 2012 16:18:55 -0500 Subject: Rename/constify build-time config placeholder lookup Rename cmGlobalGenerator::GetCMakeCFG{InitDirectory => IntDir} to have a shorter name without a typo. Add a 'const' qualifier since the method is only for lookup and never needs to modify anything. --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d7ba8b6..545f9e8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1769,7 +1769,7 @@ void cmGlobalGenerator::SetCMakeInstance(cmake* cm) void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); - const char* cmakeCfgIntDir = this->GetCMakeCFGInitDirectory(); + const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir(); const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); // CPack diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index e818e37..80b948b 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -184,7 +184,7 @@ public: const char* GetLanguageOutputExtension(cmSourceFile const&); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory() { return "."; } + virtual const char* GetCMakeCFGIntDir() const { return "."; } /** Get whether the generator should use a script for link commands. */ bool GetUseLinkScript() const { return this->UseLinkScript; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 18b483d..750b89c 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -72,7 +72,7 @@ public: * Studio? */ virtual std::string GetUserMacrosRegKeyBase(); - virtual const char* GetCMakeCFGInitDirectory() + virtual const char* GetCMakeCFGIntDir() const { return "$(Configuration)";} bool Find64BitTools(cmMakefile* mf); protected: diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 77d5370..da08a12 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -82,7 +82,7 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory() { return "$(IntDir)"; } + virtual const char* GetCMakeCFGIntDir() const { return "$(IntDir)"; } protected: virtual const char* GetIDEVersion() { return "6.0"; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index adfb757..c92998e 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -87,7 +87,7 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; } + virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; } /** Return true if the target project file should have the option LinkLibraryDependencies and link to .sln dependencies. */ diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e552928..a6a9200 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3283,7 +3283,7 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, } //---------------------------------------------------------------------------- -const char* cmGlobalXCodeGenerator::GetCMakeCFGInitDirectory() +const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const { return this->XcodeVersion >= 21 ? "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" : "."; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 45f62eb..b9cf775 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -74,7 +74,7 @@ public: std::string& dir); ///! What is the configurations directory variable called? - virtual const char* GetCMakeCFGInitDirectory(); + virtual const char* GetCMakeCFGIntDir() const; void SetCurrentLocalGenerator(cmLocalGenerator*); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f90c35c..68a8272 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -945,7 +945,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, outName += ".rule"; const char* dir = this->LocalGenerator->GetGlobalGenerator()-> - GetCMakeCFGInitDirectory(); + GetCMakeCFGIntDir(); if(dir && dir[0] == '$') { cmSystemTools::ReplaceString(outName, dir, @@ -2865,7 +2865,7 @@ void cmMakefile::EnableLanguage(std::vector const & lang, { this->AddDefinition("CMAKE_CFG_INTDIR", this->LocalGenerator->GetGlobalGenerator() - ->GetCMakeCFGInitDirectory()); + ->GetCMakeCFGIntDir()); this->LocalGenerator->GetGlobalGenerator()->EnableLanguage(lang, this, optional); } -- cgit v0.12 From 42a81e7119fab94afcb0c87f93c314af1689e1f7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 Mar 2012 16:24:43 -0500 Subject: Add stronger infrastructure for CMake-only tests The CMakeOnly directory added by commit 9a20abf0 (Add infrastructure for CMake-only tests, 2012-01-11) was sufficient only for tests that always run CMake to successfully configure a project. Later commit eeaaffcb (find_package: Test error and warning messages in failure cases, 2012-02-28) added a sample test that covers failure cases. Generalize the above to create new "RunCMake" test infrastructure that can run CMake multiple times for a single project with different variations and check for expected result/stdout/stderr. Allow for both successful and failing CMake project configuration cases. This will be useful to test error messages and failure behavior. --- Tests/CMakeLists.txt | 1 + Tests/README | 13 +++++--- Tests/RunCMake/CMakeLists.txt | 41 +++++++++++++++++++++++++ Tests/RunCMake/RunCMake.cmake | 69 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 Tests/RunCMake/CMakeLists.txt create mode 100644 Tests/RunCMake/RunCMake.cmake diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 07a6c36..0eb4859 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -54,6 +54,7 @@ IF(BUILD_TESTING) ADD_SUBDIRECTORY(CMakeLib) ADD_SUBDIRECTORY(CMakeOnly) ADD_SUBDIRECTORY(CMakeCommands) + ADD_SUBDIRECTORY(RunCMake) ADD_SUBDIRECTORY(FindPackageModeMakefileTest) diff --git a/Tests/README b/Tests/README index 9b0f5c1..8b2fda8 100644 --- a/Tests/README +++ b/Tests/README @@ -16,10 +16,15 @@ your test to the test runs. This includes tests that will build something using try_compile() and friends, but nothing that expects add_executable(), add_library(), or add_test() to run. -If this matches your test you should put it into the Tests/CMakeOnly/ directory. -Create a subdirectory named like your test and write the CMakeLists.txt you -need into that subdirectory. Use the add_CMakeOnly_test() macro from -Tests/CMakeOnly/CMakeLists.txt to add your test to the test runs. +If the test configures the project only once and it must succeed then put it +into the Tests/CMakeOnly/ directory. Create a subdirectory named like your +test and write the CMakeLists.txt you need into that subdirectory. Use the +add_CMakeOnly_test() macro from Tests/CMakeOnly/CMakeLists.txt to add your +test to the test runs. + +If the test configures the project with multiple variations and verifies +success or failure each time then put it into the Tests/RunCMake/ directory. +Read the instructions in Tests/RunCMake/CMakeLists.txt to add a test. 3. If you are testing something from the Modules directory diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt new file mode 100644 index 0000000..5f10bd7 --- /dev/null +++ b/Tests/RunCMake/CMakeLists.txt @@ -0,0 +1,41 @@ +# This directory contains tests that run CMake to configure a project +# but do not actually build anything. To add a test: +# +# 1.) Add a subdirectory named for the test. +# +# 2.) Call add_RunCMake_test and pass the test directory name. +# +# 3.) Create a RunCMakeTest.cmake script in the directory containing +# include(RunCMake) +# run_cmake(SubTest1) +# ... +# run_cmake(SubTestN) +# where SubTest1..SubTestN are sub-test names each corresponding to +# an independent CMake run and project configuration. +# +# 3.) Create a CMakeLists.txt file in the directory containing +# cmake_minimum_required(...) +# project(${RunCMake_TEST} NONE) # or languages needed +# include(${RunCMake_TEST}.cmake) +# where "${RunCMake_TEST}" is literal. A value for RunCMake_TEST +# will be passed to CMake by the run_cmake macro when running each +# sub-test. +# +# 4.) Create a .cmake file for each sub-test named above +# containing the actual test code. Optionally create files +# containing expected test results: +# -result.txt = Process result expected if not "0" +# -stdout.txt = Regex matching expected stdout content +# -stderr.txt = Regex matching expected stderr content +# Note that trailing newlines will be stripped from actual test +# output before matching against the stdout and stderr expressions. + +macro(add_RunCMake_test test) + add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} + -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ) +endmacro() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake new file mode 100644 index 0000000..2639463 --- /dev/null +++ b/Tests/RunCMake/RunCMake.cmake @@ -0,0 +1,69 @@ +foreach(arg + RunCMake_GENERATOR + RunCMake_SOURCE_DIR + RunCMake_BINARY_DIR + ) + if(NOT DEFINED ${arg}) + message(FATAL_ERROR "${arg} not given!") + endif() +endforeach() + +function(run_cmake test) + set(top_src "${RunCMake_SOURCE_DIR}") + set(top_bin "${RunCMake_BINARY_DIR}") + if(EXISTS ${top_src}/${test}-result.txt) + file(READ ${top_src}/${test}-result.txt expect_result) + string(REGEX REPLACE "\n+$" "" expect_result "${expect_result}") + else() + set(expect_result 0) + endif() + foreach(o out err) + if(EXISTS ${top_src}/${test}-std${o}.txt) + file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) + string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") + else() + unset(expect_std${o}) + endif() + endforeach() + set(source_dir "${top_src}") + set(binary_dir "${top_bin}/${test}-build") + file(REMOVE_RECURSE "${binary_dir}") + file(MAKE_DIRECTORY "${binary_dir}") + execute_process( + COMMAND ${CMAKE_COMMAND} "${source_dir}" + -G "${RunCMake_GENERATOR}" -DRunCMake_TEST=${test} + WORKING_DIRECTORY "${binary_dir}" + OUTPUT_VARIABLE actual_stdout + ERROR_VARIABLE actual_stderr + RESULT_VARIABLE actual_result + ) + set(msg "") + if(NOT "${actual_result}" STREQUAL "${expect_result}") + set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") + endif() + foreach(o out err) + string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") + set(expect_${o} "") + if(DEFINED expect_std${o}) + if(NOT "${actual_std${o}}" MATCHES "${expect_std${o}}") + string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} + " expect-${o}> ${expect_std${o}}") + set(expect_${o} "Expected std${o} to match:\n${expect_${o}}\n") + set(msg "${msg}std${o} does not match that expected.\n") + endif() + endif() + endforeach() + if(msg) + string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") + string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}") + message(SEND_ERROR "${test} - FAILED:\n" + "${msg}" + "${expect_out}" + "Actual stdout:\n${actual_out}\n" + "${expect_err}" + "Actual stderr:\n${actual_err}\n" + ) + else() + message(STATUS "${test} - PASSED") + endif() +endfunction() -- cgit v0.12 From eb33000d75e0e41a2412db9a75597dbee6bfdad6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 Mar 2012 16:34:09 -0500 Subject: Use generalized RunCMake test infrastrucure for find_package test --- Tests/CMakeCommands/CMakeLists.txt | 1 - Tests/CMakeCommands/find_package/CMakeLists.txt | 3 - .../find_package/MissingConfig-stderr.txt | 19 ----- .../CMakeCommands/find_package/MissingConfig.cmake | 2 - .../find_package/MissingConfigOneName-stderr.txt | 10 --- .../find_package/MissingConfigOneName.cmake | 1 - .../find_package/MissingConfigRequired-result.txt | 1 - .../find_package/MissingConfigRequired-stderr.txt | 13 ---- .../find_package/MissingConfigRequired.cmake | 2 - .../find_package/MissingConfigVersion-stderr.txt | 13 ---- .../find_package/MissingConfigVersion.cmake | 1 - .../find_package/MissingModule-stderr.txt | 26 ------- .../CMakeCommands/find_package/MissingModule.cmake | 2 - .../find_package/MissingModuleRequired-result.txt | 1 - .../find_package/MissingModuleRequired-stderr.txt | 21 ------ .../find_package/MissingModuleRequired.cmake | 2 - .../find_package/MissingNormal-stderr.txt | 23 ------- .../CMakeCommands/find_package/MissingNormal.cmake | 2 - .../find_package/MissingNormalRequired-result.txt | 1 - .../find_package/MissingNormalRequired-stderr.txt | 17 ----- .../find_package/MissingNormalRequired.cmake | 2 - .../find_package/MissingNormalVersion-stderr.txt | 17 ----- .../find_package/MissingNormalVersion.cmake | 1 - .../MissingNormalWarnNoModuleNew-stderr.txt | 30 -------- .../MissingNormalWarnNoModuleNew.cmake | 3 - .../MissingNormalWarnNoModuleOld-stderr.txt | 29 -------- .../MissingNormalWarnNoModuleOld.cmake | 2 - .../find_package/MixedModeOptions-result.txt | 1 - .../find_package/MixedModeOptions-stderr.txt | 14 ---- .../find_package/MixedModeOptions.cmake | 1 - Tests/CMakeCommands/find_package/test.cmake | 80 ---------------------- Tests/RunCMake/CMakeLists.txt | 2 + Tests/RunCMake/find_package/CMakeLists.txt | 3 + .../RunCMake/find_package/MissingConfig-stderr.txt | 19 +++++ Tests/RunCMake/find_package/MissingConfig.cmake | 2 + .../find_package/MissingConfigOneName-stderr.txt | 10 +++ .../find_package/MissingConfigOneName.cmake | 1 + .../find_package/MissingConfigRequired-result.txt | 1 + .../find_package/MissingConfigRequired-stderr.txt | 13 ++++ .../find_package/MissingConfigRequired.cmake | 2 + .../find_package/MissingConfigVersion-stderr.txt | 13 ++++ .../find_package/MissingConfigVersion.cmake | 1 + .../RunCMake/find_package/MissingModule-stderr.txt | 26 +++++++ Tests/RunCMake/find_package/MissingModule.cmake | 2 + .../find_package/MissingModuleRequired-result.txt | 1 + .../find_package/MissingModuleRequired-stderr.txt | 21 ++++++ .../find_package/MissingModuleRequired.cmake | 2 + .../RunCMake/find_package/MissingNormal-stderr.txt | 23 +++++++ Tests/RunCMake/find_package/MissingNormal.cmake | 2 + .../find_package/MissingNormalRequired-result.txt | 1 + .../find_package/MissingNormalRequired-stderr.txt | 17 +++++ .../find_package/MissingNormalRequired.cmake | 2 + .../find_package/MissingNormalVersion-stderr.txt | 17 +++++ .../find_package/MissingNormalVersion.cmake | 1 + .../MissingNormalWarnNoModuleNew-stderr.txt | 30 ++++++++ .../MissingNormalWarnNoModuleNew.cmake | 3 + .../MissingNormalWarnNoModuleOld-stderr.txt | 29 ++++++++ .../MissingNormalWarnNoModuleOld.cmake | 2 + .../find_package/MixedModeOptions-result.txt | 1 + .../find_package/MixedModeOptions-stderr.txt | 14 ++++ Tests/RunCMake/find_package/MixedModeOptions.cmake | 1 + Tests/RunCMake/find_package/RunCMakeTest.cmake | 14 ++++ 62 files changed, 276 insertions(+), 341 deletions(-) delete mode 100644 Tests/CMakeCommands/find_package/CMakeLists.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingConfig-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingConfig.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigOneName.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigRequired.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingConfigVersion.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingModule-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingModule.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingModuleRequired.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingNormal-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingNormal.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalRequired.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalVersion.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake delete mode 100644 Tests/CMakeCommands/find_package/MixedModeOptions-result.txt delete mode 100644 Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt delete mode 100644 Tests/CMakeCommands/find_package/MixedModeOptions.cmake delete mode 100644 Tests/CMakeCommands/find_package/test.cmake create mode 100644 Tests/RunCMake/find_package/CMakeLists.txt create mode 100644 Tests/RunCMake/find_package/MissingConfig-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingConfig.cmake create mode 100644 Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingConfigOneName.cmake create mode 100644 Tests/RunCMake/find_package/MissingConfigRequired-result.txt create mode 100644 Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingConfigRequired.cmake create mode 100644 Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingConfigVersion.cmake create mode 100644 Tests/RunCMake/find_package/MissingModule-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingModule.cmake create mode 100644 Tests/RunCMake/find_package/MissingModuleRequired-result.txt create mode 100644 Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingModuleRequired.cmake create mode 100644 Tests/RunCMake/find_package/MissingNormal-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingNormal.cmake create mode 100644 Tests/RunCMake/find_package/MissingNormalRequired-result.txt create mode 100644 Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingNormalRequired.cmake create mode 100644 Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingNormalVersion.cmake create mode 100644 Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake create mode 100644 Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt create mode 100644 Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake create mode 100644 Tests/RunCMake/find_package/MixedModeOptions-result.txt create mode 100644 Tests/RunCMake/find_package/MixedModeOptions-stderr.txt create mode 100644 Tests/RunCMake/find_package/MixedModeOptions.cmake create mode 100644 Tests/RunCMake/find_package/RunCMakeTest.cmake diff --git a/Tests/CMakeCommands/CMakeLists.txt b/Tests/CMakeCommands/CMakeLists.txt index aa400d0..e9e4020 100644 --- a/Tests/CMakeCommands/CMakeLists.txt +++ b/Tests/CMakeCommands/CMakeLists.txt @@ -8,4 +8,3 @@ macro(add_CMakeCommands_test test) endmacro() add_CMakeCommands_test(build_command) -add_CMakeCommands_test(find_package) diff --git a/Tests/CMakeCommands/find_package/CMakeLists.txt b/Tests/CMakeCommands/find_package/CMakeLists.txt deleted file mode 100644 index c2deed0..0000000 --- a/Tests/CMakeCommands/find_package/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(${TEST} NONE) -include(${TEST}.cmake) diff --git a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt deleted file mode 100644 index 1eae0bb..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfig-stderr.txt +++ /dev/null @@ -1,19 +0,0 @@ -CMake Warning at MissingConfig.cmake:1 \(find_package\): - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - -CMake Warning at MissingConfig.cmake:2 \(message\): - This warning must be reachable. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingConfig.cmake b/Tests/CMakeCommands/find_package/MissingConfig.cmake deleted file mode 100644 index 238e7e4..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfig.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(NotHere CONFIG) -message(WARNING "This warning must be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt deleted file mode 100644 index 10e71fa..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigOneName-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -CMake Warning at MissingConfigOneName.cmake:1 \(find_package\): - Could not find a package configuration file named "NotHereConfig.cmake" - provided by package "NotHere". - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingConfigOneName.cmake b/Tests/CMakeCommands/find_package/MissingConfigOneName.cmake deleted file mode 100644 index 11676a9..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigOneName.cmake +++ /dev/null @@ -1 +0,0 @@ -find_package(NotHere CONFIGS NotHereConfig.cmake) diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt b/Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigRequired-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt deleted file mode 100644 index 2ba774a..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigRequired-stderr.txt +++ /dev/null @@ -1,13 +0,0 @@ -CMake Error at MissingConfigRequired.cmake:1 \(find_package\): - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake b/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake deleted file mode 100644 index 0ae6702..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigRequired.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(NotHere CONFIG REQUIRED) -message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt b/Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt deleted file mode 100644 index 2f5086e..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigVersion-stderr.txt +++ /dev/null @@ -1,13 +0,0 @@ -CMake Warning at MissingConfigVersion.cmake:1 \(find_package\): - Could not find a package configuration file provided by "NotHere" - \(requested version 1\.2\) with any of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingConfigVersion.cmake b/Tests/CMakeCommands/find_package/MissingConfigVersion.cmake deleted file mode 100644 index ac35a79..0000000 --- a/Tests/CMakeCommands/find_package/MissingConfigVersion.cmake +++ /dev/null @@ -1 +0,0 @@ -find_package(NotHere 1.2 CONFIG) diff --git a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt b/Tests/CMakeCommands/find_package/MissingModule-stderr.txt deleted file mode 100644 index 2ad460f..0000000 --- a/Tests/CMakeCommands/find_package/MissingModule-stderr.txt +++ /dev/null @@ -1,26 +0,0 @@ -CMake Warning at MissingModule.cmake:1 \(find_package\): - No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - -CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\): - FindNotHere.cmake must either be part of this project itself, in this case - adjust CMAKE_MODULE_PATH so that it points to the correct location inside - its source tree. - - Or it must be installed by a package which has already been found via - find_package\(\). In this case make sure that package has indeed been found - and adjust CMAKE_MODULE_PATH to contain the location where that package has - installed FindNotHere.cmake. This must be a location provided by that - package. This error in general means that the buildsystem of this project - is relying on a Find-module without ensuring that it is actually available. - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning at MissingModule.cmake:2 \(message\): - This warning must be reachable. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingModule.cmake b/Tests/CMakeCommands/find_package/MissingModule.cmake deleted file mode 100644 index 76bcef2..0000000 --- a/Tests/CMakeCommands/find_package/MissingModule.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(NotHere MODULE) -message(WARNING "This warning must be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt b/Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/CMakeCommands/find_package/MissingModuleRequired-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt deleted file mode 100644 index fec05f1..0000000 --- a/Tests/CMakeCommands/find_package/MissingModuleRequired-stderr.txt +++ /dev/null @@ -1,21 +0,0 @@ -CMake Error at MissingModuleRequired.cmake:1 \(find_package\): - No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - -CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\): - FindNotHere.cmake must either be part of this project itself, in this case - adjust CMAKE_MODULE_PATH so that it points to the correct location inside - its source tree. - - Or it must be installed by a package which has already been found via - find_package\(\). In this case make sure that package has indeed been found - and adjust CMAKE_MODULE_PATH to contain the location where that package has - installed FindNotHere.cmake. This must be a location provided by that - package. This error in general means that the buildsystem of this project - is relying on a Find-module without ensuring that it is actually available. - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake b/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake deleted file mode 100644 index 897eda6..0000000 --- a/Tests/CMakeCommands/find_package/MissingModuleRequired.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(NotHere MODULE REQUIRED) -message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt deleted file mode 100644 index f4c6fba..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormal-stderr.txt +++ /dev/null @@ -1,23 +0,0 @@ -CMake Warning at MissingNormal.cmake:1 \(find_package\): - By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has - asked CMake to find a package configuration file provided by "NotHere", but - CMake did not find one. - - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) - - -CMake Warning at MissingNormal.cmake:2 \(message\): - This warning must be reachable. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingNormal.cmake b/Tests/CMakeCommands/find_package/MissingNormal.cmake deleted file mode 100644 index fb90e01..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormal.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(NotHere) -message(WARNING "This warning must be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt b/Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalRequired-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt deleted file mode 100644 index 7bb7902..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalRequired-stderr.txt +++ /dev/null @@ -1,17 +0,0 @@ -CMake Error at MissingNormalRequired.cmake:1 \(find_package\): - By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has - asked CMake to find a package configuration file provided by "NotHere", but - CMake did not find one. - - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ diff --git a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake b/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake deleted file mode 100644 index 33353d8..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalRequired.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(NotHere REQUIRED) -message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt deleted file mode 100644 index 36de800..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalVersion-stderr.txt +++ /dev/null @@ -1,17 +0,0 @@ -CMake Warning at MissingNormalVersion.cmake:1 \(find_package\): - By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has - asked CMake to find a package configuration file provided by "NotHere", but - CMake did not find one. - - Could not find a package configuration file provided by "NotHere" - \(requested version 1\.2\) with any of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalVersion.cmake b/Tests/CMakeCommands/find_package/MissingNormalVersion.cmake deleted file mode 100644 index 2d9ce4e..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalVersion.cmake +++ /dev/null @@ -1 +0,0 @@ -find_package(NotHere 1.2) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt deleted file mode 100644 index d34f23c..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew-stderr.txt +++ /dev/null @@ -1,30 +0,0 @@ -CMake Warning \(dev\) at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\): - find_package called without either MODULE or CONFIG option and no - FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to - exclusively request Module mode and fail if FindNotHere.cmake is missing. - Add CONFIG to exclusively request Config mode and search for a package - configuration file provided by NotHere \(NotHereConfig.cmake or - nothere-config.cmake\). - - \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\): - By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has - asked CMake to find a package configuration file provided by "NotHere", but - CMake did not find one. - - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake deleted file mode 100644 index 0211249..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleNew.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1) -set(CMAKE_MINIMUM_REQUIRED_VERSION 2.8.8) -find_package(NotHere) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt deleted file mode 100644 index b336b56..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld-stderr.txt +++ /dev/null @@ -1,29 +0,0 @@ -CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): - find_package called without NO_MODULE option and no FindNotHere.cmake - module is in CMAKE_MODULE_PATH. Add NO_MODULE to exclusively request - Config mode and search for a package configuration file provided by NotHere - \(NotHereConfig.cmake or nothere-config.cmake\). Otherwise make - FindNotHere.cmake available in CMAKE_MODULE_PATH. - - \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): - By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has - asked CMake to find a package configuration file provided by "NotHere", but - CMake did not find one. - - Could not find a package configuration file provided by "NotHere" with any - of the following names: - - NotHereConfig.cmake - nothere-config.cmake - - Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set - "NotHere_DIR" to a directory containing one of the above files. If - "NotHere" provides a separate development package or SDK, be sure it has - been installed. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake b/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake deleted file mode 100644 index 1c4a775..0000000 --- a/Tests/CMakeCommands/find_package/MissingNormalWarnNoModuleOld.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1) -find_package(NotHere) diff --git a/Tests/CMakeCommands/find_package/MixedModeOptions-result.txt b/Tests/CMakeCommands/find_package/MixedModeOptions-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/CMakeCommands/find_package/MixedModeOptions-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt b/Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt deleted file mode 100644 index b867022..0000000 --- a/Tests/CMakeCommands/find_package/MixedModeOptions-stderr.txt +++ /dev/null @@ -1,14 +0,0 @@ -CMake Error at MixedModeOptions.cmake:1 \(find_package\): - find_package given options exclusive to Module mode: - - MODULE - - and options exclusive to Config mode: - - CONFIG - CONFIGS - NO_DEFAULT_PATH - - The options are incompatible. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/CMakeCommands/find_package/MixedModeOptions.cmake b/Tests/CMakeCommands/find_package/MixedModeOptions.cmake deleted file mode 100644 index 7f78ee0..0000000 --- a/Tests/CMakeCommands/find_package/MixedModeOptions.cmake +++ /dev/null @@ -1 +0,0 @@ -find_package(NotHere MODULE CONFIG CONFIGS NotHereConfig.cmake NO_DEFAULT_PATH) diff --git a/Tests/CMakeCommands/find_package/test.cmake b/Tests/CMakeCommands/find_package/test.cmake deleted file mode 100644 index dd1072e..0000000 --- a/Tests/CMakeCommands/find_package/test.cmake +++ /dev/null @@ -1,80 +0,0 @@ -if(NOT DEFINED dir) - message(FATAL_ERROR "dir not defined") -endif() - -if(NOT DEFINED gen) - message(FATAL_ERROR "gen not defined") -endif() - -# TODO: Generalize this for other tests. -function(run_test test) - set(top_src "${CMAKE_CURRENT_LIST_DIR}") - set(top_bin "${dir}") - if(EXISTS ${top_src}/${test}-result.txt) - file(READ ${top_src}/${test}-result.txt expect_result) - string(REGEX REPLACE "\n+$" "" expect_result "${expect_result}") - else() - set(expect_result 0) - endif() - foreach(o out err) - if(EXISTS ${top_src}/${test}-std${o}.txt) - file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) - string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") - else() - unset(expect_std${o}) - endif() - endforeach() - set(source_dir "${top_src}") - set(binary_dir "${top_bin}/${test}-build") - file(REMOVE_RECURSE "${binary_dir}") - file(MAKE_DIRECTORY "${binary_dir}") - execute_process( - COMMAND ${CMAKE_COMMAND} "${source_dir}" -G "${gen}" -DTEST=${test} - WORKING_DIRECTORY "${binary_dir}" - OUTPUT_VARIABLE actual_stdout - ERROR_VARIABLE actual_stderr - RESULT_VARIABLE actual_result - ) - set(msg "") - if(NOT "${actual_result}" STREQUAL "${expect_result}") - set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") - endif() - foreach(o out err) - string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") - set(expect_${o} "") - if(DEFINED expect_std${o}) - if(NOT "${actual_std${o}}" MATCHES "${expect_std${o}}") - string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} - " expect-${o}> ${expect_std${o}}") - set(expect_${o} "Expected std${o} to match:\n${expect_${o}}\n") - set(msg "${msg}std${o} does not match that expected.\n") - endif() - endif() - endforeach() - if(msg) - string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}") - string(REGEX REPLACE "\n" "\n actual-err> " actual_err " actual-err> ${actual_stderr}") - message(SEND_ERROR "${test} - FAILED:\n" - "${msg}" - "${expect_out}" - "Actual stdout:\n${actual_out}\n" - "${expect_err}" - "Actual stderr:\n${actual_err}\n" - ) - else() - message(STATUS "${test} - PASSED") - endif() -endfunction() - -run_test(MissingNormal) -run_test(MissingNormalRequired) -run_test(MissingNormalVersion) -run_test(MissingNormalWarnNoModuleOld) -run_test(MissingNormalWarnNoModuleNew) -run_test(MissingModule) -run_test(MissingModuleRequired) -run_test(MissingConfig) -run_test(MissingConfigOneName) -run_test(MissingConfigRequired) -run_test(MissingConfigVersion) -run_test(MixedModeOptions) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5f10bd7..2dbb08e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -39,3 +39,5 @@ macro(add_RunCMake_test test) -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" ) endmacro() + +add_RunCMake_test(find_package) diff --git a/Tests/RunCMake/find_package/CMakeLists.txt b/Tests/RunCMake/find_package/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/find_package/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_package/MissingConfig-stderr.txt b/Tests/RunCMake/find_package/MissingConfig-stderr.txt new file mode 100644 index 0000000..1eae0bb --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfig-stderr.txt @@ -0,0 +1,19 @@ +CMake Warning at MissingConfig.cmake:1 \(find_package\): + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning at MissingConfig.cmake:2 \(message\): + This warning must be reachable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/find_package/MissingConfig.cmake b/Tests/RunCMake/find_package/MissingConfig.cmake new file mode 100644 index 0000000..238e7e4 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfig.cmake @@ -0,0 +1,2 @@ +find_package(NotHere CONFIG) +message(WARNING "This warning must be reachable.") diff --git a/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt b/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt new file mode 100644 index 0000000..10e71fa --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigOneName-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning at MissingConfigOneName.cmake:1 \(find_package\): + Could not find a package configuration file named "NotHereConfig.cmake" + provided by package "NotHere". + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingConfigOneName.cmake b/Tests/RunCMake/find_package/MissingConfigOneName.cmake new file mode 100644 index 0000000..11676a9 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigOneName.cmake @@ -0,0 +1 @@ +find_package(NotHere CONFIGS NotHereConfig.cmake) diff --git a/Tests/RunCMake/find_package/MissingConfigRequired-result.txt b/Tests/RunCMake/find_package/MissingConfigRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt b/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt new file mode 100644 index 0000000..2ba774a --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at MissingConfigRequired.cmake:1 \(find_package\): + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/find_package/MissingConfigRequired.cmake b/Tests/RunCMake/find_package/MissingConfigRequired.cmake new file mode 100644 index 0000000..0ae6702 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigRequired.cmake @@ -0,0 +1,2 @@ +find_package(NotHere CONFIG REQUIRED) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt b/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt new file mode 100644 index 0000000..2f5086e --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigVersion-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning at MissingConfigVersion.cmake:1 \(find_package\): + Could not find a package configuration file provided by "NotHere" + \(requested version 1\.2\) with any of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingConfigVersion.cmake b/Tests/RunCMake/find_package/MissingConfigVersion.cmake new file mode 100644 index 0000000..ac35a79 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingConfigVersion.cmake @@ -0,0 +1 @@ +find_package(NotHere 1.2 CONFIG) diff --git a/Tests/RunCMake/find_package/MissingModule-stderr.txt b/Tests/RunCMake/find_package/MissingModule-stderr.txt new file mode 100644 index 0000000..2ad460f --- /dev/null +++ b/Tests/RunCMake/find_package/MissingModule-stderr.txt @@ -0,0 +1,26 @@ +CMake Warning at MissingModule.cmake:1 \(find_package\): + No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\): + FindNotHere.cmake must either be part of this project itself, in this case + adjust CMAKE_MODULE_PATH so that it points to the correct location inside + its source tree. + + Or it must be installed by a package which has already been found via + find_package\(\). In this case make sure that package has indeed been found + and adjust CMAKE_MODULE_PATH to contain the location where that package has + installed FindNotHere.cmake. This must be a location provided by that + package. This error in general means that the buildsystem of this project + is relying on a Find-module without ensuring that it is actually available. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning at MissingModule.cmake:2 \(message\): + This warning must be reachable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/find_package/MissingModule.cmake b/Tests/RunCMake/find_package/MissingModule.cmake new file mode 100644 index 0000000..76bcef2 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingModule.cmake @@ -0,0 +1,2 @@ +find_package(NotHere MODULE) +message(WARNING "This warning must be reachable.") diff --git a/Tests/RunCMake/find_package/MissingModuleRequired-result.txt b/Tests/RunCMake/find_package/MissingModuleRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/MissingModuleRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt b/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt new file mode 100644 index 0000000..fec05f1 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt @@ -0,0 +1,21 @@ +CMake Error at MissingModuleRequired.cmake:1 \(find_package\): + No "FindNotHere.cmake" found in CMAKE_MODULE_PATH. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\): + FindNotHere.cmake must either be part of this project itself, in this case + adjust CMAKE_MODULE_PATH so that it points to the correct location inside + its source tree. + + Or it must be installed by a package which has already been found via + find_package\(\). In this case make sure that package has indeed been found + and adjust CMAKE_MODULE_PATH to contain the location where that package has + installed FindNotHere.cmake. This must be a location provided by that + package. This error in general means that the buildsystem of this project + is relying on a Find-module without ensuring that it is actually available. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/find_package/MissingModuleRequired.cmake b/Tests/RunCMake/find_package/MissingModuleRequired.cmake new file mode 100644 index 0000000..897eda6 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingModuleRequired.cmake @@ -0,0 +1,2 @@ +find_package(NotHere MODULE REQUIRED) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/RunCMake/find_package/MissingNormal-stderr.txt b/Tests/RunCMake/find_package/MissingNormal-stderr.txt new file mode 100644 index 0000000..f4c6fba --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormal-stderr.txt @@ -0,0 +1,23 @@ +CMake Warning at MissingNormal.cmake:1 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning at MissingNormal.cmake:2 \(message\): + This warning must be reachable. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/find_package/MissingNormal.cmake b/Tests/RunCMake/find_package/MissingNormal.cmake new file mode 100644 index 0000000..fb90e01 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormal.cmake @@ -0,0 +1,2 @@ +find_package(NotHere) +message(WARNING "This warning must be reachable.") diff --git a/Tests/RunCMake/find_package/MissingNormalRequired-result.txt b/Tests/RunCMake/find_package/MissingNormalRequired-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalRequired-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt b/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt new file mode 100644 index 0000000..7bb7902 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at MissingNormalRequired.cmake:1 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/find_package/MissingNormalRequired.cmake b/Tests/RunCMake/find_package/MissingNormalRequired.cmake new file mode 100644 index 0000000..33353d8 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalRequired.cmake @@ -0,0 +1,2 @@ +find_package(NotHere REQUIRED) +message(FATAL_ERROR "This error must not be reachable.") diff --git a/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt b/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt new file mode 100644 index 0000000..36de800 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt @@ -0,0 +1,17 @@ +CMake Warning at MissingNormalVersion.cmake:1 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" + \(requested version 1\.2\) with any of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingNormalVersion.cmake b/Tests/RunCMake/find_package/MissingNormalVersion.cmake new file mode 100644 index 0000000..2d9ce4e --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalVersion.cmake @@ -0,0 +1 @@ +find_package(NotHere 1.2) diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt new file mode 100644 index 0000000..d34f23c --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt @@ -0,0 +1,30 @@ +CMake Warning \(dev\) at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\): + find_package called without either MODULE or CONFIG option and no + FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to + exclusively request Module mode and fail if FindNotHere.cmake is missing. + Add CONFIG to exclusively request Config mode and search for a package + configuration file provided by NotHere \(NotHereConfig.cmake or + nothere-config.cmake\). + + \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake new file mode 100644 index 0000000..0211249 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake @@ -0,0 +1,3 @@ +set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1) +set(CMAKE_MINIMUM_REQUIRED_VERSION 2.8.8) +find_package(NotHere) diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt new file mode 100644 index 0000000..b336b56 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt @@ -0,0 +1,29 @@ +CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): + find_package called without NO_MODULE option and no FindNotHere.cmake + module is in CMAKE_MODULE_PATH. Add NO_MODULE to exclusively request + Config mode and search for a package configuration file provided by NotHere + \(NotHereConfig.cmake or nothere-config.cmake\). Otherwise make + FindNotHere.cmake available in CMAKE_MODULE_PATH. + + \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\): + By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has + asked CMake to find a package configuration file provided by "NotHere", but + CMake did not find one. + + Could not find a package configuration file provided by "NotHere" with any + of the following names: + + NotHereConfig.cmake + nothere-config.cmake + + Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set + "NotHere_DIR" to a directory containing one of the above files. If + "NotHere" provides a separate development package or SDK, be sure it has + been installed. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake new file mode 100644 index 0000000..1c4a775 --- /dev/null +++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake @@ -0,0 +1,2 @@ +set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1) +find_package(NotHere) diff --git a/Tests/RunCMake/find_package/MixedModeOptions-result.txt b/Tests/RunCMake/find_package/MixedModeOptions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/MixedModeOptions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt b/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt new file mode 100644 index 0000000..b867022 --- /dev/null +++ b/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt @@ -0,0 +1,14 @@ +CMake Error at MixedModeOptions.cmake:1 \(find_package\): + find_package given options exclusive to Module mode: + + MODULE + + and options exclusive to Config mode: + + CONFIG + CONFIGS + NO_DEFAULT_PATH + + The options are incompatible. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/MixedModeOptions.cmake b/Tests/RunCMake/find_package/MixedModeOptions.cmake new file mode 100644 index 0000000..7f78ee0 --- /dev/null +++ b/Tests/RunCMake/find_package/MixedModeOptions.cmake @@ -0,0 +1 @@ +find_package(NotHere MODULE CONFIG CONFIGS NotHereConfig.cmake NO_DEFAULT_PATH) diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake new file mode 100644 index 0000000..ba57f99 --- /dev/null +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -0,0 +1,14 @@ +include(RunCMake) + +run_cmake(MissingNormal) +run_cmake(MissingNormalRequired) +run_cmake(MissingNormalVersion) +run_cmake(MissingNormalWarnNoModuleOld) +run_cmake(MissingNormalWarnNoModuleNew) +run_cmake(MissingModule) +run_cmake(MissingModuleRequired) +run_cmake(MissingConfig) +run_cmake(MissingConfigOneName) +run_cmake(MissingConfigRequired) +run_cmake(MissingConfigVersion) +run_cmake(MixedModeOptions) -- cgit v0.12 From 55b2aa884cdb3df9a32152ee1df60e708d2c5ec9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 9 Mar 2012 16:47:19 -0500 Subject: Use generalized RunCMake test infrastrucure for build_command test The CMakeCommands.build_command test performs output/error checking so move it over to RunCMake to re-use the generalized infrastrucure. This is the only test left using Tests/CMakeCommands/CMakeLists.txt so remove it. --- Tests/CMakeCommands/CMakeLists.txt | 10 --- Tests/CMakeCommands/build_command/CMakeLists.txt | 58 --------------- Tests/CMakeCommands/build_command/test.cmake | 86 ----------------------- Tests/CMakeLists.txt | 1 - Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/build_command/CMakeLists.txt | 59 ++++++++++++++++ Tests/RunCMake/build_command/ErrorsOFF-stderr.txt | 1 + Tests/RunCMake/build_command/ErrorsOFF-stdout.txt | 1 + Tests/RunCMake/build_command/ErrorsOFF.cmake | 1 + Tests/RunCMake/build_command/ErrorsON-result.txt | 1 + Tests/RunCMake/build_command/ErrorsON-stderr.txt | 12 ++++ Tests/RunCMake/build_command/ErrorsON-stdout.txt | 1 + Tests/RunCMake/build_command/ErrorsON.cmake | 1 + Tests/RunCMake/build_command/RunCMakeTest.cmake | 4 ++ 14 files changed, 82 insertions(+), 155 deletions(-) delete mode 100644 Tests/CMakeCommands/CMakeLists.txt delete mode 100644 Tests/CMakeCommands/build_command/CMakeLists.txt delete mode 100644 Tests/CMakeCommands/build_command/test.cmake create mode 100644 Tests/RunCMake/build_command/CMakeLists.txt create mode 100644 Tests/RunCMake/build_command/ErrorsOFF-stderr.txt create mode 100644 Tests/RunCMake/build_command/ErrorsOFF-stdout.txt create mode 100644 Tests/RunCMake/build_command/ErrorsOFF.cmake create mode 100644 Tests/RunCMake/build_command/ErrorsON-result.txt create mode 100644 Tests/RunCMake/build_command/ErrorsON-stderr.txt create mode 100644 Tests/RunCMake/build_command/ErrorsON-stdout.txt create mode 100644 Tests/RunCMake/build_command/ErrorsON.cmake create mode 100644 Tests/RunCMake/build_command/RunCMakeTest.cmake diff --git a/Tests/CMakeCommands/CMakeLists.txt b/Tests/CMakeCommands/CMakeLists.txt deleted file mode 100644 index e9e4020..0000000 --- a/Tests/CMakeCommands/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -macro(add_CMakeCommands_test test) - add_test(CMakeCommands.${test} ${CMAKE_CMAKE_COMMAND} - -DCMake_SOURCE_DIR=${CMake_SOURCE_DIR} # TODO: Remove - -Ddir=${CMAKE_CURRENT_BINARY_DIR}/${test} - -Dgen=${CMAKE_TEST_GENERATOR} - -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/test.cmake" - ) -endmacro() - -add_CMakeCommands_test(build_command) diff --git a/Tests/CMakeCommands/build_command/CMakeLists.txt b/Tests/CMakeCommands/build_command/CMakeLists.txt deleted file mode 100644 index 990ac90..0000000 --- a/Tests/CMakeCommands/build_command/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# This CMakeLists file is *sometimes expected* to result in a configure error. -# -# expect this to succeed: -# ../bin/Release/cmake -G Xcode -# ../../CMake/Tests/CMakeCommands/build_command -# -# expect this to fail: -# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode -# ../../CMake/Tests/CMakeCommands/build_command -# -# This project exists merely to test the CMake command 'build_command'... -# ...even purposefully calling it with known-bad argument lists to cover -# error handling code. -# -cmake_minimum_required(VERSION 2.8) -project(test_build_command) - -set(cmd "initial") - -message("CTEST_FULL_OUTPUT") -message("0. begin") - -if(TEST_ERROR_CONDITIONS) - # Test with no arguments (an error): - build_command() - message("1. cmd='${cmd}'") - - # Test with unknown arguments (also an error): - build_command(cmd BOGUS STUFF) - message("2. cmd='${cmd}'") - - build_command(cmd STUFF BOGUS) - message("3. cmd='${cmd}'") -else() - message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)") -endif() - -# Test the one arg signature with none of the optional KEYWORD arguments: -build_command(cmd) -message("4. cmd='${cmd}'") - -# Test the two-arg legacy signature: -build_command(legacy_cmd ${CMAKE_BUILD_TOOL}) -message("5. legacy_cmd='${legacy_cmd}'") -message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'") - -# Test the optional KEYWORDs: -build_command(cmd CONFIGURATION hoohaaConfig) -message("6. cmd='${cmd}'") - -build_command(cmd PROJECT_NAME hoohaaProject) -message("7. cmd='${cmd}'") - -build_command(cmd TARGET hoohaaTarget) -message("8. cmd='${cmd}'") - -set(cmd "final") -message("9. cmd='${cmd}'") diff --git a/Tests/CMakeCommands/build_command/test.cmake b/Tests/CMakeCommands/build_command/test.cmake deleted file mode 100644 index 55d9359..0000000 --- a/Tests/CMakeCommands/build_command/test.cmake +++ /dev/null @@ -1,86 +0,0 @@ -if(NOT DEFINED CMake_SOURCE_DIR) - message(FATAL_ERROR "CMake_SOURCE_DIR not defined") -endif() - -if(NOT DEFINED dir) - message(FATAL_ERROR "dir not defined") -endif() - -if(NOT DEFINED gen) - message(FATAL_ERROR "gen not defined") -endif() - -message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") - -# Run cmake: -# -function(run_cmake build_dir extra_args expected_result expected_output expected_error) - message(STATUS "run_cmake build_dir='${build_dir}' extra_args='${extra_args}'") - - # Ensure build_dir exists: - # - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}) - - # Run cmake: - # - execute_process(COMMAND ${CMAKE_COMMAND} - ${extra_args} - -G ${gen} ${CMake_SOURCE_DIR}/Tests/CMakeCommands/build_command - RESULT_VARIABLE result - OUTPUT_VARIABLE stdout - ERROR_VARIABLE stderr - WORKING_DIRECTORY ${build_dir} - ) - - message(STATUS "result='${result}'") - message(STATUS "stdout='${stdout}'") - message(STATUS "stderr='${stderr}'") - message(STATUS "") - - # Verify result and output match expectations: - # - if("0" STREQUAL "${expected_result}") - if(NOT "${result}" STREQUAL "0") - message(FATAL_ERROR - "error: result='${result}' is non-zero and different than expected_result='${expected_result}'") - endif() - else() - if("${result}" STREQUAL "0") - message(FATAL_ERROR - "error: result='${result}' is zero and different than expected_result='${expected_result}'") - endif() - endif() - - foreach(e ${expected_output}) - if(NOT stdout MATCHES "${e}") - message(FATAL_ERROR - "error: stdout does not match expected_output item e='${e}'") - else() - message(STATUS "info: stdout matches '${e}'") - endif() - endforeach() - - foreach(e ${expected_error}) - if(NOT stderr MATCHES "${e}") - message(FATAL_ERROR - "error: stderr does not match expected_error item e='${e}'") - else() - message(STATUS "info: stderr matches '${e}'") - endif() - endforeach() - - message(STATUS "result, stdout and stderr match all expectations: test passes") - message(STATUS "") -endfunction() - - -# Expect this case to succeed: -run_cmake("${dir}/b1" "" 0 - "Build files have been written to:" - "skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF") - - -# Expect this one to fail: -run_cmake("${dir}/b2" "-DTEST_ERROR_CONDITIONS:BOOL=ON" 1 - "Configuring incomplete, errors occurred!" - "build_command requires at least one argument naming a CMake variable;build_command unknown argument ") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0eb4859..cf4dc44 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -53,7 +53,6 @@ IF(BUILD_TESTING) ADD_SUBDIRECTORY(CMakeLib) ADD_SUBDIRECTORY(CMakeOnly) - ADD_SUBDIRECTORY(CMakeCommands) ADD_SUBDIRECTORY(RunCMake) ADD_SUBDIRECTORY(FindPackageModeMakefileTest) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 2dbb08e..63fc9f8 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -40,4 +40,5 @@ macro(add_RunCMake_test test) ) endmacro() +add_RunCMake_test(build_command) add_RunCMake_test(find_package) diff --git a/Tests/RunCMake/build_command/CMakeLists.txt b/Tests/RunCMake/build_command/CMakeLists.txt new file mode 100644 index 0000000..0fbb948 --- /dev/null +++ b/Tests/RunCMake/build_command/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) + +# This CMakeLists file is *sometimes expected* to result in a configure error. +# +# expect this to succeed: +# ../bin/Release/cmake -G Xcode +# ../../CMake/Tests/CMakeCommands/build_command +# +# expect this to fail: +# ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode +# ../../CMake/Tests/CMakeCommands/build_command +# +# This project exists merely to test the CMake command 'build_command'... +# ...even purposefully calling it with known-bad argument lists to cover +# error handling code. +# + +set(cmd "initial") + +message("0. begin") + +if(TEST_ERROR_CONDITIONS) + # Test with no arguments (an error): + build_command() + message("1. cmd='${cmd}'") + + # Test with unknown arguments (also an error): + build_command(cmd BOGUS STUFF) + message("2. cmd='${cmd}'") + + build_command(cmd STUFF BOGUS) + message("3. cmd='${cmd}'") +else() + message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)") +endif() + +# Test the one arg signature with none of the optional KEYWORD arguments: +build_command(cmd) +message("4. cmd='${cmd}'") + +# Test the two-arg legacy signature: +build_command(legacy_cmd ${CMAKE_BUILD_TOOL}) +message("5. legacy_cmd='${legacy_cmd}'") +message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'") + +# Test the optional KEYWORDs: +build_command(cmd CONFIGURATION hoohaaConfig) +message("6. cmd='${cmd}'") + +build_command(cmd PROJECT_NAME hoohaaProject) +message("7. cmd='${cmd}'") + +build_command(cmd TARGET hoohaaTarget) +message("8. cmd='${cmd}'") + +set(cmd "final") +message("9. cmd='${cmd}'") diff --git a/Tests/RunCMake/build_command/ErrorsOFF-stderr.txt b/Tests/RunCMake/build_command/ErrorsOFF-stderr.txt new file mode 100644 index 0000000..331885b --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsOFF-stderr.txt @@ -0,0 +1 @@ +skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF diff --git a/Tests/RunCMake/build_command/ErrorsOFF-stdout.txt b/Tests/RunCMake/build_command/ErrorsOFF-stdout.txt new file mode 100644 index 0000000..cf66a9d --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsOFF-stdout.txt @@ -0,0 +1 @@ +Build files have been written to: diff --git a/Tests/RunCMake/build_command/ErrorsOFF.cmake b/Tests/RunCMake/build_command/ErrorsOFF.cmake new file mode 100644 index 0000000..a243fab --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsOFF.cmake @@ -0,0 +1 @@ +set(TEST_ERROR_CONDITIONS OFF) diff --git a/Tests/RunCMake/build_command/ErrorsON-result.txt b/Tests/RunCMake/build_command/ErrorsON-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsON-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/build_command/ErrorsON-stderr.txt b/Tests/RunCMake/build_command/ErrorsON-stderr.txt new file mode 100644 index 0000000..0be7475 --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsON-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at CMakeLists.txt:[0-9]+ \(build_command\): + build_command requires at least one argument naming a CMake variable + ++ +1. cmd='initial' +CMake Error at CMakeLists.txt:[0-9]+ \(build_command\): + build_command unknown argument "BOGUS" + ++ +2. cmd='initial' +CMake Error at CMakeLists.txt:[0-9]+ \(build_command\): + build_command unknown argument "STUFF" diff --git a/Tests/RunCMake/build_command/ErrorsON-stdout.txt b/Tests/RunCMake/build_command/ErrorsON-stdout.txt new file mode 100644 index 0000000..841dd0d --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsON-stdout.txt @@ -0,0 +1 @@ +Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/build_command/ErrorsON.cmake b/Tests/RunCMake/build_command/ErrorsON.cmake new file mode 100644 index 0000000..27814bf --- /dev/null +++ b/Tests/RunCMake/build_command/ErrorsON.cmake @@ -0,0 +1 @@ +set(TEST_ERROR_CONDITIONS ON) diff --git a/Tests/RunCMake/build_command/RunCMakeTest.cmake b/Tests/RunCMake/build_command/RunCMakeTest.cmake new file mode 100644 index 0000000..4525c57 --- /dev/null +++ b/Tests/RunCMake/build_command/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(ErrorsOFF) +run_cmake(ErrorsON) -- cgit v0.12 From f737bd416a49d79db032f97c3046e7eccc6aaea9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 8 Mar 2012 16:32:03 -0500 Subject: Pre-compute and store target object directory in cmGeneratorTarget Add cmGeneratorTarget::ObjectDirectory member to hold the value. In ComputeTargetObjects set the value to the full path to the target object directory including any necessary placeholder for the configuration name. --- Source/cmGeneratorTarget.h | 5 +++++ Source/cmGlobalUnixMakefileGenerator3.cxx | 1 + Source/cmGlobalVisualStudioGenerator.cxx | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2bfc037..b083ba1 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -43,6 +43,11 @@ public: std::map Objects; std::set ExplicitObjectName; + /** Full path with trailing slash to the top-level directory + holding object files for this target. Includes the build + time config name placeholder if needed for the generator. */ + std::string ObjectDirectory; + private: void ClassifySources(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 059692e..9d8a02c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -86,6 +86,7 @@ cmGlobalUnixMakefileGenerator3 dir_max += "/"; dir_max += gt->LocalGenerator->GetTargetDirectory(*target); dir_max += "/"; + gt->ObjectDirectory = dir_max; // Compute the name of each object file. for(std::vector::iterator diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index e5a9784..4b9e487 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -139,6 +139,22 @@ cmGlobalVisualStudioGenerator } gt->Objects[sf] = objectName; } + + std::string dir = gt->Makefile->GetCurrentOutputDirectory(); + dir += "/"; + std::string tgtDir = lg->GetTargetDirectory(*gt->Target); + if(!tgtDir.empty()) + { + dir += tgtDir; + dir += "/"; + } + const char* cd = this->GetCMakeCFGIntDir(); + if(cd && *cd) + { + dir += cd; + dir += "/"; + } + gt->ObjectDirectory = dir; } //---------------------------------------------------------------------------- -- cgit v0.12 From b87d7a60a0ed146b79c49baedb666db228d5a70f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 12 Mar 2012 10:47:40 -0400 Subject: Add OBJECT_LIBRARY target type This library type can compile sources to object files but does not link or archive them. It will be useful to reference from executable and normal library targets for direct inclusion of object files in them. Diagnose and reject the following as errors: * An OBJECT library may not be referenced in target_link_libraries. * An OBJECT library may contain only compiling sources and supporting headers and custom commands. Other source types that are not normally ignored are not allowed. * An OBJECT library may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands. * An OBJECT library may not be installed, exported, or imported. Some of these cases may be supported in the future but are not for now. Teach the VS generator that OBJECT_LIBRARY targets are "linkable" just like STATIC_LIBRARY targets for the LinkLibraryDependencies behavior. --- Source/cmAddLibraryCommand.cxx | 14 ++++++++++++++ Source/cmComputeLinkDepends.cxx | 13 +++++++++++++ Source/cmExportCommand.cxx | 8 ++++++++ Source/cmGeneratorTarget.cxx | 21 +++++++++++++++++++++ Source/cmGlobalVisualStudioGenerator.cxx | 8 +++++++- Source/cmInstallCommand.cxx | 11 ++++++++++- Source/cmInstallTargetGenerator.cxx | 1 + Source/cmLocalGenerator.cxx | 4 ++++ Source/cmMakefile.cxx | 13 ++++++++++++- Source/cmTarget.cxx | 2 ++ Source/cmTarget.h | 3 ++- Source/cmTargetLinkLibrariesCommand.cxx | 10 ++++++++++ 12 files changed, 104 insertions(+), 4 deletions(-) diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 9a776fb..c1d0e9d 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -64,6 +64,12 @@ bool cmAddLibraryCommand type = cmTarget::MODULE_LIBRARY; haveSpecifiedType = true; } + else if(libType == "OBJECT") + { + ++s; + type = cmTarget::OBJECT_LIBRARY; + haveSpecifiedType = true; + } else if(libType == "UNKNOWN") { ++s; @@ -118,6 +124,14 @@ bool cmAddLibraryCommand this->SetError("called with IMPORTED argument but no library type."); return false; } + if(type == cmTarget::OBJECT_LIBRARY) + { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "The OBJECT library type may not be used for IMPORTED libraries." + ); + return true; + } // Make sure the target does not already exist. if(this->Makefile->FindTargetToUse(libName.c_str())) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index ddff2d9..055aab0 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -633,6 +633,19 @@ cmTarget* cmComputeLinkDepends::FindTargetToLink(int depender_index, tgt = 0; } + if(tgt && tgt->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Target \"" << this->Target->GetName() << "\" links to " + "OBJECT library \"" << tgt->GetName() << "\" but this is not " + "allowed. " + "One may link only to STATIC or SHARED libraries, or to executables " + "with the ENABLE_EXPORTS property set."; + this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Target->GetBacktrace()); + tgt = 0; + } + // Return the target found, if any. return tgt; } diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index cb614d4..1cc1754 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -124,6 +124,14 @@ bool cmExportCommand { targets.push_back(target); } + else if(target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "given OBJECT library \"" << *currentTarget + << "\" which may not be exported."; + this->SetError(e.str().c_str()); + return false; + } else { cmOStringStream e; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index afb1f39..369eb5c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -29,6 +29,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) //---------------------------------------------------------------------------- void cmGeneratorTarget::ClassifySources() { + bool isObjLib = this->Target->GetType() == cmTarget::OBJECT_LIBRARY; + std::vector badObjLib; std::vector const& sources = this->Target->GetSourceFiles(); for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) @@ -43,6 +45,7 @@ void cmGeneratorTarget::ClassifySources() else if(tsFlags.Type != cmTarget::SourceFileTypeNormal) { this->OSXContent.push_back(sf); + if(isObjLib) { badObjLib.push_back(sf); } } else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY")) { @@ -51,10 +54,12 @@ void cmGeneratorTarget::ClassifySources() else if(sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { this->ExternalObjects.push_back(sf); + if(isObjLib) { badObjLib.push_back(sf); } } else if(cmSystemTools::LowerCase(sf->GetExtension()) == "def") { this->ModuleDefinitionFile = sf->GetFullPath(); + if(isObjLib) { badObjLib.push_back(sf); } } else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) { @@ -69,6 +74,22 @@ void cmGeneratorTarget::ClassifySources() else { this->ExtraSources.push_back(sf); + if(isObjLib) { badObjLib.push_back(sf); } } } + + if(!badObjLib.empty()) + { + cmOStringStream e; + e << "OBJECT library \"" << this->Target->GetName() << "\" contains:\n"; + for(std::vector::iterator i = badObjLib.begin(); + i != badObjLib.end(); ++i) + { + e << " " << (*i)->GetLocation().GetName() << "\n"; + } + e << "but may contain only headers and sources that compile."; + this->GlobalGenerator->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str(), + this->Target->GetBacktrace()); + } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 4b9e487..7da4f86 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -375,6 +375,12 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() } //---------------------------------------------------------------------------- +static bool VSLinkable(cmTarget* t) +{ + return t->IsLinkable() || t->GetType() == cmTarget::OBJECT_LIBRARY; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) { if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end()) @@ -458,7 +464,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) di != utilDepends.end(); ++di) { cmTarget* dep = *di; - if(allowLinkable || !dep->IsLinkable() || linked.count(dep)) + if(allowLinkable || !VSLinkable(dep) || linked.count(dep)) { // Direct dependency allowed. vsTargetDepend.insert(dep->GetName()); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index dca528d..c656487 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -357,7 +357,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) if(target->GetType() != cmTarget::EXECUTABLE && target->GetType() != cmTarget::STATIC_LIBRARY && target->GetType() != cmTarget::SHARED_LIBRARY && - target->GetType() != cmTarget::MODULE_LIBRARY) + target->GetType() != cmTarget::MODULE_LIBRARY && + target->GetType() != cmTarget::OBJECT_LIBRARY) { cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) @@ -365,6 +366,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) this->SetError(e.str().c_str()); return false; } + else if(target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "TARGETS given OBJECT library \"" << (*targetIt) + << "\" which may not be installed."; + this->SetError(e.str().c_str()); + return false; + } // Store the target in the list to be installed. targets.push_back(target); } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c74dda0..5f9b658 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -90,6 +90,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break; case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break; case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break; + case cmTarget::OBJECT_LIBRARY: case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: case cmTarget::UNKNOWN_LIBRARY: diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 19537b5..ebfb586 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1904,6 +1904,10 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, case cmTarget::UNKNOWN_LIBRARY: dep = target->GetLocation(config); return true; + case cmTarget::OBJECT_LIBRARY: + // An object library has no single file on which to depend. + // This was listed to get the target-level dependency. + return false; case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: // A utility target has no file on which to depend. This was listed diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 68a8272..aba2e38 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -853,6 +853,14 @@ cmMakefile::AddCustomCommandToTarget(const char* target, cmTargets::iterator ti = this->Targets.find(target); if(ti != this->Targets.end()) { + if(ti->second.GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Target \"" << target << "\" is an OBJECT library " + "that may not have PRE_BUILD, PRE_LINK, or POST_BUILD commands."; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } // Add the command to the appropriate build step for the target. std::vector no_output; cmCustomCommand cc(this, no_output, depends, @@ -1912,8 +1920,11 @@ cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type, // wrong type ? default to STATIC if ( (type != cmTarget::STATIC_LIBRARY) && (type != cmTarget::SHARED_LIBRARY) - && (type != cmTarget::MODULE_LIBRARY)) + && (type != cmTarget::MODULE_LIBRARY) + && (type != cmTarget::OBJECT_LIBRARY)) { + this->IssueMessage(cmake::INTERNAL_ERROR, + "cmMakefile::AddLibrary given invalid target type."); type = cmTarget::STATIC_LIBRARY; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e6be83a..9e86681 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -37,6 +37,8 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType) return "MODULE_LIBRARY"; case cmTarget::SHARED_LIBRARY: return "SHARED_LIBRARY"; + case cmTarget::OBJECT_LIBRARY: + return "OBJECT_LIBRARY"; case cmTarget::EXECUTABLE: return "EXECUTABLE"; case cmTarget::UTILITY: diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ff05cd3..e2502f0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -59,7 +59,8 @@ class cmTarget public: cmTarget(); enum TargetType { EXECUTABLE, STATIC_LIBRARY, - SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET, + SHARED_LIBRARY, MODULE_LIBRARY, + OBJECT_LIBRARY, UTILITY, GLOBAL_TARGET, UNKNOWN_LIBRARY}; static const char* GetTargetTypeName(TargetType targetType); enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD }; diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 36c4ca8..dbea1c3 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -84,6 +84,16 @@ bool cmTargetLinkLibrariesCommand return true; } + if(this->Target->GetType() == cmTarget::OBJECT_LIBRARY) + { + cmOStringStream e; + e << "Object library target \"" << args[0] << "\" " + << "may not link to anything."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + // but we might not have any libs after variable expansion if(args.size() < 2) { -- cgit v0.12 From 3aa741acb6b47d83a0892ddf027ddb0abdc33e78 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 12 Mar 2012 10:54:37 -0400 Subject: Build object library targets in Makefiles Treat OBJECT libraries as STATIC libraries but leave out the archive step. The object files will be left behind for reference by other targets later. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 5 +++++ Source/cmLocalUnixMakefileGenerator3.cxx | 1 + Source/cmMakefileLibraryTargetGenerator.cxx | 26 +++++++++++++++++++++++++ Source/cmMakefileLibraryTargetGenerator.h | 1 + Source/cmMakefileTargetGenerator.cxx | 30 ++++++++++++++++++----------- Source/cmMakefileTargetGenerator.h | 3 +++ 6 files changed, 55 insertions(+), 11 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 9d8a02c..e63de9c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -411,6 +411,7 @@ void cmGlobalUnixMakefileGenerator3 (l->second.GetType() == cmTarget::STATIC_LIBRARY) || (l->second.GetType() == cmTarget::SHARED_LIBRARY) || (l->second.GetType() == cmTarget::MODULE_LIBRARY) || + (l->second.GetType() == cmTarget::OBJECT_LIBRARY) || (l->second.GetType() == cmTarget::UTILITY)) { std::string tname = lg->GetRelativeTargetDirectory(l->second); @@ -446,6 +447,7 @@ cmGlobalUnixMakefileGenerator3 (l->second.GetType() == cmTarget::STATIC_LIBRARY) || (l->second.GetType() == cmTarget::SHARED_LIBRARY) || (l->second.GetType() == cmTarget::MODULE_LIBRARY) || + (l->second.GetType() == cmTarget::OBJECT_LIBRARY) || (l->second.GetType() == cmTarget::UTILITY)) { // Add this to the list of depends rules in this directory. @@ -620,6 +622,7 @@ cmGlobalUnixMakefileGenerator3 (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY))) { // Add a rule to build the target by name. @@ -706,6 +709,7 @@ cmGlobalUnixMakefileGenerator3 || (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) + || (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY))) { std::string makefileName; @@ -1015,6 +1019,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::GLOBAL_TARGET) || (t->second.GetType() == cmTarget::UTILITY)) { diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index b991b25..a645303 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -358,6 +358,7 @@ void cmLocalUnixMakefileGenerator3 (t->second.GetType() == cmTarget::STATIC_LIBRARY) || (t->second.GetType() == cmTarget::SHARED_LIBRARY) || (t->second.GetType() == cmTarget::MODULE_LIBRARY) || + (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY)) { emitted.insert(t->second.GetName()); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b4174cc..38aa59d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -101,6 +101,9 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles() this->WriteModuleLibraryRules(true); } break; + case cmTarget::OBJECT_LIBRARY: + this->WriteObjectLibraryRules(); + break; default: // If language is not known, this is an error. cmSystemTools::Error("Unknown Library Type"); @@ -122,6 +125,29 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles() } //---------------------------------------------------------------------------- +void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() +{ + std::vector commands; + std::vector depends; + + // Add post-build rules. + this->LocalGenerator-> + AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), + this->Target); + + // Depend on the object files. + this->AppendObjectDepends(depends); + + // Write the rule. + this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, + this->Target->GetName(), + depends, commands, true); + + // Write the main driver rule to build everything in this target. + this->WriteTargetDriverRule(this->Target->GetName(), false); +} + +//---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { const char* linkLanguage = diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index f3c47db..e6a5867 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -25,6 +25,7 @@ public: virtual void WriteRuleFiles(); protected: + void WriteObjectLibraryRules(); void WriteStaticLibraryRules(); void WriteSharedLibraryRules(bool relink); void WriteModuleLibraryRules(bool relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fc55f1e..d0cfd99 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -65,6 +65,7 @@ cmMakefileTargetGenerator::New(cmTarget *tgt) case cmTarget::STATIC_LIBRARY: case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: + case cmTarget::OBJECT_LIBRARY: result = new cmMakefileLibraryTargetGenerator(tgt); break; case cmTarget::UTILITY: @@ -1596,7 +1597,7 @@ void cmMakefileTargetGenerator //---------------------------------------------------------------------------- void cmMakefileTargetGenerator -::AppendLinkDepends(std::vector& depends) +::AppendObjectDepends(std::vector& depends) { // Add dependencies on the compiled object files. std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath(); @@ -1609,12 +1610,27 @@ void cmMakefileTargetGenerator depends.push_back(objTarget); } - // Add dependencies on targets that must be built first. - this->AppendTargetDepends(depends); + // Add dependencies on the external object files. + for(std::vector::const_iterator obj + = this->ExternalObjects.begin(); + obj != this->ExternalObjects.end(); ++obj) + { + depends.push_back(*obj); + } // Add a dependency on the rule file itself. this->LocalGenerator->AppendRuleDepend(depends, this->BuildFileNameFull.c_str()); +} + +//---------------------------------------------------------------------------- +void cmMakefileTargetGenerator +::AppendLinkDepends(std::vector& depends) +{ + this->AppendObjectDepends(depends); + + // Add dependencies on targets that must be built first. + this->AppendTargetDepends(depends); // Add a dependency on the link definitions file, if any. if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) @@ -1622,14 +1638,6 @@ void cmMakefileTargetGenerator depends.push_back(this->GeneratorTarget->ModuleDefinitionFile); } - // Add dependencies on the external object files. - for(std::vector::const_iterator obj - = this->ExternalObjects.begin(); - obj != this->ExternalObjects.end(); ++obj) - { - depends.push_back(*obj); - } - // Add user-specified dependencies. if(const char* linkDepends = this->Target->GetProperty("LINK_DEPENDS")) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index dbc607a..e1e554b 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -118,6 +118,9 @@ protected: // append intertarget dependencies void AppendTargetDepends(std::vector& depends); + // Append object file dependencies. + void AppendObjectDepends(std::vector& depends); + // Append link rule dependencies (objects, etc.). void AppendLinkDepends(std::vector& depends); -- cgit v0.12 From 3a53005f7dd5e582b855ef1f3c0e6814ce7d024a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 12 Mar 2012 10:55:07 -0400 Subject: Build object library targets in VS Treat OBJECT libraries as STATIC libraries. The VS project file format provides no way to avoid running the librarian so hide the resulting .lib away next to the object files as it should never be referenced. The object files will be left behind for reference by other targets later. --- Source/cmLocalVisualStudio6Generator.cxx | 41 +++++++++++++++++++++++------- Source/cmLocalVisualStudio7Generator.cxx | 18 +++++++++++++ Source/cmVisualStudio10TargetGenerator.cxx | 38 ++++++++++++++++++--------- 3 files changed, 76 insertions(+), 21 deletions(-) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 8f5f111..f53ad0e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -127,6 +127,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() switch(l->second.GetType()) { case cmTarget::STATIC_LIBRARY: + case cmTarget::OBJECT_LIBRARY: this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second); break; case cmTarget::SHARED_LIBRARY: @@ -1240,8 +1241,18 @@ void cmLocalVisualStudio6Generator outputNameMinSizeRel = target.GetFullName("MinSizeRel"); outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo"); } + else if(target.GetType() == cmTarget::OBJECT_LIBRARY) + { + outputName = target.GetName(); + outputName += ".lib"; + outputNameDebug = outputName; + outputNameRelease = outputName; + outputNameMinSizeRel = outputName; + outputNameRelWithDebInfo = outputName; + } // Compute the output directory for the target. + std::string outputDirOld; std::string outputDirDebug; std::string outputDirRelease; std::string outputDirMinSizeRel; @@ -1251,6 +1262,11 @@ void cmLocalVisualStudio6Generator target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY) { +#ifdef CM_USE_OLD_VS6 + outputDirOld = + removeQuotes(this->ConvertToOptionallyRelativeOutputPath + (target.GetDirectory().c_str())); +#endif outputDirDebug = removeQuotes(this->ConvertToOptionallyRelativeOutputPath( target.GetDirectory("Debug").c_str())); @@ -1264,6 +1280,14 @@ void cmLocalVisualStudio6Generator removeQuotes(this->ConvertToOptionallyRelativeOutputPath( target.GetDirectory("RelWithDebInfo").c_str())); } + else if(target.GetType() == cmTarget::OBJECT_LIBRARY) + { + std::string outputDir = cmake::GetCMakeFilesDirectoryPostSlash(); + outputDirDebug = outputDir + "Debug"; + outputDirRelease = outputDir + "Release"; + outputDirMinSizeRel = outputDir + "MinSizeRel"; + outputDirRelWithDebInfo = outputDir + "RelWithDebInfo"; + } // Compute the proper link information for the target. std::string optionsDebug; @@ -1432,7 +1456,8 @@ void cmLocalVisualStudio6Generator libnameExports.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG", mfcFlag); - if(target.GetType() == cmTarget::STATIC_LIBRARY ) + if(target.GetType() == cmTarget::STATIC_LIBRARY || + target.GetType() == cmTarget::OBJECT_LIBRARY) { cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG", staticLibOptionsDebug.c_str()); @@ -1531,7 +1556,7 @@ void cmLocalVisualStudio6Generator (exePath.c_str())).c_str()); #endif - if(targetBuilds) + if(targetBuilds || target.GetType() == cmTarget::OBJECT_LIBRARY) { cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_DEBUG", outputDirDebug.c_str()); @@ -1541,13 +1566,11 @@ void cmLocalVisualStudio6Generator outputDirMinSizeRel.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_RELWITHDEBINFO", outputDirRelWithDebInfo.c_str()); -#ifdef CM_USE_OLD_VS6 - std::string outPath = target.GetDirectory(); - cmSystemTools::ReplaceString - (line, "OUTPUT_DIRECTORY", - removeQuotes(this->ConvertToOptionallyRelativeOutputPath - (outPath.c_str())).c_str()); -#endif + if(!outputDirOld.empty()) + { + cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY", + outputDirOld.c_str()); + } } cmSystemTools::ReplaceString(line, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ee54433..2f145a6 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -642,6 +642,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, bool targetBuilds = true; switch(target.GetType()) { + case cmTarget::OBJECT_LIBRARY: + targetBuilds = false; // TODO: PDB for object library? case cmTarget::STATIC_LIBRARY: projectType = "typeStaticLibrary"; configType = "4"; @@ -1001,6 +1003,22 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } switch(target.GetType()) { + case cmTarget::OBJECT_LIBRARY: + { + std::string libpath = this->GetTargetDirectory(target); + libpath += "/"; + libpath += configName; + libpath += "/"; + libpath += target.GetName(); + libpath += ".lib"; + const char* tool = + this->FortranProject? "VFLibrarianTool":"VCLibrarianTool"; + fout << "\t\t\tConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n"; + break; + } case cmTarget::STATIC_LIBRARY: { std::string targetNameFull = target.GetFullName(configName); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b5794d6..db37dfc 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -148,7 +148,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str()); this->Target->SetProperty("GENERATOR_FILE_NAME_EXT", ".vcxproj"); - if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY) + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) { if(!this->ComputeClOptions()) { @@ -359,6 +359,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() case cmTarget::MODULE_LIBRARY: configType += "DynamicLibrary"; break; + case cmTarget::OBJECT_LIBRARY: case cmTarget::STATIC_LIBRARY: configType += "StaticLibrary"; break; @@ -389,7 +390,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() mfcLine += useOfMfcValue + "\n"; this->WriteString(mfcLine.c_str(), 2); - if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && this->ClOptions[*i]->UsingUnicode() || this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { @@ -1006,20 +1007,29 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() } else { - std::string targetNameFull = - this->Target->GetFullName(config->c_str()); std::string intermediateDir = this->LocalGenerator-> GetTargetDirectory(*this->Target); intermediateDir += "/"; intermediateDir += *config; intermediateDir += "/"; + std::string outDir; + std::string targetNameFull; + if(ttype == cmTarget::OBJECT_LIBRARY) + { + outDir = intermediateDir; + targetNameFull = this->Target->GetName(); + targetNameFull += ".lib"; + } + else + { + outDir = this->Target->GetDirectory(config->c_str()) + "/"; + targetNameFull = this->Target->GetFullName(config->c_str()); + } this->ConvertToWindowsSlash(intermediateDir); - std::string outDir = this->Target->GetDirectory(config->c_str()); this->ConvertToWindowsSlash(outDir); this->WritePlatformConfigTag("OutDir", config->c_str(), 3); *this->BuildFileStream << outDir - << "\\" << "\n"; this->WritePlatformConfigTag("IntDir", config->c_str(), 3); @@ -1253,11 +1263,15 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( *this->BuildFileStream << configName << "\n"; this->WriteString("$(IntDir)\n", 3); - this->WriteString("", 3); - *this->BuildFileStream << this->Target->GetDirectory(configName.c_str()) - << "/" - << this->Target->GetPDBName(configName.c_str()) - << "\n"; + if(this->Target->GetType() != cmTarget::OBJECT_LIBRARY) + { + // TODO: PDB for object library? + this->WriteString("", 3); + *this->BuildFileStream << this->Target->GetDirectory(configName.c_str()) + << "/" + << this->Target->GetPDBName(configName.c_str()) + << "\n"; + } this->WriteString("\n", 2); } @@ -1568,7 +1582,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1); *this->BuildFileStream << "\n"; // output cl compile flags - if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY) + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) { this->WriteClOptions(*i, includes); // output rc compile flags -- cgit v0.12