From 531c71bac3cdd92392e5e225cd03d1001d24347a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 20 Sep 2012 16:32:26 -0400 Subject: find_library: Refactor internal name iteration Teach cmFindLibraryHelper to support multiple possible names and iterate over all of them in each CheckDirectory call. For now we still only ever configure one name. --- Source/cmFindLibraryCommand.cxx | 92 ++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 0080e55..a9939dd 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -220,18 +220,19 @@ struct cmFindLibraryHelper // Keep track of the best library file found so far. typedef std::vector::size_type size_type; std::string BestPath; - size_type BestPrefix; - size_type BestSuffix; // Support for OpenBSD shared library naming: lib.so.. bool OpenBSD; - unsigned int BestMajor; - unsigned int BestMinor; - // Current name under consideration. - cmsys::RegularExpression NameRegex; - bool TryRawName; - std::string RawName; + // Current names under consideration. + struct Name + { + bool TryRaw; + std::string Raw; + cmsys::RegularExpression Regex; + Name(): TryRaw(false) {} + }; + std::vector Names; // Current full path under consideration. std::string TestPath; @@ -249,8 +250,9 @@ struct cmFindLibraryHelper suffix) - this->Suffixes.begin(); } bool HasValidSuffix(std::string const& name); - void SetName(std::string const& name); + void AddName(std::string const& name); bool CheckDirectory(std::string const& path); + bool CheckDirectoryForName(std::string const& path, Name& name); }; //---------------------------------------------------------------------------- @@ -273,14 +275,6 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf): this->OpenBSD = this->Makefile->GetCMakeInstance() ->GetPropertyAsBool("FIND_LIBRARY_USE_OPENBSD_VERSIONING"); - - this->TryRawName = false; - - // No library file has yet been found. - this->BestPrefix = this->Prefixes.size(); - this->BestSuffix = this->Suffixes.size(); - this->BestMajor = 0; - this->BestMinor = 0; } //---------------------------------------------------------------------------- @@ -353,11 +347,13 @@ bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) } //---------------------------------------------------------------------------- -void cmFindLibraryHelper::SetName(std::string const& name) +void cmFindLibraryHelper::AddName(std::string const& name) { + Name entry; + // Consider checking the raw name too. - this->TryRawName = this->HasValidSuffix(name); - this->RawName = name; + entry.TryRaw = this->HasValidSuffix(name); + entry.Raw = name; // Build a regular expression to match library names. std::string regex = "^"; @@ -369,21 +365,37 @@ void cmFindLibraryHelper::SetName(std::string const& name) regex += "(\\.[0-9]+\\.[0-9]+)?"; } regex += "$"; - this->NameRegex.compile(regex.c_str()); + entry.Regex.compile(regex.c_str()); + this->Names.push_back(entry); } //---------------------------------------------------------------------------- bool cmFindLibraryHelper::CheckDirectory(std::string const& path) { + for(std::vector::iterator i = this->Names.begin(); + i != this->Names.end(); ++i) + { + if(this->CheckDirectoryForName(path, *i)) + { + return true; + } + } + return false; +} + +//---------------------------------------------------------------------------- +bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, + Name& name) +{ // If the original library name provided by the user matches one of // the suffixes, try it first. This allows users to search // specifically for a static library on some platforms (on MS tools // one cannot tell just from the library name whether it is a static // library or an import library). - if(this->TryRawName) + if(name.TryRaw) { this->TestPath = path; - this->TestPath += this->RawName; + this->TestPath += name.Raw; if(cmSystemTools::FileExists(this->TestPath.c_str(), true)) { this->BestPath = @@ -393,6 +405,12 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) } } + // No library file has yet been found. + size_type bestPrefix = this->Prefixes.size(); + size_type bestSuffix = this->Suffixes.size(); + unsigned int bestMajor = 0; + unsigned int bestMinor = 0; + // Search for a file matching the library name regex. std::string dir = path; cmSystemTools::ConvertToUnixSlashes(dir); @@ -406,7 +424,7 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) #else std::string const& testName = origName; #endif - if(this->NameRegex.find(testName)) + if(name.Regex.find(testName)) { this->TestPath = path; this->TestPath += origName; @@ -416,25 +434,25 @@ bool cmFindLibraryHelper::CheckDirectory(std::string const& path) // best name found so far. Earlier prefixes are preferred, // followed by earlier suffixes. For OpenBSD, shared library // version extensions are compared. - size_type prefix = this->GetPrefixIndex(this->NameRegex.match(1)); - size_type suffix = this->GetSuffixIndex(this->NameRegex.match(2)); + size_type prefix = this->GetPrefixIndex(name.Regex.match(1)); + size_type suffix = this->GetSuffixIndex(name.Regex.match(2)); unsigned int major = 0; unsigned int minor = 0; if(this->OpenBSD) { - sscanf(this->NameRegex.match(3).c_str(), ".%u.%u", &major, &minor); + sscanf(name.Regex.match(3).c_str(), ".%u.%u", &major, &minor); } - if(this->BestPath.empty() || prefix < this->BestPrefix || - (prefix == this->BestPrefix && suffix < this->BestSuffix) || - (prefix == this->BestPrefix && suffix == this->BestSuffix && - (major > this->BestMajor || - (major == this->BestMajor && minor > this->BestMinor)))) + if(this->BestPath.empty() || prefix < bestPrefix || + (prefix == bestPrefix && suffix < bestSuffix) || + (prefix == bestPrefix && suffix == bestSuffix && + (major > bestMajor || + (major == bestMajor && minor > bestMinor)))) { this->BestPath = this->TestPath; - this->BestPrefix = prefix; - this->BestSuffix = suffix; - this->BestMajor = major; - this->BestMinor = minor; + bestPrefix = prefix; + bestSuffix = suffix; + bestMajor = major; + bestMinor = minor; } } } @@ -454,7 +472,7 @@ std::string cmFindLibraryCommand::FindNormalLibrary() { // Switch to searching for this name. std::string const& name = *ni; - helper.SetName(name); + helper.AddName(name); // Search every directory. for(std::vector::const_iterator -- cgit v0.12 From b64dd760d12ba38de3321d0666f7b0288564d13a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 10:17:45 -0400 Subject: find_library: Simplify framework search logic In cmFindLibraryCommand::FindFrameworkLibrary drop use of the old SystemTools::FindDirectory method. Replace it with a direct implementation of the only code path we used. --- Source/cmFindLibraryCommand.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index a9939dd..d0f7519 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -492,19 +492,22 @@ std::string cmFindLibraryCommand::FindNormalLibrary() //---------------------------------------------------------------------------- std::string cmFindLibraryCommand::FindFrameworkLibrary() { - // Search for a framework of each name in the entire search path. + std::string fwPath; + // Search for each name in all search paths. for(std::vector::const_iterator ni = this->Names.begin(); ni != this->Names.end() ; ++ni) { - // Search the paths for a framework with this name. - std::string fwName = *ni; - fwName += ".framework"; - std::string fwPath = cmSystemTools::FindDirectory(fwName.c_str(), - this->SearchPaths, - true); - if(!fwPath.empty()) + for(std::vector::const_iterator + di = this->SearchPaths.begin(); + di != this->SearchPaths.end(); ++di) { - return fwPath; + fwPath = *di; + fwPath += *ni; + fwPath += ".framework"; + if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + { + return cmSystemTools::CollapseFullPath(fwPath.c_str()); + } } } -- cgit v0.12 From 9cb68b1cd408165d00449c2fed80f2f156d2b80b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 10:27:09 -0400 Subject: find_library: Generalize helper macro in test case In Tests/CMakeOnly/find_library/CMakeLists.txt generalize the test_find_library macro and move the lib64 substitution logic to a new test_find_library_subst macro. --- Tests/CMakeOnly/find_library/CMakeLists.txt | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt index 08f9331..9120f69 100644 --- a/Tests/CMakeOnly/find_library/CMakeLists.txt +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -3,34 +3,34 @@ project(FindLibraryTest NONE) set(CMAKE_FIND_DEBUG_MODE 1) -macro(test_find_library expected) - get_filename_component(dir ${expected} PATH) - get_filename_component(name ${expected} NAME) - string(REGEX REPLACE "lib/?64" "lib" dir "${dir}") +macro(test_find_library desc expected) unset(LIB CACHE) - find_library(LIB - NAMES ${name} - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir} - NO_DEFAULT_PATH - ) + find_library(LIB ${ARGN} NO_DEFAULT_PATH) if(LIB) # Convert to relative path for comparison to expected location. file(RELATIVE_PATH REL_LIB "${CMAKE_CURRENT_SOURCE_DIR}" "${LIB}") - # Debugging output. - if(CMAKE_FIND_DEBUG_MODE) - message(STATUS "Library ${expected} searched as ${dir}, found as [${REL_LIB}].") - endif() - # Check and report failure. if(NOT "${REL_LIB}" STREQUAL "${expected}") - message(SEND_ERROR "Library ${l} should have been [${expected}] but was [${REL_LIB}]") + message(SEND_ERROR "Library ${expected} found as [${REL_LIB}]${desc}") + elseif(CMAKE_FIND_DEBUG_MODE) + message(STATUS "Library ${expected} found as [${REL_LIB}]${desc}") endif() else() - message(SEND_ERROR "Library ${expected} searched as ${dir}, NOT FOUND!") + message(SEND_ERROR "Library ${expected} NOT FOUND${desc}") endif() endmacro() +macro(test_find_library_subst expected) + get_filename_component(dir ${expected} PATH) + get_filename_component(name ${expected} NAME) + string(REGEX REPLACE "lib/?64" "lib" dir "${dir}") + test_find_library(", searched as ${dir}" "${expected}" + NAMES ${name} + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir} + ) +endmacro() + set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) @@ -44,7 +44,7 @@ foreach(lib lib/libtest3.a lib/libtest3.a ) - test_find_library(${lib}) + test_find_library_subst(${lib}) endforeach() set(CMAKE_SIZEOF_VOID_P 8) @@ -57,5 +57,5 @@ foreach(lib64 lib64/A/libtest1.a lib64/libtest1.a ) - test_find_library(${lib64}) + test_find_library_subst(${lib64}) endforeach() -- cgit v0.12 From 66759eea5e90d4af96fd79e2e9017cb2141f5415 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 11:05:10 -0400 Subject: find_library: Optionally consider all names in each directory When more than one value is given to the NAMES option this command by default will consider one name at a time and search every directory for it. Add a NAMES_PER_DIR option to tell this command to consider one directory at a time and search for all names in it. --- Source/cmFindBase.cxx | 15 ++++++ Source/cmFindBase.h | 2 + Source/cmFindLibraryCommand.cxx | 84 +++++++++++++++++++++++++++++ Source/cmFindLibraryCommand.h | 4 ++ Tests/CMakeOnly/find_library/A/libtestA.a | 0 Tests/CMakeOnly/find_library/B/libtestB.a | 0 Tests/CMakeOnly/find_library/CMakeLists.txt | 13 +++++ 7 files changed, 118 insertions(+) create mode 100644 Tests/CMakeOnly/find_library/A/libtestA.a create mode 100644 Tests/CMakeOnly/find_library/B/libtestB.a diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index a54bf7c..1de3982 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -15,6 +15,8 @@ cmFindBase::cmFindBase() { this->AlreadyInCache = false; this->AlreadyInCacheWithoutMetaInfo = false; + this->NamesPerDir = false; + this->NamesPerDirAllowed = false; } //---------------------------------------------------------------------------- @@ -213,6 +215,19 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) compatibility = false; newStyle = true; } + else if (args[j] == "NAMES_PER_DIR") + { + doing = DoingNone; + if(this->NamesPerDirAllowed) + { + this->NamesPerDir = true; + } + else + { + this->SetError("does not support NAMES_PER_DIR"); + return false; + } + } else if (args[j] == "NO_SYSTEM_PATH") { doing = DoingNone; diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index eac1885..84b0330 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -49,6 +49,8 @@ protected: cmStdString VariableDocumentation; cmStdString VariableName; std::vector Names; + bool NamesPerDir; + bool NamesPerDirAllowed; // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM cmStdString EnvironmentPath; // LIB,INCLUDE diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index d0f7519..4af7e11 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -17,6 +17,7 @@ cmFindLibraryCommand::cmFindLibraryCommand() { this->EnvironmentPath = "LIB"; + this->NamesPerDirAllowed = true; } //---------------------------------------------------------------------------- @@ -44,6 +45,9 @@ void cmFindLibraryCommand::GenerateDocumentation() "SEARCH_XXX", "library"); cmSystemTools::ReplaceString(this->GenericDocumentation, "XXX_SUBDIR", "lib"); + cmSystemTools::ReplaceString(this->GenericDocumentation, + "NAMES name1 [name2 ...]", + "NAMES name1 [name2 ...] [NAMES_PER_DIR]"); cmSystemTools::ReplaceString( this->GenericDocumentation, "XXX_EXTRA_PREFIX_ENTRY", @@ -53,6 +57,12 @@ void cmFindLibraryCommand::GenerateDocumentation() "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"); this->GenericDocumentation += "\n" + "When more than one value is given to the NAMES option this command " + "by default will consider one name at a time and search every directory " + "for it. " + "The NAMES_PER_DIR option tells this command to consider one directory " + "at a time and search for all names in it." + "\n" "If the library found is a framework, then VAR will be set to " "the full path to the framework /A.framework. " "When a full path to a framework is used as a library, " @@ -465,6 +475,42 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, //---------------------------------------------------------------------------- std::string cmFindLibraryCommand::FindNormalLibrary() { + if(this->NamesPerDir) + { + return this->FindNormalLibraryNamesPerDir(); + } + else + { + return this->FindNormalLibraryDirsPerName(); + } +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir() +{ + // Search for all names in each directory. + cmFindLibraryHelper helper(this->Makefile); + for(std::vector::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + helper.AddName(*ni); + } + // Search every directory. + for(std::vector::const_iterator + p = this->SearchPaths.begin(); p != this->SearchPaths.end(); ++p) + { + if(helper.CheckDirectory(*p)) + { + return helper.BestPath; + } + } + // Couldn't find the library. + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName() +{ // Search the entire path for each name. cmFindLibraryHelper helper(this->Makefile); for(std::vector::const_iterator ni = this->Names.begin(); @@ -492,6 +538,44 @@ std::string cmFindLibraryCommand::FindNormalLibrary() //---------------------------------------------------------------------------- std::string cmFindLibraryCommand::FindFrameworkLibrary() { + if(this->NamesPerDir) + { + return this->FindFrameworkLibraryNamesPerDir(); + } + else + { + return this->FindFrameworkLibraryDirsPerName(); + } +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir() +{ + std::string fwPath; + // Search for all names in each search path. + for(std::vector::const_iterator di = this->SearchPaths.begin(); + di != this->SearchPaths.end(); ++di) + { + for(std::vector::const_iterator ni = this->Names.begin(); + ni != this->Names.end() ; ++ni) + { + fwPath = *di; + fwPath += *ni; + fwPath += ".framework"; + if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + { + return cmSystemTools::CollapseFullPath(fwPath.c_str()); + } + } + } + + // No framework found. + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName() +{ std::string fwPath; // Search for each name in all search paths. for(std::vector::const_iterator ni = this->Names.begin(); diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index 455348a..cd0fce8 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -70,7 +70,11 @@ protected: virtual void GenerateDocumentation(); private: std::string FindNormalLibrary(); + std::string FindNormalLibraryNamesPerDir(); + std::string FindNormalLibraryDirsPerName(); std::string FindFrameworkLibrary(); + std::string FindFrameworkLibraryNamesPerDir(); + std::string FindFrameworkLibraryDirsPerName(); }; diff --git a/Tests/CMakeOnly/find_library/A/libtestA.a b/Tests/CMakeOnly/find_library/A/libtestA.a new file mode 100644 index 0000000..e69de29 diff --git a/Tests/CMakeOnly/find_library/B/libtestB.a b/Tests/CMakeOnly/find_library/B/libtestB.a new file mode 100644 index 0000000..e69de29 diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt index 9120f69..2d4ecaf 100644 --- a/Tests/CMakeOnly/find_library/CMakeLists.txt +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -59,3 +59,16 @@ foreach(lib64 ) test_find_library_subst(${lib64}) endforeach() + +test_find_library("" A/libtestA.a + NAMES testA testB + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) +test_find_library("" B/libtestB.a + NAMES testB testA + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) +test_find_library("" A/libtestA.a + NAMES testB testA NAMES_PER_DIR + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B + ) -- cgit v0.12 From 531612d3705b1c30ad175bc664c1179400f517a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 11:08:51 -0400 Subject: FindBoost: Remove extra indentation level A large portion of the file was still indented for historical reasons. --- Modules/FindBoost.cmake | 1106 +++++++++++++++++++++++------------------------ 1 file changed, 553 insertions(+), 553 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 17aba1b..5275b3b 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -561,652 +561,652 @@ endif() # Boost. set(Boost_ERROR_REASON) - if(Boost_DEBUG) - # Output some of their choices - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") - endif() +if(Boost_DEBUG) + # Output some of their choices + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") +endif() - if(WIN32) - # In windows, automatic linking is performed, so you do not have - # to specify the libraries. If you are linking to a dynamic - # runtime, then you can choose to link to either a static or a - # dynamic Boost library, the default is to do a static link. You - # can alter this for a specific library "whatever" by defining - # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be - # linked dynamically. Alternatively you can force all Boost - # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - - # This feature can be disabled for Boost library "whatever" by - # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining - # BOOST_ALL_NO_LIB. - - # If you want to observe which libraries are being linked against - # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking - # code to emit a #pragma message each time a library is selected - # for linking. - set(Boost_LIB_DIAGNOSTIC_DEFINITIONS - "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") - endif() +if(WIN32) + # In windows, automatic linking is performed, so you do not have + # to specify the libraries. If you are linking to a dynamic + # runtime, then you can choose to link to either a static or a + # dynamic Boost library, the default is to do a static link. You + # can alter this for a specific library "whatever" by defining + # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be + # linked dynamically. Alternatively you can force all Boost + # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. + + # This feature can be disabled for Boost library "whatever" by + # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining + # BOOST_ALL_NO_LIB. + + # If you want to observe which libraries are being linked against + # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking + # code to emit a #pragma message each time a library is selected + # for linking. + set(Boost_LIB_DIAGNOSTIC_DEFINITIONS + "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") +endif() - set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM - C:/boost/include - C:/boost - "$ENV{ProgramFiles}/boost/include" - "$ENV{ProgramFiles}/boost" - /sw/local/include - ) +set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM + C:/boost/include + C:/boost + "$ENV{ProgramFiles}/boost/include" + "$ENV{ProgramFiles}/boost" + /sw/local/include +) + +_Boost_CHECK_SPELLING(Boost_ROOT) +_Boost_CHECK_SPELLING(Boost_LIBRARYDIR) +_Boost_CHECK_SPELLING(Boost_INCLUDEDIR) + +# If BOOST_ROOT was defined in the environment, use it. +if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "") + set(BOOST_ROOT $ENV{Boost_DIR}) +endif() - _Boost_CHECK_SPELLING(Boost_ROOT) - _Boost_CHECK_SPELLING(Boost_LIBRARYDIR) - _Boost_CHECK_SPELLING(Boost_INCLUDEDIR) +# If BOOST_ROOT was defined in the environment, use it. +if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") + set(BOOST_ROOT $ENV{BOOST_ROOT}) +endif() - # If BOOST_ROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "") - set(BOOST_ROOT $ENV{Boost_DIR}) - endif() +# If BOOSTROOT was defined in the environment, use it. +if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") + set(BOOST_ROOT $ENV{BOOSTROOT}) +endif() - # If BOOST_ROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOST_ROOT}) - endif() +# If BOOST_INCLUDEDIR was defined in the environment, use it. +if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) + set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) +endif() - # If BOOSTROOT was defined in the environment, use it. - if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOSTROOT}) - endif() +# If BOOST_LIBRARYDIR was defined in the environment, use it. +if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) + set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) +endif() - # If BOOST_INCLUDEDIR was defined in the environment, use it. - if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) - endif() +if( BOOST_ROOT ) + file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) +endif() - # If BOOST_LIBRARYDIR was defined in the environment, use it. - if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) - endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Declared as CMake or Environmental Variables:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_ROOT = ${BOOST_ROOT}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") +endif() - if( BOOST_ROOT ) - file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) - endif() +if( Boost_NO_SYSTEM_PATHS) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) +else() + set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) +endif() + +if( BOOST_ROOT ) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_ROOT}/include + ${BOOST_ROOT} + ${_boost_INCLUDE_SEARCH_DIRS}) +endif() + +# prepend BOOST_INCLUDEDIR to search path if specified +if( BOOST_INCLUDEDIR ) + file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) +endif() + +# ------------------------------------------------------------------------ +# Search for Boost include DIR +# ------------------------------------------------------------------------ +# Try to find Boost by stepping backwards through the Boost versions +# we know about. +if( NOT Boost_INCLUDE_DIR ) + # Build a list of path suffixes for each version. + set(_boost_PATH_SUFFIXES) + foreach(_boost_VER ${_boost_TEST_VERSIONS}) + # Add in a path suffix, based on the required version, ideally + # we could read this from version.hpp, but for that to work we'd + # need to know the include dir already + set(_boost_BOOSTIFIED_VERSION) + + # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 + if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + endif() + + list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") + list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") + + endforeach() if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Declared as CMake or Environmental Variables:") + "Include debugging info:") message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_ROOT = ${BOOST_ROOT}") + " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") endif() - if( Boost_NO_SYSTEM_PATHS) - set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) - else() - set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) - endif() + # Look for a standard boost header file. + find_path(Boost_INCLUDE_DIR + NAMES boost/config.hpp + HINTS ${_boost_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ${_boost_FIND_OPTIONS} + ) +endif() - if( BOOST_ROOT ) - set(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_ROOT}/include - ${BOOST_ROOT} - ${_boost_INCLUDE_SEARCH_DIRS}) +# ------------------------------------------------------------------------ +# Extract version information from version.hpp +# ------------------------------------------------------------------------ + +if(Boost_INCLUDE_DIR) + # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp + # Read the whole file: + # + set(BOOST_VERSION 0) + set(BOOST_LIB_VERSION "") + file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") endif() - # prepend BOOST_INCLUDEDIR to search path if specified - if( BOOST_INCLUDEDIR ) - file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) - set(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) - endif() + string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") + string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") + unset(_boost_VERSION_HPP_CONTENTS) - # ------------------------------------------------------------------------ - # Search for Boost include DIR - # ------------------------------------------------------------------------ - # Try to find Boost by stepping backwards through the Boost versions - # we know about. - if( NOT Boost_INCLUDE_DIR ) - # Build a list of path suffixes for each version. - set(_boost_PATH_SUFFIXES) - foreach(_boost_VER ${_boost_TEST_VERSIONS}) - # Add in a path suffix, based on the required version, ideally - # we could read this from version.hpp, but for that to work we'd - # need to know the include dir already - set(_boost_BOOSTIFIED_VERSION) - - # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - endif() + set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") + set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") - list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") - list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") + if(NOT "${Boost_VERSION}" STREQUAL "0") + math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - endforeach() + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "version.hpp reveals boost " + "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + endif() +else() + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") +endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Include debugging info:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") - endif() +# ------------------------------------------------------------------------ +# Suffix initialization and compiler suffix detection. +# ------------------------------------------------------------------------ - # Look for a standard boost header file. - find_path(Boost_INCLUDE_DIR - NAMES boost/config.hpp - HINTS ${_boost_INCLUDE_SEARCH_DIRS} - PATH_SUFFIXES ${_boost_PATH_SUFFIXES} - ${_boost_FIND_OPTIONS} - ) +# Setting some more suffixes for the library +set(Boost_LIB_PREFIX "") +if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) + set(Boost_LIB_PREFIX "lib") +endif() + +if (Boost_COMPILER) + set(_boost_COMPILER ${Boost_COMPILER}) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "using user-specified Boost_COMPILER = ${_boost_COMPILER}") + endif() +else() + # Attempt to guess the compiler suffix + # NOTE: this is not perfect yet, if you experience any issues + # please report them and use the Boost_COMPILER variable + # to work around the problems. + _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "guessed _boost_COMPILER = ${_boost_COMPILER}") endif() +endif() - # ------------------------------------------------------------------------ - # Extract version information from version.hpp - # ------------------------------------------------------------------------ - - if(Boost_INCLUDE_DIR) - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - # Read the whole file: - # - set(BOOST_VERSION 0) - set(BOOST_LIB_VERSION "") - file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") - endif() +set (_boost_MULTITHREADED "-mt") +if( NOT Boost_USE_MULTITHREADED ) + set (_boost_MULTITHREADED "") +endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") +endif() - string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") - string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - unset(_boost_VERSION_HPP_CONTENTS) +#====================== +# Systematically build up the Boost ABI tag +# http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming +set( _boost_RELEASE_ABI_TAG "-") +set( _boost_DEBUG_ABI_TAG "-") +# Key Use this library when: +# s linking statically to the C++ standard library and +# compiler runtime support libraries. +if(Boost_USE_STATIC_RUNTIME) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") +endif() +# g using debug versions of the standard and runtime +# support libraries +if(WIN32) + if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + endif() +endif() +# y using special debug build of python +if(Boost_USE_DEBUG_PYTHON) + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") +endif() +# d using a debug version of your code +set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") +# p using the STLport standard library rather than the +# default one supplied with your compiler +if(Boost_USE_STLPORT) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") +endif() +# n using the STLport deprecated "native iostreams" feature +if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") +endif() - set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") - set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") +endif() - if(NOT "${Boost_VERSION}" STREQUAL "0") - math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") +# ------------------------------------------------------------------------ +# Begin finding boost libraries +# ------------------------------------------------------------------------ - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "version.hpp reveals boost " - "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - endif() - else() - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") - endif() +if(BOOST_ROOT) + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${BOOST_ROOT}/lib + ${BOOST_ROOT}/stage/lib) +endif() +set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib +) +set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM + C:/boost/lib + C:/boost + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost/lib" + "$ENV{ProgramFiles}/boost" + /sw/local/lib +) +set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) +if( Boost_NO_SYSTEM_PATHS ) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) +else() + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) +endif() - # ------------------------------------------------------------------------ - # Suffix initialization and compiler suffix detection. - # ------------------------------------------------------------------------ +# prepend BOOST_LIBRARYDIR to search path if specified +if( BOOST_LIBRARYDIR ) + file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) + set(_boost_LIBRARY_SEARCH_DIRS + ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) +endif() - # Setting some more suffixes for the library - set(Boost_LIB_PREFIX "") - if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) - set(Boost_LIB_PREFIX "lib") - endif() +if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") +endif() - if (Boost_COMPILER) - set(_boost_COMPILER ${Boost_COMPILER}) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "using user-specified Boost_COMPILER = ${_boost_COMPILER}") - endif() +# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES +if( Boost_USE_STATIC_LIBS ) + set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) else() - # Attempt to guess the compiler suffix - # NOTE: this is not perfect yet, if you experience any issues - # please report them and use the Boost_COMPILER variable - # to work around the problems. - _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "guessed _boost_COMPILER = ${_boost_COMPILER}") - endif() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) endif() +endif() - set (_boost_MULTITHREADED "-mt") - if( NOT Boost_USE_MULTITHREADED ) - set (_boost_MULTITHREADED "") +# We want to use the tag inline below without risking double dashes +if(_boost_RELEASE_ABI_TAG) + if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") + set(_boost_RELEASE_ABI_TAG "") endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") +endif() +if(_boost_DEBUG_ABI_TAG) + if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") + set(_boost_DEBUG_ABI_TAG "") endif() +endif() - #====================== - # Systematically build up the Boost ABI tag - # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming - set( _boost_RELEASE_ABI_TAG "-") - set( _boost_DEBUG_ABI_TAG "-") - # Key Use this library when: - # s linking statically to the C++ standard library and - # compiler runtime support libraries. - if(Boost_USE_STATIC_RUNTIME) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") - endif() - # g using debug versions of the standard and runtime - # support libraries - if(WIN32) - if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") - endif() - endif() - # y using special debug build of python - if(Boost_USE_DEBUG_PYTHON) - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") - endif() - # d using a debug version of your code - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") - # p using the STLport standard library rather than the - # default one supplied with your compiler - if(Boost_USE_STLPORT) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") - endif() - # n using the STLport deprecated "native iostreams" feature - if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") - endif() - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") +# The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled +# on WIN32 was to: +# 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) +# 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) +# We maintain this behavior since changing it could break people's builds. +# To disable the ambiguous behavior, the user need only +# set Boost_USE_STATIC_RUNTIME either ON or OFF. +set(_boost_STATIC_RUNTIME_WORKAROUND false) +if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) + set(_boost_STATIC_RUNTIME_WORKAROUND true) endif() +endif() - # ------------------------------------------------------------------------ - # Begin finding boost libraries - # ------------------------------------------------------------------------ +# On versions < 1.35, remove the System library from the considered list +# since it wasn't added until 1.35. +if(Boost_VERSION AND Boost_FIND_COMPONENTS) + if(Boost_VERSION LESS 103500) + list(REMOVE_ITEM Boost_FIND_COMPONENTS system) + endif() +endif() - if(BOOST_ROOT) - set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS - ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib) +foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") + + set( _boost_docstring_release "Boost ${COMPONENT} library (release)") + set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + + # + # Find RELEASE libraries + # + set(_boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) endif() - set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS - ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} - ${Boost_INCLUDE_DIR}/lib - ${Boost_INCLUDE_DIR}/../lib - ${Boost_INCLUDE_DIR}/stage/lib - ) - set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM - C:/boost/lib - C:/boost - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost/lib" - "$ENV{ProgramFiles}/boost" - /sw/local/lib - ) - set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) - if( Boost_NO_SYSTEM_PATHS ) - set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) - else() - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) - endif() - - # prepend BOOST_LIBRARYDIR to search path if specified - if( BOOST_LIBRARYDIR ) - file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) - set(_boost_LIBRARY_SEARCH_DIRS - ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) endif() - if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") - endif() - - # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES - if( Boost_USE_STATIC_LIBS ) - set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) - endif() + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_release}" + ) - # We want to use the tag inline below without risking double dashes - if(_boost_RELEASE_ABI_TAG) - if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") - set(_boost_RELEASE_ABI_TAG "") - endif() + # + # Find DEBUG libraries + # + set(_boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) endif() - if(_boost_DEBUG_ABI_TAG) - if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") - set(_boost_DEBUG_ABI_TAG "") - endif() - endif() - - # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled - # on WIN32 was to: - # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) - # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) - # We maintain this behavior since changing it could break people's builds. - # To disable the ambiguous behavior, the user need only - # set Boost_USE_STATIC_RUNTIME either ON or OFF. - set(_boost_STATIC_RUNTIME_WORKAROUND false) - if(WIN32 AND Boost_USE_STATIC_LIBS) - if(NOT DEFINED Boost_USE_STATIC_RUNTIME) - set(_boost_STATIC_RUNTIME_WORKAROUND true) - endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) endif() - - # On versions < 1.35, remove the System library from the considered list - # since it wasn't added until 1.35. - if(Boost_VERSION AND Boost_FIND_COMPONENTS) - if(Boost_VERSION LESS 103500) - list(REMOVE_ITEM Boost_FIND_COMPONENTS system) - endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_debug}" + ) - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) - set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) - set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") - - set( _boost_docstring_release "Boost ${COMPONENT} library (release)") - set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") - - # - # Find RELEASE libraries - # - set(_boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) - endif() - if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") - endif() - find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${_boost_RELEASE_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} - ${_boost_FIND_OPTIONS} - DOC "${_boost_docstring_release}" - ) - - # - # Find DEBUG libraries - # - set(_boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}boost_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) - endif() - if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") - endif() - find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${_boost_DEBUG_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} - ${_boost_FIND_OPTIONS} - DOC "${_boost_docstring_debug}" - ) - - if(Boost_REALPATH) - _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") - _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) - endif() - - _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - - endforeach() - - # Restore the original find library ordering - if( Boost_USE_STATIC_LIBS ) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + if(Boost_REALPATH) + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) endif() - # ------------------------------------------------------------------------ - # End finding boost libraries - # ------------------------------------------------------------------------ + _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - # ------------------------------------------------------------------------ - # Begin long process of determining Boost_FOUND, starting with version - # number checks, followed by - # TODO: Ideally the version check logic should happen prior to searching - # for libraries... - # ------------------------------------------------------------------------ +endforeach() - set(Boost_INCLUDE_DIRS - ${Boost_INCLUDE_DIR} - ) - - set(Boost_FOUND FALSE) - if(Boost_INCLUDE_DIR) - set( Boost_FOUND TRUE ) +# Restore the original find library ordering +if( Boost_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() - if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) +# ------------------------------------------------------------------------ +# End finding boost libraries +# ------------------------------------------------------------------------ + +# ------------------------------------------------------------------------ +# Begin long process of determining Boost_FOUND, starting with version +# number checks, followed by +# TODO: Ideally the version check logic should happen prior to searching +# for libraries... +# ------------------------------------------------------------------------ + +set(Boost_INCLUDE_DIRS + ${Boost_INCLUDE_DIR} +) + +set(Boost_FOUND FALSE) +if(Boost_INCLUDE_DIR) + set( Boost_FOUND TRUE ) + + if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) set( Boost_FOUND FALSE ) set(_Boost_VERSION_AGE "old") - elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) + elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) set( Boost_FOUND FALSE ) set(_Boost_VERSION_AGE "old") - elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - endif() endif() endif() + endif() - if (NOT Boost_FOUND) - _Boost_MARK_COMPONENTS_FOUND(OFF) - endif() + if (NOT Boost_FOUND) + _Boost_MARK_COMPONENTS_FOUND(OFF) + endif() - if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) - # If the user requested an exact version of Boost, check - # that. We already know that the Boost version we have is >= the - # requested version. - set(_Boost_VERSION_AGE "new") - - # If the user didn't specify a patchlevel, it's 0. - if (NOT Boost_FIND_VERSION_PATCH) - set(Boost_FIND_VERSION_PATCH 0) - endif () - - # We'll set Boost_FOUND true again if we have an exact version match. - set(Boost_FOUND FALSE) - _Boost_MARK_COMPONENTS_FOUND(OFF) - if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND TRUE ) - _Boost_MARK_COMPONENTS_FOUND(ON) - endif() + if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) + # If the user requested an exact version of Boost, check + # that. We already know that the Boost version we have is >= the + # requested version. + set(_Boost_VERSION_AGE "new") + + # If the user didn't specify a patchlevel, it's 0. + if (NOT Boost_FIND_VERSION_PATCH) + set(Boost_FIND_VERSION_PATCH 0) + endif () + + # We'll set Boost_FOUND true again if we have an exact version match. + set(Boost_FOUND FALSE) + _Boost_MARK_COMPONENTS_FOUND(OFF) + if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) + set( Boost_FOUND TRUE ) + _Boost_MARK_COMPONENTS_FOUND(ON) endif() endif() - endif () + endif() + endif () - if(NOT Boost_FOUND) - # State that we found a version of Boost that is too new or too old. + if(NOT Boost_FOUND) + # State that we found a version of Boost that is too new or too old. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + if (Boost_FIND_VERSION_PATCH) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") - endif () - if (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") - endif () - set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") endif () + if (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") + endif () + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + endif () - # Always check for missing components - set(_boost_CHECKED_COMPONENT FALSE) - set(_Boost_MISSING_COMPONENTS "") - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} COMPONENT) - set(_boost_CHECKED_COMPONENT TRUE) - if(NOT Boost_${COMPONENT}_FOUND) - string(TOLOWER ${COMPONENT} COMPONENT) - list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) - set( Boost_FOUND FALSE) - endif() - endforeach() - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") + # Always check for missing components + set(_boost_CHECKED_COMPONENT FALSE) + set(_Boost_MISSING_COMPONENTS "") + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) + set(_boost_CHECKED_COMPONENT TRUE) + if(NOT Boost_${COMPONENT}_FOUND) + string(TOLOWER ${COMPONENT} COMPONENT) + list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) + set( Boost_FOUND FALSE) endif() + endforeach() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") + endif() - if (_Boost_MISSING_COMPONENTS) - # We were unable to find some libraries, so generate a sensible - # error message that lists the libraries we were unable to find. + if (_Boost_MISSING_COMPONENTS) + # We were unable to find some libraries, so generate a sensible + # error message that lists the libraries we were unable to find. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") + foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") - foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON} boost_${COMPONENT}\n") - endforeach() + "${Boost_ERROR_REASON} boost_${COMPONENT}\n") + endforeach() - list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) - list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) - if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - else () - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - endif () + list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) + list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) + if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + else () + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") endif () + endif () - if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - # Compatibility Code for backwards compatibility with CMake - # 2.4's FindBoost module. + if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + # Compatibility Code for backwards compatibility with CMake + # 2.4's FindBoost module. - # Look for the boost library path. - # Note that the user may not have installed any libraries - # so it is quite possible the Boost_LIBRARY_DIRS may not exist. - set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) + # Look for the boost library path. + # Note that the user may not have installed any libraries + # so it is quite possible the Boost_LIBRARY_DIRS may not exist. + set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - endif() + if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() - if("${_boost_LIB_DIR}" MATCHES "/include$") - # Strip off the trailing "/include" in the path. - get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - endif() + if("${_boost_LIB_DIR}" MATCHES "/include$") + # Strip off the trailing "/include" in the path. + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() - if(EXISTS "${_boost_LIB_DIR}/lib") - set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + if(EXISTS "${_boost_LIB_DIR}/lib") + set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + else() + if(EXISTS "${_boost_LIB_DIR}/stage/lib") + set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) else() - if(EXISTS "${_boost_LIB_DIR}/stage/lib") - set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) - else() - set(_boost_LIB_DIR "") - endif() - endif() - - if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") + set(_boost_LIB_DIR "") endif() + endif() + if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") endif() - else() - set( Boost_FOUND FALSE) endif() - # ------------------------------------------------------------------------ - # Notification to end user about what was found - # ------------------------------------------------------------------------ +else() + set( Boost_FOUND FALSE) +endif() + +# ------------------------------------------------------------------------ +# Notification to end user about what was found +# ------------------------------------------------------------------------ - if(Boost_FOUND) +if(Boost_FOUND) + if(NOT Boost_FIND_QUIETLY) + message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if(Boost_FIND_COMPONENTS) + message(STATUS "Found the following Boost libraries:") + endif() + endif() + foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) + string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) + if( Boost_${UPPERCOMPONENT}_FOUND ) if(NOT Boost_FIND_QUIETLY) - message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - if(Boost_FIND_COMPONENTS) - message(STATUS "Found the following Boost libraries:") - endif() + message (STATUS " ${COMPONENT}") endif() - foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) - string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) - if( Boost_${UPPERCOMPONENT}_FOUND ) - if(NOT Boost_FIND_QUIETLY) - message (STATUS " ${COMPONENT}") - endif() - set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) - endif() - endforeach() + set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) + endif() + endforeach() +else() + if(Boost_FIND_REQUIRED) + message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") else() - if(Boost_FIND_REQUIRED) - message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") - else() - if(NOT Boost_FIND_QUIETLY) - # we opt not to automatically output Boost_ERROR_REASON here as - # it could be quite lengthy and somewhat imposing in its requests - # Since Boost is not always a required dependency we'll leave this - # up to the end-user. - if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) - message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") - else() - message(STATUS "Could NOT find Boost") - endif() + if(NOT Boost_FIND_QUIETLY) + # we opt not to automatically output Boost_ERROR_REASON here as + # it could be quite lengthy and somewhat imposing in its requests + # Since Boost is not always a required dependency we'll leave this + # up to the end-user. + if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) + message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") + else() + message(STATUS "Could NOT find Boost") endif() endif() endif() +endif() - # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view - mark_as_advanced(Boost_INCLUDE_DIR - Boost_INCLUDE_DIRS - Boost_LIBRARY_DIRS - ) +# show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view +mark_as_advanced(Boost_INCLUDE_DIR + Boost_INCLUDE_DIRS + Boost_LIBRARY_DIRS +) -- cgit v0.12 From d3260a46be7a98ea16fc4db83c4d3bf3b4c25f2e Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 11:10:14 -0400 Subject: FindBoost: Mark Boost_DIR cache entry as advanced --- Modules/FindBoost.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 5275b3b..cd5d586 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -282,6 +282,7 @@ if (NOT Boost_NO_BOOST_CMAKE) # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no # need to delegate them to this find_package call. find_package(Boost QUIET NO_MODULE) + mark_as_advanced(Boost_DIR) # If we found boost-cmake, then we're done. Print out what we found. # Otherwise let the rest of the module try to find it. -- cgit v0.12 From 5ec8a69caca440d0cf07c769ff90bd8e26230f3d Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 11:11:51 -0400 Subject: FindBoost: Use PATH_SUFFIXES to look in "Program Files" The CMake find_path command looks under the proper "Program Files" directories on Windows with any of the provided PATH_SUFFIXES. This is simpler and more robust than directly reading ENV{ProgramFiles}. Once Boost_INCLUDE_DIR has been located we already look next to it for the lib directory anyway, so we do not need special help to find Boost libraries under "Program Files". --- Modules/FindBoost.cmake | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index cd5d586..77a8991 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -603,8 +603,6 @@ endif() set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM C:/boost/include C:/boost - "$ENV{ProgramFiles}/boost/include" - "$ENV{ProgramFiles}/boost" /sw/local/include ) @@ -697,8 +695,12 @@ if( NOT Boost_INCLUDE_DIR ) _boost_BOOSTIFIED_VERSION ${_boost_VER}) endif() - list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") - list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") + list(APPEND _boost_PATH_SUFFIXES + "boost-${_boost_BOOSTIFIED_VERSION}" + "boost_${_boost_BOOSTIFIED_VERSION}" + "boost/boost-${_boost_BOOSTIFIED_VERSION}" + "boost/boost_${_boost_BOOSTIFIED_VERSION}" + ) endforeach() @@ -861,10 +863,6 @@ set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM C:/boost/lib C:/boost - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib" - "$ENV{ProgramFiles}/boost/lib" - "$ENV{ProgramFiles}/boost" /sw/local/lib ) set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) -- cgit v0.12 From 5b9149e0833084184c490c1980cc719175f14b0c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 11:13:25 -0400 Subject: FindBoost: Overhaul caching and search repeat behavior Overhaul the implementation as follows: (1) Do not cache result variables such as Boost_VERSION, Boost_LIB_VERSION, Boost_LIBRARY_DIRS, Boost_${COMPONENT}_FOUND, Boost_${COMPONENT}_LIBRARY, or Boost_LIB_DIAGNOSTIC_DEFINITIONS that are derived uniquely from other search results. The user should not edit them anyway. (2) Add cache value Boost_LIBRARY_DIR to hold the single directory expected to contain all libraries. Once one library is found, search only that directory for other libraries. (3) Use the find_library NAMES_PER_DIR option to consider all possible library names at the same time. (4) Collect all documented input and cache variables and detect when they have been changed by the user. Discard prior search results that may have been influenced by the changes and search for them again. Environment variables are not expected to be persistent so use them only as hints and do not consider changes to them to be meaningful. --- Modules/FindBoost.cmake | 336 ++++++++++++++++++++++++++++++------------------ 1 file changed, 208 insertions(+), 128 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 77a8991..1a9dfbd 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -200,16 +200,16 @@ # BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the # module has problems finding the proper Boost installation # +# Boost_INCLUDE_DIR CMake cache entries storing Boost include directory +# Boost_LIBRARY_DIR and library directory. +# # Variables defined by this module: # # Boost_FOUND System has Boost, this means the include dir was # found, as well as all the libraries specified in # the COMPONENTS list. # -# Boost_INCLUDE_DIRS Boost include directories: not cached -# -# Boost_INCLUDE_DIR This is almost the same as above, but this one is -# cached and may be modified by advanced users +# Boost_INCLUDE_DIRS Boost include directories # # Boost_LIBRARIES Link to these to use the Boost libraries that you # specified: not cached @@ -242,7 +242,7 @@ # when needed). #============================================================================= -# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2012 Kitware, Inc. # Copyright 2006-2008 Andreas Schneider # Copyright 2007 Wengo # Copyright 2007 Mike Jackson @@ -350,29 +350,54 @@ macro(_Boost_ADJUST_LIB_VARS basename) endif() if(Boost_${basename}_LIBRARY) - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") - - # Remove superfluous "debug" / "optimized" keywords from - # Boost_LIBRARY_DIRS - foreach(_boost_my_lib ${Boost_${basename}_LIBRARY}) - get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH) - list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) - endforeach() - list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) - - set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") - set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") + set(Boost_${basename}_FOUND ON) endif() endif() # Make variables changeble to the advanced user mark_as_advanced( - Boost_${basename}_LIBRARY Boost_${basename}_LIBRARY_RELEASE Boost_${basename}_LIBRARY_DEBUG ) endmacro() +macro(_Boost_CHANGE_DETECT changed_var) + set(${changed_var} 0) + foreach(v ${ARGN}) + if(DEFINED _Boost_COMPONENTS_SEARCHED) + if(${v}) + if(_${v}_LAST) + string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED) + else() + set(_${v}_CHANGED 1) + endif() + elseif(_${v}_LAST) + set(_${v}_CHANGED 1) + endif() + if(_${v}_CHANGED) + set(${changed_var} 1) + endif() + else() + set(_${v}_CHANGED 0) + endif() + endforeach() +endmacro() + +macro(_Boost_FIND_LIBRARY var) + find_library(${var} ${ARGN}) + + # If we found the first library save Boost_LIBRARY_DIR. + if(${var} AND NOT Boost_LIBRARY_DIR) + get_filename_component(_dir "${${var}}" PATH) + set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE) + endif() + + # If Boost_LIBRARY_DIR is known then search only there. + if(Boost_LIBRARY_DIR) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) + endif() +endmacro() + #------------------------------------------------------------------------------- # @@ -398,7 +423,7 @@ endfunction() function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) foreach(COMPONENT ${Boost_FIND_COMPONENTS}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE) + set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no}) endforeach() endfunction() @@ -596,48 +621,34 @@ if(WIN32) # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking # code to emit a #pragma message each time a library is selected # for linking. - set(Boost_LIB_DIAGNOSTIC_DEFINITIONS - "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") + set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") endif() -set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM - C:/boost/include - C:/boost - /sw/local/include -) - _Boost_CHECK_SPELLING(Boost_ROOT) _Boost_CHECK_SPELLING(Boost_LIBRARYDIR) _Boost_CHECK_SPELLING(Boost_INCLUDEDIR) -# If BOOST_ROOT was defined in the environment, use it. -if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "") - set(BOOST_ROOT $ENV{Boost_DIR}) -endif() - -# If BOOST_ROOT was defined in the environment, use it. -if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOST_ROOT}) -endif() - -# If BOOSTROOT was defined in the environment, use it. -if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") - set(BOOST_ROOT $ENV{BOOSTROOT}) -endif() - -# If BOOST_INCLUDEDIR was defined in the environment, use it. -if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) -endif() - -# If BOOST_LIBRARYDIR was defined in the environment, use it. -if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) +# Collect environment variable inputs as hints. Do not consider changes. +foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR) + set(_env $ENV{${v}}) + if(_env) + file(TO_CMAKE_PATH "${_env}" _ENV_${v}) + else() + set(_ENV_${v} "") + endif() +endforeach() +if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT) + set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}") endif() -if( BOOST_ROOT ) - file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) +# Collect inputs and cached results. Detect changes since the last run. +if(NOT BOOST_ROOT AND BOOSTROOT) + set(BOOST_ROOT "${BOOSTROOT}") endif() +set(_Boost_VARS_DIR + BOOST_ROOT + Boost_NO_SYSTEM_PATHS + ) if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " @@ -652,32 +663,44 @@ if(Boost_DEBUG) "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") endif() -if( Boost_NO_SYSTEM_PATHS) - set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) -else() - set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) -endif() +# ------------------------------------------------------------------------ +# Search for Boost include DIR +# ------------------------------------------------------------------------ -if( BOOST_ROOT ) - set(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_ROOT}/include - ${BOOST_ROOT} - ${_boost_INCLUDE_SEARCH_DIRS}) +set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS) +_Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC}) +# Clear Boost_INCLUDE_DIR if it did not change but other input affecting the +# location did. We will find a new one based on the new inputs. +if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED) + unset(Boost_INCLUDE_DIR CACHE) endif() -# prepend BOOST_INCLUDEDIR to search path if specified -if( BOOST_INCLUDEDIR ) - file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) - set(_boost_INCLUDE_SEARCH_DIRS - ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) -endif() +if(NOT Boost_INCLUDE_DIR) + set(_boost_INCLUDE_SEARCH_DIRS "") + if(BOOST_INCLUDEDIR) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR}) + elseif(_ENV_BOOST_INCLUDEDIR) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR}) + endif() -# ------------------------------------------------------------------------ -# Search for Boost include DIR -# ------------------------------------------------------------------------ -# Try to find Boost by stepping backwards through the Boost versions -# we know about. -if( NOT Boost_INCLUDE_DIR ) + if( BOOST_ROOT ) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) + elseif( _ENV_BOOST_ROOT ) + list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT}) + endif() + + if( Boost_NO_SYSTEM_PATHS) + list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH) + else() + list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS + C:/boost/include + C:/boost + /sw/local/include + ) + endif() + + # Try to find Boost by stepping backwards through the Boost versions + # we know about. # Build a list of path suffixes for each version. set(_boost_PATH_SUFFIXES) foreach(_boost_VER ${_boost_TEST_VERSIONS}) @@ -718,7 +741,6 @@ if( NOT Boost_INCLUDE_DIR ) NAMES boost/config.hpp HINTS ${_boost_INCLUDE_SEARCH_DIRS} PATH_SUFFIXES ${_boost_PATH_SUFFIXES} - ${_boost_FIND_OPTIONS} ) endif() @@ -742,9 +764,6 @@ if(Boost_INCLUDE_DIR) string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") unset(_boost_VERSION_HPP_CONTENTS) - set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") - set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") - if(NOT "${Boost_VERSION}" STREQUAL "0") math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") @@ -767,6 +786,18 @@ endif() # Suffix initialization and compiler suffix detection. # ------------------------------------------------------------------------ +set(_Boost_VARS_NAME + Boost_COMPILER + Boost_THREADAPI + Boost_USE_DEBUG_PYTHON + Boost_USE_MULTITHREADED + Boost_USE_STATIC_LIBS + Boost_USE_STATIC_RUNTIME + Boost_USE_STLPORT + Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS + ) +_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) + # Setting some more suffixes for the library set(Boost_LIB_PREFIX "") if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) @@ -848,35 +879,44 @@ endif() # ------------------------------------------------------------------------ # Begin finding boost libraries # ------------------------------------------------------------------------ - -if(BOOST_ROOT) - set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS - ${BOOST_ROOT}/lib - ${BOOST_ROOT}/stage/lib) +set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR) +_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR) +# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the +# location did. We will find a new one based on the new inputs. +if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED) + unset(Boost_LIBRARY_DIR CACHE) endif() -set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS - ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} - ${Boost_INCLUDE_DIR}/lib - ${Boost_INCLUDE_DIR}/../lib - ${Boost_INCLUDE_DIR}/stage/lib -) -set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM - C:/boost/lib - C:/boost - /sw/local/lib -) -set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) -if( Boost_NO_SYSTEM_PATHS ) - set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + +if(Boost_LIBRARY_DIR) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) else() - list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) -endif() + set(_boost_LIBRARY_SEARCH_DIRS "") + if(BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR}) + elseif(_ENV_BOOST_LIBRARYDIR) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR}) + endif() + + if(BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) + elseif(_ENV_BOOST_ROOT) + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) + endif() -# prepend BOOST_LIBRARYDIR to search path if specified -if( BOOST_LIBRARYDIR ) - file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) - set(_boost_LIBRARY_SEARCH_DIRS - ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) + list(APPEND _boost_LIBRARY_SEARCH_DIRS + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib + ) + if( Boost_NO_SYSTEM_PATHS ) + list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH) + else() + list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS + C:/boost/lib + C:/boost + /sw/local/lib + ) + endif() endif() if(Boost_DEBUG) @@ -928,11 +968,21 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS) endif() endif() +# If the user changed any of our control inputs flush previous results. +if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) + foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + foreach(c DEBUG RELEASE) + set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c}) + unset(${_var} CACHE) + set(${_var} "${_var}-NOTFOUND") + endforeach() + endforeach() + set(_Boost_COMPONENTS_SEARCHED "") +endif() + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) - set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) - set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") set( _boost_docstring_release "Boost ${COMPONENT} library (release)") set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") @@ -961,12 +1011,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") endif() - find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE - NAMES ${_boost_RELEASE_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} - ${_boost_FIND_OPTIONS} - DOC "${_boost_docstring_release}" - ) + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + NAMES_PER_DIR + DOC "${_boost_docstring_release}" + ) # # Find DEBUG libraries @@ -993,12 +1043,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") endif() - find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG - NAMES ${_boost_DEBUG_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS} - ${_boost_FIND_OPTIONS} - DOC "${_boost_docstring_debug}" - ) + _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + NAMES_PER_DIR + DOC "${_boost_docstring_debug}" + ) if(Boost_REALPATH) _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") @@ -1025,9 +1075,8 @@ endif() # for libraries... # ------------------------------------------------------------------------ -set(Boost_INCLUDE_DIRS - ${Boost_INCLUDE_DIR} -) +set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) +set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR}) set(Boost_FOUND FALSE) if(Boost_INCLUDE_DIR) @@ -1157,7 +1206,7 @@ if(Boost_INCLUDE_DIR) endif() if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") + set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) endif() endif() @@ -1204,8 +1253,39 @@ else() endif() endif() -# show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view -mark_as_advanced(Boost_INCLUDE_DIR - Boost_INCLUDE_DIRS - Boost_LIBRARY_DIRS -) +# Configure display of cache entries in GUI. +foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) + get_property(_type CACHE ${v} PROPERTY TYPE) + if(_type) + set_property(CACHE ${v} PROPERTY ADVANCED 1) + if("x${_type}" STREQUAL "xUNINITIALIZED") + if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS") + set_property(CACHE ${v} PROPERTY TYPE STRING) + else() + set_property(CACHE ${v} PROPERTY TYPE PATH) + endif() + endif() + endif() +endforeach() + +# Record last used values of input variables so we can +# detect on the next run if the user changed them. +foreach(v + ${_Boost_VARS_INC} ${_Boost_VARS_LIB} + ${_Boost_VARS_DIR} ${_Boost_VARS_NAME} + ) + if(DEFINED ${v}) + set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") + else() + unset(_${v}_LAST CACHE) + endif() +endforeach() + +# Maintain a persistent list of components requested anywhere since +# the last flush. +set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}") +list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS}) +list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) +list(SORT _Boost_COMPONENTS_SEARCHED) +set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" + CACHE INTERNAL "Components requested for this build tree.") -- cgit v0.12 From 0100f88e298c6766d60108537010ede0f83da1dd Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 11:15:32 -0400 Subject: FindBoost: Construct a clean Boost_LIBRARIES value Construct the value from scratch based on the component library list. Avoid accumulating values from repeated find_package(Boost) calls. If Boost is not found, Boost_LIBRARIES should be empty. --- Modules/FindBoost.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 1a9dfbd..a2036a6 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1219,6 +1219,7 @@ endif() # Notification to end user about what was found # ------------------------------------------------------------------------ +set(Boost_LIBRARIES "") if(Boost_FOUND) if(NOT Boost_FIND_QUIETLY) message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") @@ -1232,7 +1233,7 @@ if(Boost_FOUND) if(NOT Boost_FIND_QUIETLY) message (STATUS " ${COMPONENT}") endif() - set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) + list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY}) endif() endforeach() else() -- cgit v0.12 From 4d92f6ca339a782ba96dadf75a94e7ec5492a56f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Sep 2012 15:31:41 -0400 Subject: FindBoost: Refactor Boost_FOUND computation and version check Construct an initial Boost_FOUND value immediately after searching for Boost_INCLUDE_DIR. Base the result only on whether header files for the requested version were found. Then after searching for component libraries update Boost_FOUND based on whether all requested components were found. --- Modules/FindBoost.cmake | 158 ++++++++++++++++++------------------------------ 1 file changed, 60 insertions(+), 98 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index a2036a6..083d8c8 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -417,17 +417,6 @@ function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) endfunction() # -# A convenience function for marking desired components -# as found or not -# -function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no}) - endforeach() -endfunction() - -# # Take a list of libraries with "thread" in it # and prepend duplicates with "thread_${Boost_THREADAPI}" # at the front of the list @@ -748,36 +737,71 @@ endif() # Extract version information from version.hpp # ------------------------------------------------------------------------ +# Set Boost_FOUND based only on header location and version. +# It will be updated below for component libraries. if(Boost_INCLUDE_DIR) - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - # Read the whole file: - # - set(BOOST_VERSION 0) - set(BOOST_LIB_VERSION "") - file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") endif() - string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") - string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") + # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp + set(Boost_VERSION 0) + set(Boost_LIB_VERSION "") + file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") + set(_Boost_VERSION_REGEX "([0-9]+)") + set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") + foreach(v VERSION LIB_VERSION) + if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*") + set(Boost_${v} "${CMAKE_MATCH_1}") + endif() + endforeach() unset(_boost_VERSION_HPP_CONTENTS) - if(NOT "${Boost_VERSION}" STREQUAL "0") - math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") - endif() + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "version.hpp reveals boost " "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") endif() + + if(Boost_FIND_VERSION) + # Set Boost_FOUND based on requested version. + set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}") + set(Boost_FOUND 0) + set(_Boost_VERSION_AGE "old") + elseif(Boost_FIND_VERSION_EXACT AND + NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}") + set(Boost_FOUND 0) + set(_Boost_VERSION_AGE "new") + else() + set(Boost_FOUND 1) + endif() + if(NOT Boost_FOUND) + # State that we found a version of Boost that is too new or too old. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + if (Boost_FIND_VERSION_PATCH) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") + endif () + if (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") + endif () + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + endif () + else() + # Caller will accept any Boost version. + set(Boost_FOUND 1) + endif() else() + set(Boost_FOUND 0) set(Boost_ERROR_REASON "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") endif() @@ -1068,78 +1092,13 @@ endif() # End finding boost libraries # ------------------------------------------------------------------------ -# ------------------------------------------------------------------------ -# Begin long process of determining Boost_FOUND, starting with version -# number checks, followed by -# TODO: Ideally the version check logic should happen prior to searching -# for libraries... -# ------------------------------------------------------------------------ - set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR}) -set(Boost_FOUND FALSE) -if(Boost_INCLUDE_DIR) - set( Boost_FOUND TRUE ) - - if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND FALSE ) - set(_Boost_VERSION_AGE "old") - endif() - endif() - endif() - - if (NOT Boost_FOUND) - _Boost_MARK_COMPONENTS_FOUND(OFF) - endif() - - if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) - # If the user requested an exact version of Boost, check - # that. We already know that the Boost version we have is >= the - # requested version. - set(_Boost_VERSION_AGE "new") - - # If the user didn't specify a patchlevel, it's 0. - if (NOT Boost_FIND_VERSION_PATCH) - set(Boost_FIND_VERSION_PATCH 0) - endif () - - # We'll set Boost_FOUND true again if we have an exact version match. - set(Boost_FOUND FALSE) - _Boost_MARK_COMPONENTS_FOUND(OFF) - if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) - if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) - if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) - set( Boost_FOUND TRUE ) - _Boost_MARK_COMPONENTS_FOUND(ON) - endif() - endif() - endif() - endif () - - if(NOT Boost_FOUND) - # State that we found a version of Boost that is too new or too old. - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") - endif () - if (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") - endif () - set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") - endif () - - # Always check for missing components +# The above setting of Boost_FOUND was based only on the header files. +# Update it for the requested component libraries. +if(Boost_FOUND) + # The headers were found. Check for requested component libs. set(_boost_CHECKED_COMPONENT FALSE) set(_Boost_MISSING_COMPONENTS "") foreach(COMPONENT ${Boost_FIND_COMPONENTS}) @@ -1148,7 +1107,6 @@ if(Boost_INCLUDE_DIR) if(NOT Boost_${COMPONENT}_FOUND) string(TOLOWER ${COMPONENT} COMPONENT) list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) - set( Boost_FOUND FALSE) endif() endforeach() @@ -1157,6 +1115,7 @@ if(Boost_INCLUDE_DIR) endif() if (_Boost_MISSING_COMPONENTS) + set(Boost_FOUND 0) # We were unable to find some libraries, so generate a sensible # error message that lists the libraries we were unable to find. set(Boost_ERROR_REASON @@ -1210,9 +1169,12 @@ if(Boost_INCLUDE_DIR) endif() endif() - else() - set( Boost_FOUND FALSE) + # Boost headers were not found so no components were found. + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(Boost_${UPPERCOMPONENT}_FOUND 0) + endforeach() endif() # ------------------------------------------------------------------------ -- cgit v0.12 From 0496782418867b47729c735f2b9ea1520b2e6aea Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Sep 2012 10:02:44 -0400 Subject: FindBoost: Rewrite documentation Write new documentation for this module. Ensure that it formats correctly in "cmake --help-module FindBoost" output. Show the basic form of calling find_package(Boost). Document all result variables, input variables, and cache variables appropriately grouped together. Explain the search process and how it re-runs when changes are made. Explain the difference between finding headers/libraries versus finding a "Boost CMake" package configuraiton file. Drop the emphasis on Boost_ADDITIONAL_VERSIONS because the implementation should predict most future versions instead. --- Modules/FindBoost.cmake | 377 +++++++++++++++++------------------------------- 1 file changed, 135 insertions(+), 242 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 083d8c8..8d8b10c 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1,245 +1,138 @@ -# - Try to find Boost include dirs and libraries -# Usage of this module as follows: -# -# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below. -# Due to Boost naming conventions and limitations in CMake this find -# module is NOT future safe with respect to Boost version numbers, -# and may break. -# -# == Using Header-Only libraries from within Boost: == -# -# find_package( Boost 1.36.0 ) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# endif() -# -# -# == Using actual libraries from within Boost: == -# -# set(Boost_USE_STATIC_LIBS ON) -# set(Boost_USE_MULTITHREADED ON) -# set(Boost_USE_STATIC_RUNTIME OFF) -# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) -# -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# target_link_libraries(foo ${Boost_LIBRARIES}) -# endif() -# -# -# The components list needs to contain actual names of boost libraries only, -# such as "date_time" for "libboost_date_time". If you're using parts of -# Boost that contain header files only (e.g. foreach) you do not need to -# specify COMPONENTS. -# -# You should provide a minimum version number that should be used. If you provide this -# version number and specify the REQUIRED attribute, this module will fail if it -# can't find the specified or a later version. If you specify a version number this is -# automatically put into the considered list of version numbers and thus doesn't need -# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below). -# -# NOTE for Visual Studio Users: -# Automatic linking is used on MSVC & Borland compilers by default when -# #including things in Boost. It's important to note that setting -# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking, -# should you need this feature. Automatic linking typically uses static -# libraries with a few exceptions (Boost.Python is one). -# -# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for -# more details. Adding a target_link_libraries() as shown in the example -# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS -# gets set to OFF. It is suggested you avoid automatic linking since it -# will make your application less portable. -# -# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============ -# -# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of -# boost version numbers that should be taken into account when searching -# for Boost. Unfortunately boost puts the version number into the -# actual filename for the libraries, so this variable will certainly be needed -# in the future when new Boost versions are released. -# -# Currently this module searches for the following version numbers: -# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, -# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, -# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0, -# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0, -# 1.49, 1.49.0, 1.50, 1.50.0, 1.51, 1.51.0, 1.52, 1.52.0, -# 1.53, 1.53.0, 1.54, 1.54.0, 1.55, 1.55.0, 1.56, 1.56.0 -# -# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should -# add both 1.x and 1.x.0 as shown above. Official Boost include directories -# omit the 3rd version number from include paths if it is 0 although not all -# binary Boost releases do so. -# -# set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") -# -# ===================================== ============= ======================== -# -# Variables used by this module, they can change the default behaviour and -# need to be set before calling find_package: -# -# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded -# boost libraries. If not specified, defaults -# to ON. -# -# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static -# boost libraries. Defaults to OFF. -# -# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system -# paths (or other locations outside of BOOST_ROOT -# or BOOST_INCLUDEDIR). Useful when specifying -# BOOST_ROOT. Defaults to OFF. -# [Since CMake 2.8.3] -# -# Boost_NO_BOOST_CMAKE Do not do a find_package call in config mode -# before searching for a regular boost install. -# This will avoid finding boost-cmake installs. -# Defaults to OFF. -# [Since CMake 2.8.6] -# -# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries -# linked against a static C++ standard library -# ('s' ABI tag). This option should be set to -# ON or OFF because the default behavior -# if not specified is platform dependent -# for backwards compatibility. -# [Since CMake 2.8.3] -# -# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries -# compiled against a special debug build of -# Python ('y' ABI tag). Defaults to OFF. -# [Since CMake 2.8.3] -# -# Boost_USE_STLPORT If enabled, searches for boost libraries -# compiled against the STLPort standard -# library ('p' ABI tag). Defaults to OFF. -# [Since CMake 2.8.3] -# -# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS -# If enabled, searches for boost libraries -# compiled against the deprecated STLPort -# "native iostreams" feature ('n' ABI tag). -# Defaults to OFF. -# [Since CMake 2.8.3] -# -# Other Variables used by this module which you may want to set. -# -# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching -# the boost include directory. Please see -# the documentation above regarding this -# annoying, but necessary variable :( -# -# Boost_DEBUG Set this to TRUE to enable debugging output -# of FindBoost.cmake if you are having problems. -# Please enable this before filing any bug -# reports. -# -# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information -# about why it failed or how to fix the problem -# unless this is set to TRUE or the REQUIRED -# keyword is specified in find_package(). -# [Since CMake 2.8.0] -# -# Boost_COMPILER Set this to the compiler suffix used by Boost -# (e.g. "-gcc43") if FindBoost has problems finding -# the proper Boost installation -# -# Boost_THREADAPI When building boost.thread, sometimes the name of the -# library contains an additional "pthread" or "win32" -# string known as the threadapi. This can happen when -# compiling against pthreads on Windows or win32 threads -# on Cygwin. You may specify this variable and if set -# when FindBoost searches for the Boost threading library -# it will first try to match the threadapi you specify. -# For Example: libboost_thread_win32-mgw45-mt-1_43.a -# might be found if you specified "win32" here before -# falling back on libboost_thread-mgw45-mt-1_43.a. -# [Since CMake 2.8.3] -# -# Boost_REALPATH Resolves symbolic links for discovered boost libraries -# to assist with packaging. For example, instead of -# Boost_SYSTEM_LIBRARY_RELEASE being resolved to -# "/usr/lib/libboost_system.so" it would be -# "/usr/lib/libboost_system.so.1.42.0" instead. -# This does not affect linking and should not be -# enabled unless the user needs this information. -# [Since CMake 2.8.3] -# - - -# -# These last three variables are available also as environment variables: -# Also, note they are completely UPPERCASE, except Boost_DIR. -# -# Boost_DIR or The preferred installation prefix for searching for -# BOOST_ROOT or BOOSTROOT Boost. Set this if the module has problems finding -# the proper Boost installation. -# -# Note that Boost_DIR behaves exactly as _DIR -# variables are documented to behave in find_package's -# Config mode. That is, if it is set as a -D argument -# to CMake, it must point to the location of the -# BoostConfig.cmake or Boost-config.cmake file. If it -# is set as an environment variable, it must point to -# the root of the boost installation. BOOST_ROOT and -# BOOSTROOT, on the other hand, will point to the root -# in either case. -# -# To prevent falling back on the system paths, set -# Boost_NO_SYSTEM_PATHS to true. -# -# To avoid finding boost-cmake installations, set -# Boost_NO_BOOST_CMAKE to true. -# -# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the -# module has problems finding the proper Boost installation -# -# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the -# module has problems finding the proper Boost installation -# -# Boost_INCLUDE_DIR CMake cache entries storing Boost include directory -# Boost_LIBRARY_DIR and library directory. -# -# Variables defined by this module: -# -# Boost_FOUND System has Boost, this means the include dir was -# found, as well as all the libraries specified in -# the COMPONENTS list. -# -# Boost_INCLUDE_DIRS Boost include directories -# -# Boost_LIBRARIES Link to these to use the Boost libraries that you -# specified: not cached -# -# Boost_LIBRARY_DIRS The path to where the Boost library files are. -# -# Boost_VERSION The version number of the boost libraries that -# have been found, same as in version.hpp from Boost -# -# Boost_LIB_VERSION The version number in filename form as -# it's appended to the library filenames -# -# Boost_MAJOR_VERSION major version number of boost -# Boost_MINOR_VERSION minor version number of boost -# Boost_SUBMINOR_VERSION subminor version number of boost -# -# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call -# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) -# to have diagnostic information about Boost's -# automatic linking outputted during compilation time. -# -# For each component you specify in find_package(), the following (UPPER-CASE) -# variables are set. You can use these variables if you would like to pick and -# choose components for your targets instead of just using Boost_LIBRARIES. -# -# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. -# -# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost -# "component" (includes debug and optimized keywords -# when needed). +# - Find Boost include dirs and libraries +# Use this module by invoking find_package with the form: +# find_package(Boost +# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 +# [REQUIRED] # Fail with error if Boost is not found +# [COMPONENTS ...] # Boost libraries by their canonical name +# ) # e.g. "date_time" for "libboost_date_time" +# This module finds headers and requested component libraries OR a CMake +# package configuration file provided by a "Boost CMake" build. For the +# latter case skip to the "Boost CMake" section below. For the former +# case results are reported in variables: +# Boost_FOUND - True if headers and requested libraries were found +# Boost_INCLUDE_DIRS - Boost include directories +# Boost_LIBRARY_DIRS - Link directories for Boost libraries +# Boost_LIBRARIES - Boost component libraries to be linked +# Boost__FOUND - True if component was found ( is upper-case) +# Boost__LIBRARY - Libraries to link for component (may include +# target_link_libraries debug/optimized keywords) +# Boost_VERSION - BOOST_VERSION value from boost/version.hpp +# Boost_LIB_VERSION - Version string appended to library filenames +# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) +# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) +# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) +# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) +# - Pass to add_definitions() to have diagnostic +# information about Boost's automatic linking +# displayed during compilation +# +# This module reads hints about search locations from variables: +# BOOST_ROOT - Preferred installation prefix +# (or BOOSTROOT) +# BOOST_INCLUDEDIR - Preferred include directory e.g. /include +# BOOST_LIBRARYDIR - Preferred library directory e.g. /lib +# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not +# specified by these hint variables. Default is OFF. +# Boost_ADDITIONAL_VERSIONS +# - List of Boost versions not known to this module +# (Boost install locations may contain the version) +# and saves search results persistently in CMake cache entries: +# Boost_INCLUDE_DIR - Directory containing Boost headers +# Boost_LIBRARY_DIR - Directory containing Boost libraries +# Boost__LIBRARY_DEBUG - Component library debug variant +# Boost__LIBRARY_RELEASE - Component library release variant +# Users may set the these hints or results as cache entries. Projects should +# not read these entries directly but instead use the above result variables. +# Note that some hint names start in upper-case "BOOST". One may specify +# these as environment variables if they are not specified as CMake variables +# or cache entries. +# +# This module first searches for the Boost header files using the above hint +# variables (excluding BOOST_LIBRARYDIR) and saves the result in +# Boost_INCLUDE_DIR. Then it searches for requested component libraries using +# the above hints (excluding BOOST_INCLUDEDIR and Boost_ADDITIONAL_VERSIONS), +# "lib" directories near Boost_INCLUDE_DIR, and the library name configuration +# settings below. It saves the library directory in Boost_LIBRARY_DIR and +# individual library locations in Boost__LIBRARY_DEBUG and +# Boost__LIBRARY_RELEASE. When one changes settings used by previous +# searches in the same build tree (excluding environment variables) this +# module discards previous search results affected by the changes and searches +# again. +# +# Boost libraries come in many variants encoded in their file name. Users or +# projects may tell this module which variant to find by setting variables: +# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded +# libraries ('mt' tag). Default is ON. +# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static +# libraries. Default is OFF. +# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use +# libraries linked statically to the C++ runtime +# ('s' tag). Default is platform dependent. +# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a +# debug Python build ('y' tag). Default is OFF. +# Boost_USE_STLPORT - Set to ON to use libraries compiled with +# STLPort ('p' tag). Default is OFF. +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# - Set to ON to use libraries compiled with +# STLPort deprecated "native iostreams" +# ('n' tag). Default is OFF. +# Boost_COMPILER - Set to the compiler-specific library suffix +# (e.g. "-gcc43"). Default is auto-computed +# for the C++ compiler in use. +# Boost_THREADAPI - Suffix for "thread" component library name, +# such as "pthread" or "win32". Names with +# and without this suffix will both be tried. +# Other variables one may set to control this module are: +# Boost_DEBUG - Set to ON to enable debug output from FindBoost. +# Please enable this before filing any bug report. +# Boost_DETAILED_FAILURE_MSG +# - Set to ON to add detailed information to the +# failure message even when the REQUIRED option +# is not given to the find_package call. +# Boost_REALPATH - Set to ON to resolve symlinks for discovered +# libraries to assist with packaging. For example, +# the "system" component library may be resolved to +# "/usr/lib/libboost_system.so.1.42.0" instead of +# "/usr/lib/libboost_system.so". This does not +# affect linking and should not be enabled unless +# the user needs this information. +# On Visual Studio and Borland compilers Boost headers request automatic +# linking to corresponding libraries. This requires matching libraries to be +# linked explicitly or available in the link library search path. In this +# case setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking. +# Boost automatic linking typically requests static libraries with a few +# exceptions (such as Boost.Python). Use +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# to ask Boost to report information about automatic linking requests. +# +# Example to find Boost headers only: +# find_package(Boost 1.36.0) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# Example to find Boost headers and some libraries: +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# Boost CMake ---------------------------------------------------------- +# +# If Boost was built using the boost-cmake project it provides a package +# configuration file for use with find_package's Config mode. This module +# looks for the package configuration file called BoostConfig.cmake or +# boost-config.cmake and stores the result in cache entry "Boost_DIR". If +# found, the package configuration file is loaded and this module returns with +# no further action. See documentation of the Boost CMake package +# configuration for details on what it provides. +# +# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. #============================================================================= # Copyright 2006-2012 Kitware, Inc. -- cgit v0.12 From 11a07649acaa43c6faf7d4603a310a4da32950a9 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 2 Oct 2012 11:49:39 -0400 Subject: CMake 2.8.10-rc1 --- ChangeLog.manual | 358 ++++++++++++++++++++++++++++++++++++++++++++++ Source/CMakeVersion.cmake | 6 +- 2 files changed, 361 insertions(+), 3 deletions(-) diff --git a/ChangeLog.manual b/ChangeLog.manual index cdab442..9ce0596 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,361 @@ +Changes in CMake 2.8.10-rc1 (since 2.8.9) +----------------------------------------- +Scripted Changes (3): + Remove trailing whitespace from most CMake and C/C++ code + Convert CMake-language commands to lower case + Remove CMake-language block-end command arguments + +Alex Neundorf (27): + Eclipse: add support for the 4.2 Juno release (#13367) + Eclipse: improve (fix ?) version detection on OSX + Eclipse: fix #13358: don't create bad linked resources + Eclipse: fix #13358: don't create bad linked resources + remove non-working KDE4 test + Eclipse on OSX: fix handling of framework include dirs (#13464) + Eclipse on OSX: improve handling of framework include dirs (#13367) + -fix line length + fix #13474: also rescan dependencies if the depender does not exist + -fix line length + -fix Java dependency scanning, broken in previous commit + error out if CTEST_USE_LAUNCHERS is TRUE but RULE_LAUNCH_* are not set + fix #13494: rerun automoc also if include dirs or moc options change + CMakeDetermineFortranCompiler: add support for cross-compiling (#13379) + Automoc: fix #13493, use target properties for include dirs + Automoc: do not use DEFINITIONS, but only COMPILE_DEFINITIONS + Automoc: also the makefile-COMPILE_DEFINITIONS + cmGlobalGenerator.h: some minor coding style fixes + Modules/readme.txt: fix typo + find_package: add support for a _NOT_FOUND_MESSAGE variable + exports: store pointers to all installations of each export set + exports: accept a missing target if it is exported exactly once + exports: first try at error handling if a target is missing + exports: fix build with MSVC6 + exports: move the handling of missing targets into subclasses + exports: define a CMAKE_FIND_PACKAGE_NAME var set by find_package() + exports: add a test for exporting dependent targets + +Andreas Mohr (1): + FindCURL: Find older MSVC prebuilts + +Andy Piper (1): + Do not include directories which are part of the package install prefix. + +Benjamin Eikel (21): + Initial version of find module + FindSDL: Add version support for FindSDL_net + FindSDL: Version support for FindSDL_image + FindSDL: Use prefix SDL_NET, because it matches the file name. + FindSDL: Use SDL_IMAGE prefix for varibales + FindSDL: Add "cmake_minimum_required" to "try_compile" project + FindSDL: Format the documentation + FindSDL: Version support for FindSDL_sound + FindSDL: Use same capitalization for FPHSA as file name + FindSDL: Pass SDL_SOUND_LIBRARY to FIND_PACKAGE_HANDLE_STANDARD_ARGS + FindSDL: Use SDL_MIXER prefix for variables + FindSDL: Add version support for FindSDL_mixer + FindSDL: Update documentation + FindSDL: Use SDL_TTF prefix for variables + FindSDL: Add version support for FindSDL_ttf + FindSDL: Update documentation + FindSDL: Format documentation + FindSDL: Add version support + FindSDL: Add my copyright tag to all FindSDL_* modules + FindSDL: Remove from find_... calls PATHS that are set by default + FindSDL: Stay compatible with old input variables + +Bill Hoffman (8): + Use OUTPUT_NORMAL instead of OUTPUT_MERGE for cmake -E chdir. + curl: Use find_package(OpenSSL) + curl: Make OpenSSL DLLs available to CMake on Windows + file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH + file(DOWNLOAD): Add options for SSL + Utilities/Release: Enable CMAKE_USE_OPENSSL in nightly binaries + Add SSL_VERIFYPEER and CAINFO file options to ExternalProject_Add. + Revert "Ninja: don't expand any rsp files" + +Brad King (83): + find_library: Add test covering lib->lib64 cases + find_library: Refactor lib->lib64 conversion + find_library: Simplify lib->lib expansion + find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419) + CMakeDetermine(C|CXX)Compiler: Consider Clang compilers + Factor common code out of CMakeDetermine(ASM|C|CXX|Fortran)Compiler + Prefer generic system compilers by default for C, C++, and Fortran + Xcode: Fix object library references in multi-project trees (#13452) + Xcode: Run xcode-select to find Xcode version file (#13463) + Watcom: Simplify compiler version detection (#11866) + Remove trailing TAB from NSIS.template.in + Fix WarnUnusedUnusedViaUnset test pass/fail regex + CMakeVersion.bash: Update sed expression for lower-case 'set' + GetPrerequisites: Mark file_cmd as advanced cache entry + Add boolean generator expressions + Add $ boolean query generator expression + Recognize Clang ASM support (#13473) + Xcode: Set ASM source language in project file (#13472) + Tests/Assembler: Do not use assembler in universal binaries + Add FindHg module to find Mercurial + ExternalProject: Add Mercurial (hg) repository support + Qt4Macros: Fix recently broken resource file parsing + Tests/ObjectLibrary: Do not enable CXX in subdirectories + VS11: Rename 'Immersive' to 'WindowsAppContainer' (#12930) + VS: Disable precompiled headers unless enabled by project (#12930) + VS11: Generate flag tables from MSBuild V110 tool files + Detect Compaq compiler version with its id + Detect PathScale compiler version with its id + Detect TI compiler version with its id + Detect Comeau compiler version with its id + Detect SDCC compiler version with its id + Detect Cray compiler version with its id + Detect Analog VisualDSP++ compiler version with its id + Re-order C/C++/Fortran compiler determination logic + CMakeDetermineCompilerId: Prepare to detect IDE compiler id + Xcode: Detect the compiler id and tool location + VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable + VS: Detect the compiler id and tool location + Cleanly enable a language in multiple subdirectories + Test variables CMAKE_(C|CXX|Fortran)_COMPILER(|_ID|_VERSION) + Document CMAKE__COMPILER_(ID|VERSION) values + Make platform information files specific to the CMake version + Move CMAKE__COMPILER_WORKS to compiler information files + Store ABI detection results in compiler information files + VS: Remove support for "free" version 2003 tools + VS: Simplify MSVC version reporting + Modernize MSVC compiler information files + VS: Fix MSVC_IDE definition recently broken by refactoring + add_library: Document POSITION_INDEPENDENT_CODE default (#13479) + magrathea: Tell cmELF about DT_RUNPATH (#13497) + Utilities/Release: Link AIX binary with large maxdata + Utilities/xml: Add .gitattributes to disable whitespace checks + Utilities/xml: Add docbook-4.5 DTD (#13508) + docbook: Fix formatter naming convention to avoid shadow + docbook: Fix Sun CC warning on ptr_fun(isalnum) + curl: Honor OPENSSL_NO_SSL2 + if: Compare up to 8 components in VERSION tests + ExternalProject: Generalize URL_MD5 option to URL_HASH + Rename SSL terminology to TLS + file(DOWNLOAD): Make TLS options behave as documented + OS X: Add platform-specific Clang compiler info files (#13536) + VS11: Detect VS 2012 Express for default generator (#13348) + VS11: Add VS 2012 Express support (#13348) + file(DOWNLOAD): Add HTTP User-Agent string + ExternalProject: Add DOWNLOAD_NAME option + file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value + VS8: Remove '.NET' from generator description (#10158) + Clang: Split Compiler/Clang* modules out from GNU (#13550) + Clang: All versions know about -fPIE (#13550) + Xcode: Remove unused code reading CMAKE_OSX_SYSROOT_DEFAULT + OS X: Always generate -isysroot if any SDK is in use + OS X: Improve default CMAKE_OSX_SYSROOT selection + bootstrap: Suppress CMAKE_OSX_SYSROOT if CFLAGS have -isysroot + Tests/Assembler: Use CMAKE_OSX_SYSROOT to generate .s file + OS X: Allow CMAKE_OSX_SYSROOT to be a logical SDK name + OS X: Simplify selection of CMAKE_OSX_ARCHITECTURES + OS X: If CMAKE_OSX_SYSROOT is already set do not compute default + OS X: Further improve default CMAKE_OSX_SYSROOT selection + OS X: Teach deployment target sanity check about SDK names + OS X: Ignore MACOSX_DEPLOYMENT_TARGET during Xcode compiler id + Verify that PDB_(NAME|OUTPUT_DIRECTORY) are honored in test + Document that PDB_(NAME|OUTPUT_DIRECTORY) are ignored for VS 6 + Run PDBDirectoryAndName test on MSVC and Intel + +Clinton Stimpson (8): + fphsa: clarify message about minimum required version found. + DeployQt4: Include DESTDIR for some cpack generators. + Add -DNDEBUG to RelWithDebInfo flags where where Release flags had it. + Fix regex for qt minor version. + FindQt4: Give precedence to QTDIR environment variable, if set. + FindQt4: Give precedence to QTDIR environment variable, if set. + Fix errors detecting Qt4 on Windows 8. + cmake-gui: Fix error status when interrupted. + +Daniel Pfeifer (8): + Simplify CMake.HTML documentation test command line + docbook: Remove table of contents + docbook: Factor out code to write valid DocBook IDs + docbook: Fix the DocBook section output + docbook: Cleanup formatter and generated DocBook + docbook: Add support for at section level 1 + docbook: Add CMake.DocBook test to validate xml (#13508) + docbook: Remove redundant docs that cause invalid DocBook + +David Cole (9): + Begin post-2.8.9 development + Release: Temporarily exclude ExternalProject test on cygwin + Add ability to run as a ctest -S script also + CMake: Clarify the documentation for if(f1 IS_NEWER_THAN f2) + Convert the CPACK_CYGWIN_PATCH_NUMBER variable to a cache variable + InstallRequiredSystemLibraries: Use correct file names (#13315) + ProcessorCount: Mark find_program vars as advanced (#13236) + FindQt4: Avoid "finding" non-existent library in a .framework + FindMPI: Set correct variables for calls to FPHSA + +Eric NOULARD (2): + Enhance DESTDIR documentation. Fixes #0012374. + Handles %attr(nnn,-,-) /path/to/file in CPACK_RPM_USER_FILELIST properly. + +James Bigler (3): + Replace -g3 with -g for CUDA 4.1 and 4.2 in addition to CUDA < 3.0. + Added CUDA_SOURCE_PROPERTY_FORMAT. Allows setting per file format (OBJ or PTX) + FindCUDA: Added CUDA_HOST_COMPILER variable. + +Marcin Wojdyr (1): + Remove CMake multiline block-end command arguments + +Nils Gladitz (1): + ctest_update: Tell svn not to prompt interactively (#13024) + +Patrick Gansterer (4): + VS: Cleanup AddPlatformDefinitions() of Visual Studio generators + Add additional architectures to CMakePlatformId.h.in + Add WindowsCE platform information files + VS: Remove duplicated implementations of CreateLocalGenerator() + +Peter Kuemmel (1): + Ninja: don't expand any rsp files + +Peter Kümmel (15): + Ninja: cmcldeps needs a compiler + Ninja: don't crash on returned 0 pointer + Ninja: prepare msvc pdb cleanup + Ninja:split out setting of msvc TARGET_PDB + Ninja: remove GetTargetPDB because it is used only once + Ninja: also detect /showInclude prefix for icl + Find mingw's windres also when Unix Makefiles are used + Ninja: don't suppress warning about compiler options + Ninja: suppress cmcldeps only for source file signature try_compiles + Ninja: filter target specific compile flags with language specific regex + Ninja: OBJECT_DEPENDS should set an implicit dependency + Ninja: don't confuse ninja's rsp files with nmake's + Ninja: move -LIBPATH behind -link option + Ninja: move in front of the first linker option + Ninja: add option to enforce usage of response files + +Philip Lowman (3): + FindOpenSceneGraph: CMake variable OSG_DIR influences detection now too + FindGTK2: Add GTK2_CAIROMMCONFIG_INCLUDE_DIR for cairommconfig.h + CMakeDetermineVSServicePack: Visual Studio 2012 added + +Rolf Eike Beer (25): + remove lib64 Unix paths if the respective lib path is also given + FindOpenSSL: find cross-compiled OpenSSL from MinGW (#13431) + FindOpenSSL: use SelectLibraryConfigurations + FindOpenSSL: let CMake handle environment variable HINTS + FindOpenSSL: cleanup path hints + FindOpenSSL: remove leftover comment + SelectLibraryConfiguration: generate correct output when input vars are lists + Fix typo direcotry -> directory (and similar) [#13444] + FindSelfPackers: fix typo (#13456) + CheckTypeSize: show in documentation how to get struct member size (#10579) + CheckTypeSize: add a test for size of struct members + FindX11: remove duplicates from X11 include path list (#13316) + FindX11: avoid calling list(REMOVE_DUPLICATES) on an empty list + list command: error on too many arguments + CMake.List test: explicitely test with lists containing only an empty string + use the find_* functions ENV parameter + use PATH_SUFFIXES to simplify find_* calls + do not escape spaces in regular expressions + read less from version headers into variables + FindFLEX: fix version extraction on Apple + FindGettext: remove code duplicating FPHSA checks + include FPHSA from current directory in all modules + FindOpenSceneGraph: simplify by using more features of FPHSA + FindSDL: add SDLMAIN_LIBRARY only once (#13262) + add documentation for all MSVCxxx version variables (#12567) + +Sergei Nikulov (1): + fix for discovering ft2build.h using FREETYPE_DIR environment var (#13502) + +Stephen Kelly (60): + Add new qt4_use_modules function. + Add missing whitespace to docs. + Fix some typos in the docs. + Remove incorrect doc string for link type enum + Remove duplicate 'of' from docs. + Fix unfortunate documentation error for PIC feature. + Don't duplicate -D defines sent to the compiler. + Fix CompileDefinitions test on Visual Studio. + Fix the test setting COMPILE_DEFINITIONS target property + Rename files from main.cpp to more meaningful names. + Fix casing of 'Qt' in docs, comments and user-visible strings. + Read entire Qt4 qrc file when parsing for depends info. + Add a return-after-error if an old Qt is found. + Use CMake platform variables instead of Qt ones. + Move variable setting down to where it relates to. + Remove an if which is always true. + Use add_subdirectory instead of the obsolete subdirs. + Replace two include_directories with a setting. + Compile with both Qt4 and Qt5. + Build with Qt5 if it is found. + cmGeneratorExpression: Re-write for multi-stage evaluation + cmGeneratorExpression: Port users to two-stage processing + Fix the regular expression validator for target names. + Handle colons as a special case in the generator expression parser. + Enable deprecated API when using Qt 5. + Add more forwarding API to cmGeneratorTarget. + Store cmGeneratorTargets with the makefile. + Move GenerateTargetManifest to cmGeneratorTarget. + Move GetLinkInformation to cmGeneratorTarget + Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget. + Move GetCreateRuleVariable to cmGeneratorTarget. + Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget. + Move GetIncludeDirectories to cmGeneratorTarget. + Append the COMPILE_DEFINITIONS from the Makefile to all targets. + Add a wrapper for accessing config-specific compile-definitions. + Add convenience for getting a cmGeneratorTarget to use. + Fix compiler warning with initialization order. + Revert "Move GenerateTargetManifest to cmGeneratorTarget." + Use the cmGeneratorTarget for the include directories API. + Fix indentation in the code blocks generator. + Port remaining code to GetCompileDefinitions(). + Add include guard for cmGeneratorExpression. + Don't prepend a path before generator expressions in include_directories. + Convert paths in INCLUDE_DIRECTORIES property to Unix slashes. + Add an AppendDefines std::string overload. + Return a std::string from GetCompileDefinitions. + Refactor GetCompileDefinitions a bit. + Extend the generator expression language with more logic. + Add a generator expression for target properties. + Add API to check that dependent target properties form a DAG. + Add a self-reference check for target properties. + Early return if there is no target. + Process generator expressions in the INCLUDE_DIRECTORIES property. + Process generator expressions in the COMPILE_DEFINITIONS target property. + Fix the layout of the generator expression documentation. + Fix punctuation in some variables documentation. + Document that generator expressions can be used in target properties. + Remove unused parameter marker and the unused parameter. + Fix minor typos. + Remove period at the end of the check message. + +Tom Schutter (2): + cmake-mode.el: Use more readable regex and case-fold-search + cmake-mode.el: add local keybindings + +Xavier Besseron (7): + cmCTestSVN: Add the new SVNInfo structure + cmCTestSVN: Extend Revision struct with SVN repo information + cmCTestSVN: Add the Repositories list and the RootInfo pointer + cmCTestSVN: Create the SVNInfo for the root repository + cmCTestSVN: Use the SVNInfo structure + cmCTestSVN: Add a LoadExternal() function and an ExternalParser class + cmCTestSVN: Load and process information from externals + +Yuchen Deng (1): + Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830) + +Yury G. Kudryashov (7): + exports: Move cmTargetExport to a dedicated header file + exports: Remove cmTargetExport constructor + exports: Rename cmGlobalGenerator::AddTargetToExport{s,} + exports: Create class cmExportSet + exports: Add cmExportSetMap class + exports: Hold an ExportSet pointer in cm*Export*Generator + exports: cmGlobalGenerator::ExportSets destructor will clear it + +Zack Galbreath (2): + Clean up documentation formatting so that it is rendered properly in HTML. + cmparseMSBuildXML: Include DisplayName in the output + Changes in CMake 2.8.9 (since 2.8.9-rc3) ---------------------------------------- None diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 84cc45b..8bf8683 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,6 +1,6 @@ # CMake version number components. set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121002) -#set(CMake_VERSION_RC 1) +set(CMake_VERSION_PATCH 10) +set(CMake_VERSION_TWEAK 0) +set(CMake_VERSION_RC 1) -- cgit v0.12 From 6f68ef426e35d811f62dd89dd001229293ea89b2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Oct 2012 10:08:04 -0400 Subject: BSD: Do not require dlfcn.h to build shared libs (#13573) Remove ancient checks left from commit f5d95fb0 (Complete rework of makefile generators expect trouble, 2002-11-08). Modern FreeBSD and NetBSD platforms support shared libraries. When cross-compiling the /usr/include/dlfcn.h may not exist on the host but the toolchain still supports shared libraries. --- Modules/Platform/FreeBSD.cmake | 24 +++++++++++------------- Modules/Platform/NetBSD.cmake | 24 +++++++++++------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index cf18501..ce4d3ce 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -1,16 +1,14 @@ -if(EXISTS /usr/include/dlfcn.h) - set(CMAKE_DL_LIBS "") - set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") - set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") - set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") - set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -endif() +set(CMAKE_DL_LIBS "") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index 7318275..1004eb3 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -1,15 +1,13 @@ -if(EXISTS /usr/include/dlfcn.h) - set(CMAKE_DL_LIBS "") - set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") - set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") - set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath - set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") - set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -endif() +set(CMAKE_DL_LIBS "") +set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC") +set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE") +set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") +set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") include(Platform/UnixPaths) -- cgit v0.12 From 86a184d8bb936037ff35b94075981cb1d40d49cb Mon Sep 17 00:00:00 2001 From: Aleksey Avdeev Date: Tue, 16 Oct 2012 16:06:32 +0400 Subject: Add module FindIcotool This module looks for icotool. Signed-off-by: Aleksey Avdeev --- Modules/FindIcotool.cmake | 56 +++++++++++++++++++++++++++ Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 5 ++- 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 Modules/FindIcotool.cmake diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake new file mode 100644 index 0000000..8c10177 --- /dev/null +++ b/Modules/FindIcotool.cmake @@ -0,0 +1,56 @@ +# - Find icotool +# This module looks for icotool. This module defines the +# following values: +# ICOTOOL_EXECUTABLE: the full path to the icotool tool. +# ICOTOOL_FOUND: True if icotool has been found. +# ICOTOOL_VERSION_STRING: the version of icotool found. +# + +#============================================================================= +# Copyright 2012 Aleksey Avdeev +# +# 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.) + +find_program(ICOTOOL_EXECUTABLE + icotool +) + +if(ICOTOOL_EXECUTABLE) + execute_process( + COMMAND ${ICOTOOL_EXECUTABLE} --version + OUTPUT_VARIABLE _icotool_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*") + set( ICOTOOL_VERSION_STRING + "${CMAKE_MATCH_1}" + ) + else() + set( ICOTOOL_VERSION_STRING + "" + ) + endif() + unset(_icotool_version) +endif() + +# handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if +# all listed variables are TRUE +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + Icotool + REQUIRED_VARS ICOTOOL_EXECUTABLE + VERSION_VAR ICOTOOL_VERSION_STRING +) + +mark_as_advanced( + ICOTOOL_EXECUTABLE +) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 212c758..739593c 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -70,8 +70,9 @@ endmacro() # 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 HG HSPELL - JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB) +foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG + HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG + PostgreSQL TIFF ZLIB) check_version_string(${VTEST} ${VTEST}_VERSION_STRING) endforeach() -- cgit v0.12 From 668dda034f9dac763e3af745f5ca810d17d4a9a3 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 16 Oct 2012 19:45:16 -0400 Subject: CPack: Add automatic detection of the Unicode makensis (#9629) --- Source/CPack/cmCPackNSISGenerator.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index b2e57a2..fdbae35 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -356,18 +356,30 @@ int cmCPackNSISGenerator::InitializeInternal() << std::endl); std::vector path; std::string nsisPath; - bool gotRegValue = true; + bool gotRegValue = false; #ifdef _WIN32 - if ( !cmsys::SystemTools::ReadRegistryValue( + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, + cmsys::SystemTools::KeyWOW64_32) ) + { + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath) ) + { + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath, cmsys::SystemTools::KeyWOW64_32) ) { - if ( !cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) - { - gotRegValue = false; - } + gotRegValue = true; + } + if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) + { + gotRegValue = true; } if (gotRegValue) -- cgit v0.12 From fbda95883c3a86e5b808c78fa433bd9dbcc93754 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Wed, 17 Oct 2012 23:45:02 +0200 Subject: Eclipse: add switch to disable linked resources (#13189) Eclipse may get confused by these linked resources, because it sees the same source file multiple times then and doesn't recognize that it's the same file actually. Alex --- Modules/CMakeFindEclipseCDT4.cmake | 2 ++ Source/cmExtraEclipseCDT4Generator.cxx | 13 +++++++++++++ Source/cmExtraEclipseCDT4Generator.h | 1 + 3 files changed, 16 insertions(+) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index 37b72fa..ae17454 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -77,6 +77,8 @@ endif() # This variable is used by the Eclipse generator and appended to the make invocation commands. set(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j to get parallel builds") +set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES TRUE CACHE BOOL "If disabled, CMake will not generate linked resource to the subprojects and to the source files within targets") + # This variable is used by the Eclipse generator in out-of-source builds only. set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") mark_as_advanced(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 689f213..ca7379e 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -38,6 +38,7 @@ cmExtraEclipseCDT4Generator this->SupportedGlobalGenerators.push_back("Unix Makefiles"); this->SupportsVirtualFolders = true; + this->GenerateLinkedResources = true; } //---------------------------------------------------------------------------- @@ -83,6 +84,9 @@ void cmExtraEclipseCDT4Generator::Generate() this->HomeDirectory = mf->GetHomeDirectory(); this->HomeOutputDirectory = mf->GetHomeOutputDirectory(); + this->GenerateLinkedResources = mf->IsOn( + "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES"); + this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory); this->GenerateSourceProject = (this->IsOutOfSourceBuild && @@ -501,6 +505,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( linkName2 += ti->first; this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", VirtualFolder); + if (!this->GenerateLinkedResources) + { + break; // skip generating the linked resources to the source files + } std::vector sourceGroups=makefile->GetSourceGroups(); // get the files from the source lists then add them to the groups cmTarget* tgt = const_cast(&ti->second); @@ -555,6 +563,11 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( cmGeneratedFileStream& fout, const std::string& baseDir) { + if (!this->GenerateLinkedResources) + { + return; + } + // for each sub project create a linked resource to the source dir // - only if it is an out-of-source build this->AppendLinkedResource(fout, "[Subprojects]", diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 37ce65e..31ad68d 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -109,6 +109,7 @@ private: std::string HomeOutputDirectory; bool IsOutOfSourceBuild; bool GenerateSourceProject; + bool GenerateLinkedResources; bool SupportsVirtualFolders; }; -- cgit v0.12 From 2fb2a09c0ebaf98807a765e413c683cfcd874b3f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 18 Oct 2012 00:01:04 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6a0145b..b910306 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121017) +set(CMake_VERSION_TWEAK 20121018) #set(CMake_VERSION_RC 1) -- cgit v0.12 From f1189ee60e78fb4a5fd1fb8c3337efdf6f5d602f Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 18 Oct 2012 14:53:01 -0400 Subject: CMake 2.8.10-rc2 --- ChangeLog.manual | 66 +++++++++++++++++++++++++++++++++++++++++++++++ Source/CMakeVersion.cmake | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/ChangeLog.manual b/ChangeLog.manual index 9ce0596..a7fd2db 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,69 @@ +Changes in CMake 2.8.10-rc2 (since 2.8.10-rc1) +---------------------------------------------- +Alex Neundorf (2): + Document CMAKE_FIND_PACKAGE_NAME + Automoc: fix #13572: issue with symbolic links + +Brad King (4): + cmCTestSVN: Fix compilation with Sun CC 5.1 + if: Document that plain 'NOTFOUND' is a false constant + string: Clarify regex documentation of '-' behavior + FortranCInterface: Pass all flags to VERIFY project (#13579) + +David Cole (1): + NSIS: Fix incorrect uninstall registry key name (#13578) + +Eric NOULARD (3): + CPACK_XX_ON_ABSOLUTE_INSTALL_DESTINATION is now properly checked for ON/OFF + Document CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY and fix some typo. + Make CPACK_SET_DESTDIR work with archive generator + component-based packaging + +Jean-Christophe Fillion-Robin (1): + CTest: Ensure CTEST_USE_LAUNCHERS behaves nicely in Superbuild setup + +Pere Nubiola i Radigales (1): + Find PostgreSQL headers on Debian + +Peter Kümmel (4): + Ninja: also set OBJECT_DIR when compiling + Ninja: don't pollute current dir when using gui (#13495) + Ninja: implicit dependency for custom command files + Fix regression: write compile definitions if any + +Philip Lowman (4): + FindGTK2: Rollback lib64 changes which broke header file finding + FindGTK2: #12049 fix detection of header files on multiarch systems + FindGTK2: #12596 Missing paths for FindGTK2 on NetBSD + FindGTK2: Update local changelog + +Rolf Eike Beer (6): + CTest: fix usage of memory checker with spaces in path + CTest: fix pre and post test commands with spaces + CTest: add tests that simulate memcheck runs + CTest: improve memory checker type detection + CTest: add a test for CTEST_CUSTOM_MEMCHECK_IGNORE + CTest: add a check with a quoted memory checker + +Stephen Kelly (18): + GenEx: It is not an error to specify an empty parameter + GenEx: Return after error reported. + GenEx: Report actual target name not found, not "0" each time. + GenEx: Parse comma after colon tokens specially + GenEx: Validate target and property names. + GenEx: Ensure that the empty CONFIGURATION can be used conditionally. + GenEx: Add test for $ with empty parameter. + GenEx: Add tests for "0" and "1" expressions with literal commas. + GenEx: Don't use std::vector::at(int). + Attempt to fix the compile of cmake on Sun CC. + GenEx: Parse colon after arguments separator colon specially. + GenEx: Test the use of generator expressions to generate lists. + GenEx: Fix termination bugs in generator expression parser. + GenEx: Break if there are no more commas in the container + GenEx: Add some more asserts to verify code-sanity. + GenEx: Replace some failing tests with Borland and NMake makefiles. + GenEx: Fix reporting about not-found include directories and libraries. + Fix config-specific INCLUDE_DIRECTORIES in multi-config generators + Changes in CMake 2.8.10-rc1 (since 2.8.9) ----------------------------------------- Scripted Changes (3): diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8bf8683..54bab40 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -3,4 +3,4 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) set(CMake_VERSION_TWEAK 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_RC 2) -- cgit v0.12 From 4c5db6ce6c2bb90f0f7eaa54f31e35767d9e5816 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 19 Oct 2012 00:01:04 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b910306..38106a6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121018) +set(CMake_VERSION_TWEAK 20121019) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 1cd2ec1072bb5508293aff602f2bc320660daf87 Mon Sep 17 00:00:00 2001 From: Thomas Arcila Date: Fri, 19 Oct 2012 13:44:46 -0400 Subject: SelectLibraryConfigurations: Fix foreach(x IN LISTS ...) syntax In commit 5797512c (SelectLibraryConfiguration: generate correct output when input vars are lists, 2012-07-28) the "IN" keyword was left out. --- Modules/SelectLibraryConfigurations.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index dbff487..da927c9 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -54,10 +54,10 @@ macro( select_library_configurations basename ) # is set, then set optimized and debug options. if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) set( ${basename}_LIBRARY ) - foreach( _libname LISTS ${basename}_LIBRARY_RELEASE ) + foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) endforeach() - foreach( _libname LISTS ${basename}_LIBRARY_DEBUG ) + foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) list( APPEND ${basename}_LIBRARY debug "${_libname}" ) endforeach() set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) -- cgit v0.12 From 62d58bf52c4f2c33bbdd5fb2f5a6c1b513d36200 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 20 Oct 2012 00:01:05 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 38106a6..873245d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121019) +set(CMake_VERSION_TWEAK 20121020) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 4bacff7a4c1fa26d7c1fb93471578c8f67c96fdc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 20 Oct 2012 14:14:20 +0200 Subject: GenEx: Test early determination of AND and OR It should be possible for example to do this: "$,$" such that it works simliarly to the C code: if (foo && tgt && tgt->prop()) { } The example of generator expression code is a little bit contrived as it could be written other ways with the same functionality. Nevertheless, as these cases already work and are intentional, test for them. --- Tests/GeneratorExpression/CMakeLists.txt | 4 ++++ Tests/GeneratorExpression/check.cmake | 2 ++ Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt | 9 +++++++++ Tests/RunCMake/GeneratorExpression/BadAND.cmake | 1 + Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt | 9 +++++++++ Tests/RunCMake/GeneratorExpression/BadOR.cmake | 1 + 6 files changed, 26 insertions(+) diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 891fa11..581d483 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -14,6 +14,9 @@ add_custom_target(check ALL -Dtest_and_1=$ -Dtest_and_1_0=$ -Dtest_and_1_1=$ + # Ordinarily, the 'invalidcontent' would cause an error, but + # the '0' makes the AND abort early. + -Dtest_and_0_invalidcontent=$ -Dtest_config_0=$x> -Dtest_config_1=$> -Dtest_not_0=$ @@ -24,6 +27,7 @@ add_custom_target(check ALL -Dtest_or_1=$ -Dtest_or_1_0=$ -Dtest_or_1_1=$ + -Dtest_or_1_invalidcontent=$ -Dtest_bool_notfound=$ -Dtest_bool_foo_notfound=$ -Dtest_bool_true=$ diff --git a/Tests/GeneratorExpression/check.cmake b/Tests/GeneratorExpression/check.cmake index 8ffa481..88a60ce 100644 --- a/Tests/GeneratorExpression/check.cmake +++ b/Tests/GeneratorExpression/check.cmake @@ -15,6 +15,7 @@ check(test_and_0_1 "0") check(test_and_1 "1") check(test_and_1_0 "0") check(test_and_1_1 "1") +check(test_and_0_invalidcontent "0") check(test_config_0 "0") check(test_config_1 "1") check(test_not_0 "1") @@ -25,6 +26,7 @@ check(test_or_0_1 "1") check(test_or_1 "1") check(test_or_1_0 "1") check(test_or_1_1 "1") +check(test_or_1_invalidcontent "1") check(test_bool_notfound "0") check(test_bool_foo_notfound "0") check(test_bool_true "1") diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt index 36302db..0e48ba4 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -41,4 +41,13 @@ CMake Error at BadAND.cmake:1 \(add_custom_target\): Parameters to \$ must resolve to either '0' or '1'. Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake index 265e414..8a7993f 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -4,4 +4,5 @@ add_custom_target(check ALL COMMAND check $ $ $ + $ VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt index d4ccab7..eb26328 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -41,4 +41,13 @@ CMake Error at BadOR.cmake:1 \(add_custom_target\): Parameters to \$ must resolve to either '0' or '1'. Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + Parameters to \$ must resolve to either '0' or '1'. +Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake index 0813400..c0309da 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -4,4 +4,5 @@ add_custom_target(check ALL COMMAND check $ $ $ + $ VERBATIM) -- cgit v0.12 From df5c1db8c0abf0b82f6b7c1289b0325323517333 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 21 Oct 2012 00:01:05 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 873245d..b4971ae 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121020) +set(CMake_VERSION_TWEAK 20121021) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 5052fbc93d8158e44d1a44f167ba00f39813b82f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 21 Oct 2012 15:17:20 +0200 Subject: SelectLibraryConfigurations: add testcase --- Tests/CMakeOnly/CMakeLists.txt | 2 + .../SelectLibraryConfigurations/CMakeLists.txt | 60 ++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index ba681d8..51a630f 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -27,6 +27,8 @@ endif() add_CMakeOnly_test(AllFindModules) +add_CMakeOnly_test(SelectLibraryConfigurations) + add_CMakeOnly_test(TargetScope) add_CMakeOnly_test(find_library) diff --git a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt new file mode 100644 index 0000000..b3b05c3 --- /dev/null +++ b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 2.8) + +project(SelectLibraryConfigurations NONE) + +include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) + +macro(check_slc basename expect) + message(STATUS "checking select_library_configurations(${basename})") + select_library_configurations(${basename}) + if (NOT ${basename}_LIBRARY STREQUAL "${expect}") + message(SEND_ERROR "select_library_configurations(${basename}) returned '${${basename}_LIBRARY}' but '${expect}' was expected") + endif () + if (NOT ${basename}_LIBRARY STREQUAL "${${basename}_LIBRARIES}") + message(SEND_ERROR "select_library_configurations(${basename}) LIBRARY: '${${basename}_LIBRARY}' LIBRARIES: '${${basename}_LIBRARIES}'") + endif () +endmacro(check_slc) + +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(NOTYPE_RELONLY_LIBRARY_RELEASE "opt") + check_slc(NOTYPE_RELONLY "opt") + + set(NOTYPE_DBGONLY_LIBRARY_DEBUG "dbg") + check_slc(NOTYPE_DBGONLY "dbg") + + set(NOTYPE_RELDBG_LIBRARY_RELEASE "opt") + set(NOTYPE_RELDBG_LIBRARY_DEBUG "dbg") + check_slc(NOTYPE_RELDBG "opt") + + set(CMAKE_BUILD_TYPE Debug) +endif () + +check_slc(empty "") + +set(OPTONLY_LIBRARY_RELEASE "opt") +check_slc(OPTONLY "opt") + +set(DBGONLY_LIBRARY_RELEASE "dbg") +check_slc(DBGONLY "dbg") + +set(OPTONLYLIST_LIBRARY_RELEASE "opt1;opt2") +check_slc(OPTONLYLIST "opt1;opt2") + +set(DBGONLYLIST_LIBRARY_RELEASE "dbg1;dbg2") +check_slc(DBGONLYLIST "dbg1;dbg2") + +set(OPT1DBG1_LIBRARY_RELEASE "opt") +set(OPT1DBG1_LIBRARY_DEBUG "dbg") +check_slc(OPT1DBG1 "optimized;opt;debug;dbg") + +set(OPT1DBG2_LIBRARY_RELEASE "opt") +set(OPT1DBG2_LIBRARY_DEBUG "dbg1;dbg2") +check_slc(OPT1DBG2 "optimized;opt;debug;dbg1;debug;dbg2") + +set(OPT2DBG1_LIBRARY_RELEASE "opt1;opt2") +set(OPT2DBG1_LIBRARY_DEBUG "dbg") +check_slc(OPT2DBG1 "optimized;opt1;optimized;opt2;debug;dbg") + +set(OPT2DBG2_LIBRARY_RELEASE "opt1;opt2") +set(OPT2DBG2_LIBRARY_DEBUG "dbg1;dbg2") +check_slc(OPT2DBG2 "optimized;opt1;optimized;opt2;debug;dbg1;debug;dbg2") -- cgit v0.12 From a22f4fabb7eb6a978c5f0ddf7988d1c57793f7e6 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 21 Oct 2012 15:24:25 +0200 Subject: SelectLibraryConfigurations: fix for release and debug libs being the same --- Modules/SelectLibraryConfigurations.cmake | 14 +++++++++----- Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt | 4 ++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Modules/SelectLibraryConfigurations.cmake b/Modules/SelectLibraryConfigurations.cmake index 82bb173..709f345 100644 --- a/Modules/SelectLibraryConfigurations.cmake +++ b/Modules/SelectLibraryConfigurations.cmake @@ -48,6 +48,15 @@ macro( select_library_configurations basename ) # if only the debug version was found, set the release value to be the # debug value. _set_library_name( ${basename} DEBUG RELEASE ) + + # Set a default case, which will come into effect if + # -no build type is set and the generator only supports one build type + # at a time (i.e. CMAKE_CONFIGURATION_TYPES is false) + # -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are the same + # -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are both empty + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) + if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE ) # if the generator supports configuration types or CMAKE_BUILD_TYPE @@ -61,11 +70,6 @@ macro( select_library_configurations basename ) list( APPEND ${basename}_LIBRARY debug "${_libname}" ) endforeach() set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) - else() - # If there are no configuration types or build type, just use - # the release version - set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) endif() endif() diff --git a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt index b3b05c3..5bf0f8a 100644 --- a/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt +++ b/Tests/CMakeOnly/SelectLibraryConfigurations/CMakeLists.txt @@ -37,6 +37,10 @@ check_slc(OPTONLY "opt") set(DBGONLY_LIBRARY_RELEASE "dbg") check_slc(DBGONLY "dbg") +set(SAME_LIBRARY_RELEASE "same") +set(SAME_LIBRARY_DEBUG "same") +check_slc(SAME "same") + set(OPTONLYLIST_LIBRARY_RELEASE "opt1;opt2") check_slc(OPTONLYLIST "opt1;opt2") -- cgit v0.12 From 9c42e9831d5e73b68467783c74c251b905b103d6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 22 Oct 2012 00:01:04 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b4971ae..12ab9e9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121021) +set(CMake_VERSION_TWEAK 20121022) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 0cc00b06d807a6cbdd74eb1f8f518c2266eecabc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 19 Oct 2012 16:07:01 +0200 Subject: Document LOCATION undefined behavior with use of LINKER_LANGUAGE. --- Source/cmDocumentLocationUndefined.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmDocumentLocationUndefined.h b/Source/cmDocumentLocationUndefined.h index d1be77a..9aecf21 100644 --- a/Source/cmDocumentLocationUndefined.h +++ b/Source/cmDocumentLocationUndefined.h @@ -16,8 +16,8 @@ "\n" \ "Do not set properties that affect the location of a target after " \ action ". These include properties whose names match " \ - "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?\" " \ - "or \"(IMPLIB_)?(PREFIX|SUFFIX)\". " \ + "\"(RUNTIME|LIBRARY|ARCHIVE)_OUTPUT_(NAME|DIRECTORY)(_)?\", " \ + "\"(IMPLIB_)?(PREFIX|SUFFIX)\", or \"LINKER_LANGUAGE\". " \ "Failure to follow this rule is not diagnosed and leaves the location " \ "of the target undefined." -- cgit v0.12 From 04421042b3eb5977208929ba01faf7816c2f8f69 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 10 Oct 2012 00:06:40 +0200 Subject: GenEx: Add an accessor for imported targets in a makefile. --- Source/cmMakefile.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 80a50d6..70cfe54 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -519,6 +519,10 @@ public: * Get the list of targets, const version */ const cmTargets &GetTargets() const { return this->Targets; } + const std::vector &GetOwnedImportedTargets() const + { + return this->ImportedTargetsOwned; + } const cmGeneratorTargetsType &GetGeneratorTargets() const { -- cgit v0.12 From 95d590ddbac80780f437252de4522b78f4069f45 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 10 Oct 2012 00:07:34 +0200 Subject: GenEx: Create cmGeneratorTargets for imported targets. We're going to need to link to them, and all the linking API is moving to cmGeneratorTarget. Skip imported targets when iterating over cmGeneratorTargets in places where we only want targets we build. The GetGeneratorTargets result now includes IMPORTED targets where it didn't before. The GetTargets result, which was what used to be called in these methods does not include IMPORTED targets. This doesn't relate to any known bugs, but in some future uses of GetGeneratorTargets it will be important, so starting the convention and being deliberate now is a good idea. --- Source/cmExtraEclipseCDT4Generator.cxx | 4 ++++ Source/cmGlobalGenerator.cxx | 10 ++++++++++ Source/cmLocalGenerator.cxx | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 689f213..96b8a09 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -889,6 +889,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const for (cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); ++l) { + if (l->first->IsImported()) + { + continue; + } std::vector includeDirs; const char *config = mf->GetDefinition("CMAKE_BUILD_TYPE"); (*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 23ec08a..b9de4d8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1108,6 +1108,16 @@ void cmGlobalGenerator::CreateGeneratorTargets() this->ComputeTargetObjects(gt); generatorTargets[t] = gt; } + + for(std::vector::const_iterator + j = mf->GetOwnedImportedTargets().begin(); + j != mf->GetOwnedImportedTargets().end(); ++j) + { + cmGeneratorTarget* gt = new cmGeneratorTarget(*j); + this->GeneratorTargets[*j] = gt; + generatorTargets[*j] = gt; + } + mf->SetGeneratorTargets(generatorTargets); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4f4f725..4952a8c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -745,6 +745,10 @@ void cmLocalGenerator for(cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); l++) { + if (l->first->IsImported()) + { + continue; + } cmGeneratorTarget& target = *l->second; switch(target.GetType()) { -- cgit v0.12 From e386992152ac3ba5fe2abb66a56ea6ae99d6e8f3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 19 Oct 2012 13:11:59 +0200 Subject: GexEx: Validate Target names and property names differently. In the unit test, use the same IMPORTED_LOCATION trick that the ExportImport test uses. --- Source/cmGeneratorExpressionEvaluator.cxx | 17 +++++++++++------ .../TargetIncludeDirectories/CMakeLists.txt | 11 +++++++++++ .../TargetIncludeDirectories/main.cpp | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 287066a..ee1b60a 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -277,8 +277,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "$ expression requires one or two parameters"); return std::string(); } - cmsys::RegularExpression nameValidator; - nameValidator.compile("^[A-Za-z0-9_.-]+$"); + cmsys::RegularExpression targetNameValidator; + // The ':' is supported to allow use with IMPORTED targets. At least + // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter. + targetNameValidator.compile("^[A-Za-z0-9_.:-]+$"); + cmsys::RegularExpression propertyNameValidator; + propertyNameValidator.compile("^[A-Za-z0-9_]+$"); cmGeneratorTarget* target = context->Target; std::string propertyName = *parameters.begin(); @@ -301,9 +305,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode std::string targetName = parameters.front(); propertyName = parameters[1]; - if (!nameValidator.find(targetName.c_str())) + if (!targetNameValidator.find(targetName.c_str())) { - if (!nameValidator.find(propertyName.c_str())) + if (!propertyNameValidator.find(propertyName.c_str())) { ::reportError(context, content->GetOriginalExpression(), "Target name and property name not supported."); @@ -335,7 +339,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return std::string(); } - if (!nameValidator.find(propertyName.c_str())) + if (!propertyNameValidator.find(propertyName.c_str())) { ::reportError(context, content->GetOriginalExpression(), "Property name not supported."); @@ -480,7 +484,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode std::string name = *parameters.begin(); cmsys::RegularExpression targetValidator; - targetValidator.compile("^[A-Za-z0-9_.-]+$"); + // The ':' is supported to allow use with IMPORTED targets. + targetValidator.compile("^[A-Za-z0-9_.:-]+$"); if (!targetValidator.find(name.c_str())) { ::reportError(context, content->GetOriginalExpression(), diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt index d71f92e..7cb1b42 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt @@ -17,6 +17,7 @@ create_header(bing) create_header(bung) create_header(arguments) create_header(list) +create_header(target) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -24,6 +25,7 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/bar") include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bang>") add_executable(TargetIncludeDirectories main.cpp) + set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat") set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo") set_property(TARGET TargetIncludeDirectories APPEND PROPERTY @@ -34,3 +36,12 @@ include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/bung>") include_directories("sing$<1:/ting>") include_directories("$<1:${CMAKE_CURRENT_BINARY_DIR}/arguments;${CMAKE_CURRENT_BINARY_DIR}/list>") + +add_library(somelib::withcolons UNKNOWN IMPORTED) +set_property(TARGET somelib::withcolons PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/target") +set_property(TARGET somelib::withcolons PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/target") + +set_property(TARGET TargetIncludeDirectories + APPEND PROPERTY INCLUDE_DIRECTORIES + "$" +) diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp index 030bb1c..90909d3 100644 --- a/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp +++ b/Tests/IncludeDirectories/TargetIncludeDirectories/main.cpp @@ -9,6 +9,7 @@ #include "ting.h" #include "arguments.h" #include "list.h" +#include "target.h" int main(int, char**) { -- cgit v0.12 From 2362bc8e80ee657dd733bbf4b698199ce3b656fe Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 23 Oct 2012 00:01:05 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 12ab9e9..e2442cd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121022) +set(CMake_VERSION_TWEAK 20121023) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 14561e3d350e006206a7427d8a1c428e553c42b8 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 22 Oct 2012 23:06:16 -0600 Subject: Fix for possible Rez errors when creating dmg. Rez appears to have a limit on the length of lines it processes. Break up long lines from a license file to avoid the error. --- Source/CPack/cmCPackDragNDropGenerator.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 78cb1b6..d973c01 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -442,7 +442,22 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, line.replace(pos, 1, "\\\""); pos = line.find('\"', pos+2); } - osf << " \"" << line << "\\n\"\n"; + // break up long lines to avoid Rez errors + std::vector lines; + const size_t max_line_length = 512; + for(size_t i=0; i line.size()) + line_length = line.size()-i; + lines.push_back(line.substr(i, line_length)); + } + + for(size_t i=0; i Date: Wed, 17 Oct 2012 15:51:59 +0200 Subject: BasicConfigVersion: Make docs refer to the macro, not the module name The -ExactVersion variant already refers to the macro, and I think it makes more sense anyway. --- Modules/BasicConfigVersion-AnyNewerVersion.cmake.in | 2 +- Modules/BasicConfigVersion-SameMajorVersion.cmake.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in index 9f7f03e..b1c4fdf 100644 --- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in +++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in @@ -1,5 +1,5 @@ # This is a basic version file for the Config-mode of find_package(). -# It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file() +# It is used by write_basic_package_version_file() as input file for configure_file() # to create a version-file which can be installed along a config.cmake file. # # The created file sets PACKAGE_VERSION_EXACT if the current version string and diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in index 7bcea88..4acd9bb 100644 --- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in +++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in @@ -1,5 +1,5 @@ # This is a basic version file for the Config-mode of find_package(). -# It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file() +# It is used by write_basic_package_version_file() as input file for configure_file() # to create a version-file which can be installed along a config.cmake file. # # The created file sets PACKAGE_VERSION_EXACT if the current version string and -- cgit v0.12 From f551fa62450379b41b510054948e097582538357 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 24 Oct 2012 00:01:07 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e2442cd..33d1411 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121023) +set(CMake_VERSION_TWEAK 20121024) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 52cd8e83d4c7dfefec2058e7afd3523cfa572ce9 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 24 Oct 2012 11:43:00 -0400 Subject: CMake 2.8.10-rc3 --- ChangeLog.manual | 16 ++++++++++++++++ Source/CMakeVersion.cmake | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog.manual b/ChangeLog.manual index a7fd2db..ecf03f5 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,19 @@ +Changes in CMake 2.8.10-rc3 (since 2.8.10-rc2) +---------------------------------------------- +Rolf Eike Beer (2): + SelectLibraryConfigurations: add testcase + SelectLibraryConfigurations: fix for release and debug libs being the same + +Stephen Kelly (5): + BasicConfigVersion: Make docs refer to the macro, not the module name + Document LOCATION undefined behavior with use of LINKER_LANGUAGE. + GenEx: Add an accessor for imported targets in a makefile. + GenEx: Create cmGeneratorTargets for imported targets. + GexEx: Validate Target names and property names differently. + +Thomas Arcila (1): + SelectLibraryConfigurations: Fix foreach(x IN LISTS ...) syntax + Changes in CMake 2.8.10-rc2 (since 2.8.10-rc1) ---------------------------------------------- Alex Neundorf (2): diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 54bab40..ab65d90 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -3,4 +3,4 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) set(CMake_VERSION_TWEAK 0) -set(CMake_VERSION_RC 2) +set(CMake_VERSION_RC 3) -- cgit v0.12 From 388a3216fc9d22531b40963a81d70900c602c7fc Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Oct 2012 13:33:46 -0400 Subject: Xcode: Fix ReRunCMake.make path to cmake.check_cache (#13603) The path must be either absolute or relative to the working directory from which the makefile will be loaded. In subprojects this is not relative to the top of the build tree. Reported-by: David Weese --- Source/cmGlobalXCodeGenerator.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 30d8f18..5b2ddd8 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -495,8 +495,12 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( (this->CurrentReRunCMakeMakefile.c_str()); makefileStream.SetCopyIfDifferent(true); makefileStream << "# Generated by CMake, DO NOT EDIT\n"; - makefileStream << cmake::GetCMakeFilesDirectoryPostSlash(); - makefileStream << "cmake.check_cache: "; + std::string checkCache = mf->GetHomeOutputDirectory(); + checkCache += "/"; + checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); + checkCache += "cmake.check_cache"; + makefileStream << this->ConvertToRelativeForMake(checkCache.c_str()) + << ": "; for(std::vector::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { -- cgit v0.12 From 7bb9395974c2edb078db908cc9c7f1c5752e2aff Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 24 Oct 2012 19:50:47 +0200 Subject: FindQt: improve version selection -make "find_package(Qt 3)" work -if DESIRED_QT_VERSION was set, but only the other Qt major version was found don't override the DESIRED_QT_VERSION set by the user --- Modules/FindQt.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 13f18fe..1a2e16c 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -56,6 +56,10 @@ if(GLOB_TEMP_VAR) endif() set(GLOB_TEMP_VAR) +if (Qt_FIND_VERSION) + set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}") +endif () + # now find qmake find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin") if(QT_QMAKE_EXECUTABLE_FINDQT) @@ -113,15 +117,15 @@ if(QT3_QGLOBAL_H_FILE) set(QT3_INSTALLED TRUE) endif() -if(QT3_INSTALLED AND QT4_INSTALLED ) +if(QT3_INSTALLED AND QT4_INSTALLED AND NOT DESIRED_QT_VERSION) # force user to pick if we have both set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4") else() # if only one found then pick that one - if(QT3_INSTALLED) + if(QT3_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 4) set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() - if(QT4_INSTALLED) + if(QT4_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 3) set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() endif() -- cgit v0.12 From 041fb29bd7b25a03ecf5aab2bb6737a10ab21e67 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 24 Oct 2012 19:52:58 +0200 Subject: FindQt: add some more places to look for Qt3 Qt3 may be e.g. in /usr/lib64/qt-3 or in /usr/lib/qt3, too. --- Modules/FindQt.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index 1a2e16c..5af3125 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -31,7 +31,7 @@ # License text for the above reference.) # look for signs of qt3 installations -file(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake) +file(GLOB GLOB_TEMP_VAR /usr/lib*/qt-3*/bin/qmake /usr/lib*/qt3*/bin/qmake) if(GLOB_TEMP_VAR) set(QT3_INSTALLED TRUE) endif() -- cgit v0.12 From 259cff94ff81f7b95b7375905fe0e0a292f70dda Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 25 Oct 2012 00:01:06 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 33d1411..467a73e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121024) +set(CMake_VERSION_TWEAK 20121025) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 415623581da722a1802d0dc800719bfc760733cc Mon Sep 17 00:00:00 2001 From: Thomas Klausner Date: Thu, 25 Oct 2012 07:51:53 -0400 Subject: KWIML: Teach ABI.h that VAX is big endian --- ABI.h.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ABI.h.in b/ABI.h.in index 060a520..f93ddba 100644 --- a/ABI.h.in +++ b/ABI.h.in @@ -414,6 +414,10 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. #elif defined(__SYSC_ZARCH__) # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG +/* VAX */ +#elif defined(__vax__) +# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG + /* Unknown CPU */ #elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN) # error "Byte order of target CPU unknown." -- cgit v0.12 From b2c631c7c84cd7ea77cfd3bdb6a3a42c8553025f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 26 Oct 2012 00:01:04 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 467a73e..e1c2073 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121025) +set(CMake_VERSION_TWEAK 20121026) #set(CMake_VERSION_RC 1) -- cgit v0.12 From c65a2ea6a83f274afc52ca6adc457dec069de064 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 26 Oct 2012 10:16:45 -0400 Subject: VS10: Refactor link options collection Avoid collecting the link options twice. Collect them once in a LinkOptions member and use it from both places. We already do this for compiler options with the ClOptions member. --- Source/cmIDEOptions.cxx | 11 +++ Source/cmIDEOptions.h | 1 + Source/cmVisualStudio10TargetGenerator.cxx | 142 +++++++++++++---------------- Source/cmVisualStudio10TargetGenerator.h | 3 + 4 files changed, 76 insertions(+), 81 deletions(-) diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index d9c0e87..76a60cf 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -177,3 +177,14 @@ void cmIDEOptions::RemoveFlag(const char* flag) { this->FlagMap.erase(flag); } + +//---------------------------------------------------------------------------- +const char* cmIDEOptions::GetFlag(const char* flag) +{ + std::map::iterator i = this->FlagMap.find(flag); + if(i != this->FlagMap.end()) + { + return i->second.c_str(); + } + return 0; +} diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index a5be8fb..e556bde 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -29,6 +29,7 @@ public: void AddDefines(const char* defines); void AddFlag(const char* flag, const char* value); void RemoveFlag(const char* flag); + const char* GetFlag(const char* flag); protected: // create a map of xml tags to the values they should have in the output diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1e37ca5..db03163 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -109,6 +109,11 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() { delete i->second; } + for(OptionsMap::iterator i = this->LinkOptions.begin(); + i != this->LinkOptions.end(); ++i) + { + delete i->second; + } if(!this->BuildFileStream) { return; @@ -181,6 +186,10 @@ void cmVisualStudio10TargetGenerator::Generate() { return; } + if(!this->ComputeLinkOptions()) + { + return; + } } cmMakefile* mf = this->Target->GetMakefile(); std::string path = mf->GetStartOutputDirectory(); @@ -1077,7 +1086,6 @@ void cmVisualStudio10TargetGenerator:: OutputLinkIncremental(std::string const& configName) { - std::string CONFIG = cmSystemTools::UpperCase(configName); // static libraries and things greater than modules do not need // to set this option if(this->Target->GetType() == cmTarget::STATIC_LIBRARY @@ -1085,72 +1093,19 @@ OutputLinkIncremental(std::string const& configName) { return; } - const char* linkType = "SHARED"; - if(this->Target->GetType() == cmTarget::EXECUTABLE) - { - linkType = "EXE"; - } + Options& linkOptions = *(this->LinkOptions[configName]); - // assume incremental linking - const char* incremental = "true"; - const char* linkLanguage = - this->Target->GetLinkerLanguage(configName.c_str()); - if(!linkLanguage) - { - cmSystemTools::Error - ("CMake can not determine linker language for target:", - this->Name.c_str()); - return; - } - std::string linkFlagVarBase = "CMAKE_"; - linkFlagVarBase += linkType; - linkFlagVarBase += "_LINKER_FLAGS"; - std::string flags = this-> - Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str()); - std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG; - flags += this-> - Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str()); - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 - || strcmp(linkLanguage, "Fortran") == 0) - { - std::string baseFlagVar = "CMAKE_"; - baseFlagVar += linkLanguage; - baseFlagVar += "_FLAGS"; - flags += this-> - Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str()); - std::string flagVar = baseFlagVar + std::string("_") + CONFIG; - flags += - Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); - } - const char* targetLinkFlags = this->Target->GetProperty("LINK_FLAGS"); - if(targetLinkFlags) - { - flags += " "; - flags += targetLinkFlags; - } - std::string flagsProp = "LINK_FLAGS_"; - flagsProp += CONFIG; - if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) - { - flags += " "; - flags += flagsConfig; - } - if(flags.find("INCREMENTAL:NO") != flags.npos) - { - incremental = "false"; - } + const char* incremental = linkOptions.GetFlag("LinkIncremental"); this->WritePlatformConfigTag("LinkIncremental", configName.c_str(), 3); - *this->BuildFileStream << incremental + *this->BuildFileStream << (incremental?incremental:"true") << "\n"; + linkOptions.RemoveFlag("LinkIncremental"); - const char* manifest = "true"; - if(flags.find("MANIFEST:NO") != flags.npos) - { - manifest = "false"; - } + const char* manifest = linkOptions.GetFlag("GenerateManifest"); this->WritePlatformConfigTag("GenerateManifest", configName.c_str(), 3); - *this->BuildFileStream << manifest + *this->BuildFileStream << (manifest?manifest:"true") << "\n"; + linkOptions.RemoveFlag("GenerateManifest"); } //---------------------------------------------------------------------------- @@ -1343,18 +1298,36 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) } } +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() +{ + if(this->Target->GetType() == cmTarget::EXECUTABLE || + this->Target->GetType() == cmTarget::SHARED_LIBRARY || + this->Target->GetType() == cmTarget::MODULE_LIBRARY) + { + std::vector const* configs = + this->GlobalGenerator->GetConfigurations(); + for(std::vector::const_iterator i = configs->begin(); + i != configs->end(); ++i) + { + if(!this->ComputeLinkOptions(*i)) + { + return false; + } + } + } + return true; +} -void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& - config) +//---------------------------------------------------------------------------- +bool +cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) { + cmsys::auto_ptr pOptions( + new Options(this->LocalGenerator, Options::Linker, + cmVSGetLinkFlagTable(this->LocalGenerator), 0, this)); + Options& linkOptions = *pOptions; - // static libraries and things greater than modules do not need - // to set this option - if(this->Target->GetType() == cmTarget::STATIC_LIBRARY - || this->Target->GetType() > cmTarget::MODULE_LIBRARY) - { - return; - } const char* linkLanguage = this->Target->GetLinkerLanguage(config.c_str()); if(!linkLanguage) @@ -1362,10 +1335,9 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& cmSystemTools::Error ("CMake can not determine linker language for target:", this->Name.c_str()); - return; + return false; } - this->WriteString("\n", 2); std::string CONFIG = cmSystemTools::UpperCase(config); const char* linkType = "SHARED"; @@ -1387,7 +1359,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& flags += " "; flags += stackVal; } - // assume incremental linking std::string linkFlagVarBase = "CMAKE_"; linkFlagVarBase += linkType; linkFlagVarBase += "_LINKER_FLAGS"; @@ -1411,10 +1382,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& flags += " "; flags += flagsConfig; } - cmVisualStudioGeneratorOptions - linkOptions(this->LocalGenerator, - cmVisualStudioGeneratorOptions::Linker, - cmVSGetLinkFlagTable(this->LocalGenerator), 0, this); if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { flags += " /SUBSYSTEM:WINDOWS"; @@ -1423,8 +1390,6 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& { flags += " /SUBSYSTEM:CONSOLE"; } - cmSystemTools::ReplaceString(flags, "/INCREMENTAL:YES", ""); - cmSystemTools::ReplaceString(flags, "/INCREMENTAL:NO", ""); std::string standardLibsVar = "CMAKE_"; standardLibsVar += linkLanguage; standardLibsVar += "_STANDARD_LIBRARIES"; @@ -1452,7 +1417,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& cmSystemTools::Error ("CMake can not compute cmComputeLinkInformation for target:", this->Name.c_str()); - return; + return false; } // add the libraries for the target to libs string cmComputeLinkInformation& cli = *pcli; @@ -1521,7 +1486,22 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& this->GeneratorTarget->ModuleDefinitionFile.c_str()); } - linkOptions.RemoveFlag("GenerateManifest"); + this->LinkOptions[config] = pOptions.release(); + return true; +} + +//---------------------------------------------------------------------------- +void +cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config) +{ + if(this->Target->GetType() == cmTarget::STATIC_LIBRARY + || this->Target->GetType() > cmTarget::MODULE_LIBRARY) + { + return; + } + Options& linkOptions = *(this->LinkOptions[config]); + this->WriteString("\n", 2); + linkOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); linkOptions.OutputFlagMap(*this->BuildFileStream, " "); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 308b9bd..55a850a 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -68,6 +68,8 @@ private: std::vector const & includes); void WriteRCOptions(std::string const& config, std::vector const & includes); + bool ComputeLinkOptions(); + bool ComputeLinkOptions(std::string const& config); void WriteLinkOptions(std::string const& config); void WriteMidlOptions(std::string const& config, std::vector const & includes); @@ -95,6 +97,7 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map OptionsMap; OptionsMap ClOptions; + OptionsMap LinkOptions; std::string PathToVcxproj; cmTarget* Target; cmGeneratorTarget* GeneratorTarget; -- cgit v0.12 From 035e7bd04ea620c813adcdf402de2c25b6ce7e9c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 26 Oct 2012 11:02:42 -0400 Subject: VS10: Honor /DELAYSIGN and /KEYFILE flags (#13601) Fix the VS 10 link flag map to name the project file entries correctly. The VS 11 link flag map already has the correct names. Generate the entries in the along with incremental linking options. Drop them from the element because VS does not use them. --- Source/cmVS10LinkFlagTable.h | 6 +++--- Source/cmVisualStudio10TargetGenerator.cxx | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h index c60e8eb..64febbb 100644 --- a/Source/cmVS10LinkFlagTable.h +++ b/Source/cmVS10LinkFlagTable.h @@ -182,8 +182,8 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0}, {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0}, {"Profile", "PROFILE", "", "true", 0}, - {"DelaySign", "DELAYSIGN:NO", "", "false", 0}, - {"DelaySign", "DELAYSIGN", "", "true", 0}, + {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0}, + {"LinkDelaySign", "DELAYSIGN", "", "true", 0}, {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0}, {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0}, @@ -294,7 +294,7 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {"MergeSections", "MERGE:", "Merge Sections", "", cmVS7FlagTable::UserValue}, - {"KeyFile", "KEYFILE:", + {"LinkKeyFile", "KEYFILE:", "Key File", "", cmVS7FlagTable::UserValue}, {"KeyContainer", "KEYCONTAINER:", diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index db03163..def4133 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1106,6 +1106,23 @@ OutputLinkIncremental(std::string const& configName) *this->BuildFileStream << (manifest?manifest:"true") << "\n"; linkOptions.RemoveFlag("GenerateManifest"); + + // Some link options belong here. Use them now and remove them so that + // WriteLinkOptions does not use them. + const char* flags[] = { + "LinkDelaySign", + "LinkKeyFile", + 0}; + for(const char** f = flags; *f; ++f) + { + const char* flag = *f; + if(const char* value = linkOptions.GetFlag(flag)) + { + this->WritePlatformConfigTag(flag, configName.c_str(), 3); + *this->BuildFileStream << value << "\n"; + linkOptions.RemoveFlag(flag); + } + } } //---------------------------------------------------------------------------- -- cgit v0.12 From 4322816b6b15746c191d55fdbffc62778f9d052a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 27 Oct 2012 00:01:12 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e1c2073..ef5c70f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121026) +set(CMake_VERSION_TWEAK 20121027) #set(CMake_VERSION_RC 1) -- cgit v0.12 From abe4edfad3c6e8c2f2e9c08117507089790b303b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 28 Oct 2012 00:01:09 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ef5c70f..0bddb7a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121027) +set(CMake_VERSION_TWEAK 20121028) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 2c8286e04f11476ddefcf1868bbeecb47a8e1230 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 29 Oct 2012 00:01:08 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0bddb7a..3dd42a9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121028) +set(CMake_VERSION_TWEAK 20121029) #set(CMake_VERSION_RC 1) -- cgit v0.12 From b518f2262b27060baf9bcab02a4f81cf06a9f596 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 30 Oct 2012 00:01:11 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3dd42a9..d298f9b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121029) +set(CMake_VERSION_TWEAK 20121030) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 854369fd45c2fe397637ff5daf687562d45d3896 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 30 Oct 2012 13:59:07 -0400 Subject: Document external language support policy Describe in "Modules/CMakeAddNewLanguage.txt" our policy for external language support. --- Modules/CMakeAddNewLanguage.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Modules/CMakeAddNewLanguage.txt b/Modules/CMakeAddNewLanguage.txt index 6a30dd8..612e1a3 100644 --- a/Modules/CMakeAddNewLanguage.txt +++ b/Modules/CMakeAddNewLanguage.txt @@ -1,3 +1,19 @@ +This file provides a few notes to CMake developers about how to add +support for a new language to CMake. It is also possible to place +these files in CMAKE_MODULE_PATH within an outside project to add +languages not supported by upstream CMake. However, this is not +a fully supported use case. + +The implementation behind the scenes of project/enable_language, +including the compiler/platform modules, is an *internal* API that +does not make any compatibility guarantees. It is not covered in the +official reference documentation that is versioned with the source code. +Maintainers of external language support are responsible for porting +it to each version of CMake as upstream changes are made. Since +the API is internal we will not necessarily include notice of any +changes in release notes. + + CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake -- cgit v0.12 From 29b0d5c73434303fafd4a27c9b7d6b1f82b2771b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 31 Oct 2012 00:01:02 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d298f9b..2d50a37 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20121030) +set(CMake_VERSION_TWEAK 20121031) #set(CMake_VERSION_RC 1) -- cgit v0.12 From c36622a45f55b296d0891d94a91372c320768be0 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 31 Oct 2012 10:59:55 -0400 Subject: CMake 2.8.10 --- ChangeLog.manual | 4 ++++ Source/CMakeVersion.cmake | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.manual b/ChangeLog.manual index ecf03f5..ef8571b 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,7 @@ +Changes in CMake 2.8.10 (since 2.8.10-rc3) +---------------------------------------------- +None + Changes in CMake 2.8.10-rc3 (since 2.8.10-rc2) ---------------------------------------------- Rolf Eike Beer (2): diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ab65d90..0894fa0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -3,4 +3,4 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) set(CMake_VERSION_TWEAK 0) -set(CMake_VERSION_RC 3) +#set(CMake_VERSION_RC 3) -- cgit v0.12 From c3b82f67703f00c89a223043e9e48a6b3e1c4aac Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 31 Oct 2012 15:03:16 -0400 Subject: Begin post-2.8.10 development --- Source/CMakeVersion.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0894fa0..9920b5b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 0) -#set(CMake_VERSION_RC 3) +set(CMake_VERSION_TWEAK 20121031) +#set(CMake_VERSION_RC 1) -- cgit v0.12 From d1f3bfe50ecf974c313d0e191475bc4ea18f0c9c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 24 Oct 2012 19:55:14 +0200 Subject: Tests: add MajorVersionSelection tests For things where we may have 2 major versions of the same software installed in parallel (think of Qt and Python) make sure our version selection gets this right. --- Tests/CMakeOnly/CMakeLists.txt | 18 +++++++++ .../CMakeOnly/MajorVersionSelection/CMakeLists.txt | 46 ++++++++++++++++++++++ Tests/CMakeOnly/Test.cmake.in | 6 ++- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 51a630f..832d7bd 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -38,3 +38,21 @@ add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake ) + +include(${CMAKE_SOURCE_DIR}/Modules/CMakeParseArguments.cmake) + +function(add_major_test module) + cmake_parse_arguments(MAJOR_TEST "NOLANG" "VERSION_VAR" "VERSIONS" ${ARGN}) + foreach (_version IN LISTS MAJOR_TEST_VERSIONS) + add_test(CMakeOnly.MajorVersionSelection-${module}_${_version} + ${CMAKE_CMAKE_COMMAND} + -DTEST=MajorVersionSelection-${module}_${_version} + -DTEST_SOURCE=MajorVersionSelection + "-DCMAKE_ARGS=-DMAJOR_TEST_MODULE=${module};-DMAJOR_TEST_VERSION=${_version};-DMAJOR_TEST_NO_LANGUAGES=${MAJOR_TEST_NOLANG};-DMAJOR_TEST_VERSION_VAR=${MAJOR_TEST_VERSION_VAR}" + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) + endforeach () +endfunction() + +add_major_test(PythonLibs VERSIONS 2 3 VERSION_VAR PYTHONLIBS_VERSION_STRING) +add_major_test(PythonInterp NOLANG VERSIONS 2 3 VERSION_VAR PYTHON_VERSION_STRING) diff --git a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt new file mode 100644 index 0000000..74f5451 --- /dev/null +++ b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 2.8) + +if (NOT MAJOR_TEST_MODULE OR NOT MAJOR_TEST_VERSION) + message(FATAL_ERROR "test selection variables not set up") +endif () + +if (MAJOR_TEST_NO_LANGUAGES) + project(major_detect_${MAJOR_TEST_MODULE}_${MAJOR_TEST_VERSION} NONE) +else () + project(major_detect_${MAJOR_TEST_MODULE}_${MAJOR_TEST_VERSION}) +endif () + +find_package(${MAJOR_TEST_MODULE} ${MAJOR_TEST_VERSION}) + +if (MAJOR_TEST_VERSION_VAR) + set(VERSION_VAR "${MAJOR_TEST_VERSION_VAR}") +else () + set(VERSION_VAR "${MAJOR_TEST_MODULE}_VERSION_STRING") +endif () + +string(TOUPPER "${MAJOR_TEST_MODULE}" MODULE_UPPER) + +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND "${VERSION_VAR}") + message(STATUS "${VERSION_VAR} is '${${VERSION_VAR}}'") + if ("${VERSION_VAR}" VERSION_LESS MAJOR_TEST_VERSION) + message(SEND_ERROR "Found version ${${VERSION_VAR}} is less than requested major version ${MAJOR_TEST_VERSION}") + endif () + math(EXPR V_PLUS_ONE "${MAJOR_TEST_VERSION} + 1") + if ("${VERSION_VAR}" VERSION_GREATER V_PLUS_ONE) + message(SEND_ERROR "Found version ${${VERSION_VAR}} is greater than requested major version ${MAJOR_TEST_VERSION}") + endif () +endif () + +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${MAJOR_TEST_MODULE}_VERSION_MAJOR) + message(STATUS "${MAJOR_TEST_MODULE}_VERSION_MAJOR is '${${MAJOR_TEST_MODULE}_VERSION_MAJOR}'") + if (NOT ${MAJOR_TEST_VERSION} EQUAL ${MAJOR_TEST_MODULE}_VERSION_MAJOR) + message(SEND_ERROR "We requested major version ${MAJOR_TEST_VERSION} but ${MAJOR_TEST_MODULE} set ${MAJOR_TEST_MODULE}_VERSION_MAJOR to ${${MAJOR_TEST_MODULE}_VERSION_MAJOR}") + endif () +endif () + +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${MODULE_UPPER}_VERSION_MAJOR) + message(STATUS "${MODULE_UPPER}_VERSION_MAJOR is '${${MODULE_UPPER}_VERSION_MAJOR}'") + if (NOT ${MAJOR_TEST_VERSION} EQUAL ${MODULE_UPPER}_VERSION_MAJOR) + message(SEND_ERROR "We requested major version ${MAJOR_TEST_VERSION} but ${MAJOR_TEST_MODULE} set ${MODULE_UPPER}_VERSION_MAJOR to ${${MODULE_UPPER}_VERSION_MAJOR}") + endif () +endif () diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in index 42af068..f76db1d 100644 --- a/Tests/CMakeOnly/Test.cmake.in +++ b/Tests/CMakeOnly/Test.cmake.in @@ -1,4 +1,8 @@ -set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST}") +if (NOT TEST_SOURCE) + set(TEST_SOURCE "${TEST}") +endif () + +set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST_SOURCE}") set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build") file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") -- cgit v0.12 From 4374441f3fa162931d7d59d2e18a7e0bd14de505 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 27 Oct 2012 11:07:31 -0600 Subject: PackageMaker: Enable postflight script in component mode (#12375) Previously, setting CPACK_POSTFLIGHT_SCRIPT had no effect in component mode, when CPACK_COMPONENTS_ALL was set. In component mode, a .mpkg is created that contains multiple .pkg's. Because postflight scripts only work in a .pkg, add another .pkg to the .mpkg and put the postflight script in that. This is the same approach taken by the PackageMaker GUI when adding a postflight script to a metapackage. --- Source/CPack/cmCPackComponentGroup.h | 4 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 126 +++++++++++++++++++------- Source/CPack/cmCPackPackageMakerGenerator.h | 3 + 3 files changed, 97 insertions(+), 36 deletions(-) diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 48d935c..abae372 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -42,7 +42,9 @@ public: class cmCPackComponent { public: - cmCPackComponent() : Group(0), TotalSize(0) { } + cmCPackComponent() : Group(0), IsRequired(true), IsHidden(false), + IsDisabledByDefault(false), IsDownloaded(false), + TotalSize(0) { } /// The name of the component (used to reference the component). std::string Name; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index edbe838..c617a3e 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -106,56 +106,101 @@ int cmCPackPackageMakerGenerator::PackageFiles() resDir += "/en.lproj"; } - - // Create directory structure - std::string preflightDirName = resDir + "/PreFlight"; - std::string postflightDirName = resDir + "/PostFlight"; const char* preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT"); const char* postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT"); const char* postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT"); - // if preflight or postflight scripts not there create directories - // of the same name, I think this makes it work - if(!preflight) + + if(this->Components.empty()) { - if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) + // Create directory structure + std::string preflightDirName = resDir + "/PreFlight"; + std::string postflightDirName = resDir + "/PostFlight"; + // if preflight or postflight scripts not there create directories + // of the same name, I think this makes it work + if(!preflight) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << preflightDirName.c_str() << std::endl); - return 0; + if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << preflightDirName.c_str() << std::endl); + return 0; + } + } + if(!postflight) + { + if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << postflightDirName.c_str() << std::endl); + return 0; + } + } + // if preflight, postflight, or postupgrade are set + // then copy them into the resource directory and make + // them executable + if(preflight) + { + this->CopyInstallScript(resDir.c_str(), + preflight, + "preflight"); + } + if(postflight) + { + this->CopyInstallScript(resDir.c_str(), + postflight, + "postflight"); + } + if(postupgrade) + { + this->CopyInstallScript(resDir.c_str(), + postupgrade, + "postupgrade"); } } - if(!postflight) + else if(postflight) { - if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) + // create a postflight component to house the script + this->PostFlightComponent.Name = "PostFlight"; + this->PostFlightComponent.DisplayName = "PostFlight"; + this->PostFlightComponent.Description = "PostFlight"; + this->PostFlightComponent.IsHidden = true; + + // empty directory for pkg contents + std::string packageDir = toplevel + "/" + PostFlightComponent.Name; + if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << postflightDirName.c_str() << std::endl); + "Problem creating component packages directory: " + << packageDir.c_str() << std::endl); return 0; } - } - // if preflight, postflight, or postupgrade are set - // then copy them into the resource directory and make - // them executable - if(preflight) - { - this->CopyInstallScript(resDir.c_str(), - preflight, - "preflight"); - } - if(postflight) - { - this->CopyInstallScript(resDir.c_str(), + + // create package + std::string packageFileDir = packageDirFileName + "/Contents/Packages/"; + if (!cmsys::SystemTools::MakeDirectory(packageFileDir.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating component PostFlight Packages directory: " + << packageFileDir.c_str() << std::endl); + return 0; + } + std::string packageFile = packageFileDir + + this->GetPackageName(PostFlightComponent); + if (!this->GenerateComponentPackage(packageFile.c_str(), + packageDir.c_str(), + PostFlightComponent)) + { + return 0; + } + + // copy postflight script into resource directory of .pkg + std::string resourceDir = packageFile + "/Contents/Resources"; + this->CopyInstallScript(resourceDir.c_str(), postflight, "postflight"); } - if(postupgrade) - { - this->CopyInstallScript(resDir.c_str(), - postupgrade, - "postupgrade"); - } if (!this->Components.empty()) { @@ -778,6 +823,11 @@ WriteDistributionFile(const char* metapackageFile) << std::endl; } } + if(!this->PostFlightComponent.Name.empty()) + { + choiceOut << "" << std::endl; + } choiceOut << "" << std::endl; // Create the actual choices @@ -792,6 +842,12 @@ WriteDistributionFile(const char* metapackageFile) { CreateChoice(compIt->second, choiceOut); } + + if(!this->PostFlightComponent.Name.empty()) + { + CreateChoice(PostFlightComponent, choiceOut); + } + this->SetOption("CPACK_PACKAGEMAKER_CHOICES", choiceOut.str().c_str()); // Create the distribution.dist file in the metapackage to turn it diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index 101813f..ba3d968 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -112,6 +112,9 @@ protected: // value. std::string EscapeForXML(std::string str); + // The PostFlight component when creating a metapackage + cmCPackComponent PostFlightComponent; + double PackageMakerVersion; double PackageCompatibilityVersion; }; -- cgit v0.12 From e496c5402193ee26fa245c1970f87d795f56bdab Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 28 Oct 2012 23:23:29 +0100 Subject: Linux/PA-RISC: Link with --unique=.text.* to help binutils There is a binutils bug that leads to errors like this: /usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.6.3/../../../../hppa2.0-unknown-linux-gnu/bin/ld: libCMakeLib.a(cmTarget.cxx.o)(.text+0x12084): cannot reach 00001d28__ZNSspLEPKc@@GLIBCXX_3.4+0, recompile with -ffunction-sections /usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.6.3/../../../../hppa2.0-unknown-linux-gnu/bin/ld: libCMakeLib.a(cmTarget.cxx.o)(.text+0x12084): cannot handle R_PARISC_PCREL17F for std::basic_string, std::allocator >::operator+=(char const*)@@GLIBCXX_3.4 /usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.6.3/../../../../hppa2.0-unknown-linux-gnu/bin/ld: final link failed: Bad value Until someone finds out what needs to be fixed in binutils this allows anyone to compile a working CMake even in debug mode. --- CompileFlags.cmake | 6 ++++++ bootstrap | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CompileFlags.cmake b/CompileFlags.cmake index b2044e4..20f5dec 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -62,3 +62,9 @@ endif () if (CMAKE_ANSI_CFLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") endif () + +# avoid binutils problem with large binaries, e.g. when building CMake in debug mode +# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230 +if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*") +endif () diff --git a/bootstrap b/bootstrap index 713f01f..a0529f2 100755 --- a/bootstrap +++ b/bootstrap @@ -93,6 +93,19 @@ else cmake_system_openvms=false fi +# Determine whether this is Linux +if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then + cmake_system_linux=true + # find out if it is a HP PA-RISC machine + if uname -m | grep parisc >/dev/null 2>&1; then + cmake_machine_parisc=true + else + cmake_machine_parisc=false + fi +else + cmake_system_linux=false +fi + # Choose the generator to use for bootstrapping. if ${cmake_system_mingw}; then # Bootstrapping from an MSYS prompt. @@ -678,6 +691,14 @@ if ${cmake_system_haiku}; then cmake_ld_flags="${LDFLAGS} -lroot -lbe" fi +if ${cmake_system_linux}; then + # avoid binutils problem with large binaries, e.g. when building CMake in debug mode + # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230 + if ${cmake_machine_parisc}; then + cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*" + fi +fi + #----------------------------------------------------------------------------- # Detect known toolchains on some platforms. cmake_toolchains='' -- cgit v0.12 From f5b3736ef3e3e87b60ac6b120a11b485a500a15f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 1 Nov 2012 00:01:05 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9920b5b..d67df65 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20121031) +set(CMake_VERSION_TWEAK 20121101) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 1295247cad992fc29427eb910d03d66ada9d41ee Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 2 Nov 2012 00:01:06 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d67df65..8b5eda1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20121101) +set(CMake_VERSION_TWEAK 20121102) #set(CMake_VERSION_RC 1) -- cgit v0.12 From d39bd3e6a8dc89637197c305102724c337b7fb0f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 3 Nov 2012 00:01:03 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8b5eda1..1dc4a30 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20121102) +set(CMake_VERSION_TWEAK 20121103) #set(CMake_VERSION_RC 1) -- cgit v0.12 From 314e7fb6e9a8fe48531c8c04de6eadd9333360ee Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 4 Nov 2012 00:01:06 -0400 Subject: CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1dc4a30..563b9aa 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20121103) +set(CMake_VERSION_TWEAK 20121104) #set(CMake_VERSION_RC 1) -- cgit v0.12