diff options
27 files changed, 397 insertions, 166 deletions
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index af799d6..0750592 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -7,7 +7,7 @@ # OPENSSL_FOUND - system has the OpenSSL library # OPENSSL_INCLUDE_DIR - the OpenSSL include directory # OPENSSL_LIBRARIES - The libraries needed to use OpenSSL -# OPENSSL_VERSION - This is set to $major.$minor.$revision (eg. 0.9.8) +# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s) #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -216,16 +216,40 @@ ELSE(WIN32 AND NOT CYGWIN) ENDIF(WIN32 AND NOT CYGWIN) if (OPENSSL_INCLUDE_DIR) - file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*") + if (_OPENSSL_VERSION) + set(OPENSSL_VERSION "${_OPENSSL_VERSION}") + elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") + file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str + REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") - string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1" OPENSSL_VERSION_MAJOR "${openssl_version_str}") - string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9]([0-9][0-9]).*$" "\\1" OPENSSL_VERSION_MINOR "${openssl_version_str}") - string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" OPENSSL_VERSION_PATCH "${openssl_version_str}") + # The version number is encoded as 0xMNNFFPPS: major minor fix patch status + # The status gives if this is a developer or prerelease and is ignored here. + # Major, minor, and fix directly translate into the version numbers shown in + # the string. The patch field translates to the single character suffix that + # indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so + # on. - string(REGEX REPLACE "^0" "" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}") - string(REGEX REPLACE "^0" "" OPENSSL_VERSION_PATCH "${OPENSSL_VERSION_PATCH}") + string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$" + "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}") + list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR) + list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR) + list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX) + list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH) - set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_PATCH}") + string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}") + string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_FIX "${OPENSSL_VERSION_FIX}") + + if (NOT OPENSSL_VERSION_PATCH STREQUAL "00") + # 96 is the ASCII code of 'a' minus 1 + math(EXPR OPENSSL_VERSION_PATCH_ASCII "${OPENSSL_VERSION_PATCH} + 96") + # Once anyone knows how OpenSSL would call the patch versions beyond 'z' + # this should be updated to handle that, too. This has not happened yet + # so it is simply ignored here for now. + string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING) + endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00") + + set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}") + endif (_OPENSSL_VERSION) endif (OPENSSL_INCLUDE_DIR) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 1acb021..b503357 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -33,9 +33,9 @@ # messages include information about the required version and the version # which has been actually found, both if the version is ok or not. # Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for -# a find_package(... NO_MODULE) call, in this case all the information -# provided by the config-mode of find_package() will be evaluated -# automatically. +# a find_package(... NO_MODULE) call. In this case VERSION_VAR will be set +# to <NAME>_VERSION and the macro will automatically check whether the +# Config module was found. # Via FAIL_MESSAGE a custom failure message can be specified, if this is not # used, the default message will be displayed. # diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index c47f583..ce58899 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -85,14 +85,12 @@ ### Common stuff #### set(PKG_CONFIG_VERSION 1) -set(PKG_CONFIG_FOUND 0) find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") mark_as_advanced(PKG_CONFIG_EXECUTABLE) -if(PKG_CONFIG_EXECUTABLE) - set(PKG_CONFIG_FOUND 1) -endif(PKG_CONFIG_EXECUTABLE) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(PkgConfig DEFAULT_MSG PKG_CONFIG_EXECUTABLE) # Unsets the given variables diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 5344304..1e1e493 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -7,6 +7,9 @@ # (vsprojects/Debug & vsprojects/Release) will be searched # for libraries and binaries. # +# PROTOBUF_IMPORT_DIRS - List of additional directories to be searched for +# imported .proto files. (New in CMake 2.8.8) +# # Defines the following variables: # # PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files) @@ -91,6 +94,16 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS) + foreach(DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + set(${SRCS}) set(${HDRS}) foreach(FIL ${ARGN}) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index a10ec23..d5a2a5e 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -26,14 +26,51 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +unset(_Python_NAMES) + +set(_PYTHON1_VERSIONS 1.6 1.5) +set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) + +if(PythonInterp_FIND_VERSION) + if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}") + string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ}) + unset(_PYTHON_FIND_OTHER_VERSIONS) + if(NOT PythonInterp_FIND_VERSION_EXACT) + foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) + list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) + endif() + endforeach() + endif(NOT PythonInterp_FIND_VERSION_EXACT) + unset(_PYTHON_FIND_MAJ_MIN) + unset(_PYTHON_FIND_MAJ) + else(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") + list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS}) + endif(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") +else(PythonInterp_FIND_VERSION) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) +endif(PythonInterp_FIND_VERSION) + +list(APPEND _Python_NAMES python) + # Search for the current active python version first -find_program(PYTHON_EXECUTABLE NAMES python) +find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS} - 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + ${_PYTHON_FIND_OTHER_VERSIONS} + ) + +unset(_PYTHON_FIND_OTHER_VERSIONS) +unset(_PYTHON1_VERSIONS) +unset(_PYTHON2_VERSIONS) +unset(_PYTHON3_VERSIONS) # Search for newest python version if python executable isn't found if(NOT PYTHON_EXECUTABLE) @@ -52,11 +89,15 @@ endif() # determine python version string if(PYTHON_EXECUTABLE) execute_process(COMMAND "${PYTHON_EXECUTABLE}" --version ERROR_VARIABLE _VERSION OUTPUT_QUIET ERROR_STRIP_TRAILING_WHITESPACE) - string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}") - string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") -endif() + if(_VERSION MATCHES "^Python [0-9]+\\.[0-9]+.*") + string(REPLACE "Python " "" PYTHON_VERSION_STRING "${_VERSION}") + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") + if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + endif() + endif() +endif(PYTHON_EXECUTABLE) # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index a6c2df8..21614fb 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -23,6 +23,7 @@ INCLUDE (CheckIncludeFiles) INCLUDE (CheckLibraryExists) +INCLUDE (CheckSymbolExists) SET(Threads_FOUND FALSE) # Do we have sproc? @@ -44,33 +45,41 @@ ELSE() # SET(CMAKE_HAVE_THREADS_LIBRARY) IF(NOT THREADS_HAVE_PTHREAD_ARG) - - # Do we have -lpthreads - CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) - IF(CMAKE_HAVE_PTHREADS_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") + # Check if pthread functions are in normal C library + CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE) + IF(CMAKE_HAVE_LIBC_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "") SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(Threads_FOUND TRUE) ENDIF() - # Ok, how about -lpthread - CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) - IF(CMAKE_HAVE_PTHREAD_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lpthread") - SET(Threads_FOUND TRUE) - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - ENDIF() + IF(NOT CMAKE_HAVE_THREADS_LIBRARY) + # Do we have -lpthreads + CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) + IF(CMAKE_HAVE_PTHREADS_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") + SET(CMAKE_HAVE_THREADS_LIBRARY 1) + SET(Threads_FOUND TRUE) + ENDIF() - IF(CMAKE_SYSTEM MATCHES "SunOS.*") - # On sun also check for -lthread - CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) - IF(CMAKE_HAVE_THR_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lthread") + # Ok, how about -lpthread + CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) + IF(CMAKE_HAVE_PTHREAD_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "-lpthread") SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(Threads_FOUND TRUE) ENDIF() - ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") + IF(CMAKE_SYSTEM MATCHES "SunOS.*") + # On sun also check for -lthread + CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) + IF(CMAKE_HAVE_THR_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "-lthread") + SET(CMAKE_HAVE_THREADS_LIBRARY 1) + SET(Threads_FOUND TRUE) + ENDIF() + ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") + ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) ENDIF(NOT THREADS_HAVE_PTHREAD_ARG) IF(NOT CMAKE_HAVE_THREADS_LIBRARY) @@ -111,7 +120,7 @@ ELSE() ENDIF(CMAKE_HAVE_PTHREAD_H) ENDIF() -IF(CMAKE_THREAD_LIBS_INIT) +IF(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) SET(CMAKE_USE_PTHREADS_INIT 1) SET(Threads_FOUND TRUE) ENDIF() diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 2efa079..8761f40 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -304,6 +304,26 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) endif(NOT resolved) if(NOT resolved) + if(item MATCHES "@rpath") + # + # @rpath references are relative to the paths built into the binaries with -rpath + # We handle this case like we do for other Unixes + # + string(REPLACE "@rpath/" "" norpath_item "${item}") + + set(ri "ri-NOTFOUND") + find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH) + if(ri) + #message(STATUS "info: 'find_file' in exepath/dirs (${ri})") + set(resolved 1) + set(resolved_item "${ri}") + set(ri "ri-NOTFOUND") + endif(ri) + + endif(item MATCHES "@rpath") + endif(NOT resolved) + + if(NOT resolved) set(ri "ri-NOTFOUND") find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH) find_file(ri "${item}" ${exepath} ${dirs} /usr/lib) @@ -461,6 +481,15 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) get_filename_component(path "${lower}" PATH) if("${original_path}" STREQUAL "${path}") set(is_local 1) + else() + string(LENGTH "${original_path}/" original_length) + string(LENGTH "${lower}" path_length) + if(${path_length} GREATER ${original_length}) + string(SUBSTRING "${lower}" 0 ${original_length} path) + if("${original_path}/" STREQUAL "${path}") + set(is_embedded 1) + endif() + endif() endif() endif() endif() diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 22ba28f..4eed477 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -910,6 +910,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args, if (newArgs.size() != 1) { errorString = "Unknown arguments specified"; + status = cmake::FATAL_ERROR; return false; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 14deb24..dca528d 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -350,33 +350,33 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) targetIt!=targetList.GetVector().end(); ++targetIt) { - // Lookup this target in the current directory. - if(cmTarget* target=this->Makefile->FindTarget(targetIt->c_str())) - { - // Found the target. Check its type. - if(target->GetType() != cmTarget::EXECUTABLE && - target->GetType() != cmTarget::STATIC_LIBRARY && - target->GetType() != cmTarget::SHARED_LIBRARY && - target->GetType() != cmTarget::MODULE_LIBRARY) - { - cmOStringStream e; - e << "TARGETS given target \"" << (*targetIt) - << "\" which is not an executable, library, or module."; - this->SetError(e.str().c_str()); - return false; - } - // Store the target in the list to be installed. - targets.push_back(target); - } - else + // Lookup this target in the current directory. + if(cmTarget* target=this->Makefile->FindTarget(targetIt->c_str())) + { + // Found the target. Check its type. + if(target->GetType() != cmTarget::EXECUTABLE && + target->GetType() != cmTarget::STATIC_LIBRARY && + target->GetType() != cmTarget::SHARED_LIBRARY && + target->GetType() != cmTarget::MODULE_LIBRARY) { - // Did not find the target. cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) - << "\" which does not exist in this directory."; + << "\" which is not an executable, library, or module."; this->SetError(e.str().c_str()); return false; } + // Store the target in the list to be installed. + targets.push_back(target); + } + else + { + // Did not find the target. + cmOStringStream e; + e << "TARGETS given target \"" << (*targetIt) + << "\" which does not exist in this directory."; + this->SetError(e.str().c_str()); + return false; + } } // Keep track of whether we will be performing an installation of @@ -602,98 +602,98 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) break; } - // These well-known sets of files are installed *automatically* for FRAMEWORK - // SHARED library targets on the Mac as part of installing the FRAMEWORK. - // For other target types or on other platforms, they are not installed - // automatically and so we need to create install files generators for them. - // - bool createInstallGeneratorsForTargetFileSets = true; - - if(target.IsFrameworkOnApple()) - { - createInstallGeneratorsForTargetFileSets = false; - } + // These well-known sets of files are installed *automatically* for + // FRAMEWORK SHARED library targets on the Mac as part of installing the + // FRAMEWORK. For other target types or on other platforms, they are not + // installed automatically and so we need to create install files + // generators for them. + bool createInstallGeneratorsForTargetFileSets = true; - if(createInstallGeneratorsForTargetFileSets && !namelinkOnly) - { - const char* files = target.GetProperty("PRIVATE_HEADER"); - if ((files) && (*files)) + if(target.IsFrameworkOnApple()) { - std::vector<std::string> relFiles; - cmSystemTools::ExpandListArgument(files, relFiles); - std::vector<std::string> absFiles; - if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles)) - { - return false; - } - - // Create the files install generator. - if (!privateHeaderArgs.GetDestination().empty()) - { - privateHeaderGenerator = CreateInstallFilesGenerator(absFiles, - privateHeaderArgs, false); - } - else - { - cmOStringStream e; - e << "INSTALL TARGETS - target " << target.GetName() << " has " - << "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION."; - cmSystemTools::Message(e.str().c_str(), "Warning"); - } + createInstallGeneratorsForTargetFileSets = false; } - files = target.GetProperty("PUBLIC_HEADER"); - if ((files) && (*files)) + if(createInstallGeneratorsForTargetFileSets && !namelinkOnly) { - std::vector<std::string> relFiles; - cmSystemTools::ExpandListArgument(files, relFiles); - std::vector<std::string> absFiles; - if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles)) + const char* files = target.GetProperty("PRIVATE_HEADER"); + if ((files) && (*files)) { - return false; - } + std::vector<std::string> relFiles; + cmSystemTools::ExpandListArgument(files, relFiles); + std::vector<std::string> absFiles; + if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles)) + { + return false; + } - // Create the files install generator. - if (!publicHeaderArgs.GetDestination().empty()) - { - publicHeaderGenerator = CreateInstallFilesGenerator(absFiles, - publicHeaderArgs, false); - } - else - { - cmOStringStream e; - e << "INSTALL TARGETS - target " << target.GetName() << " has " - << "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION."; - cmSystemTools::Message(e.str().c_str(), "Warning"); + // Create the files install generator. + if (!privateHeaderArgs.GetDestination().empty()) + { + privateHeaderGenerator = + CreateInstallFilesGenerator(absFiles, privateHeaderArgs, false); + } + else + { + cmOStringStream e; + e << "INSTALL TARGETS - target " << target.GetName() << " has " + << "PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION."; + cmSystemTools::Message(e.str().c_str(), "Warning"); + } } - } - files = target.GetProperty("RESOURCE"); - if ((files) && (*files)) - { - std::vector<std::string> relFiles; - cmSystemTools::ExpandListArgument(files, relFiles); - std::vector<std::string> absFiles; - if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles)) + files = target.GetProperty("PUBLIC_HEADER"); + if ((files) && (*files)) { - return false; - } + std::vector<std::string> relFiles; + cmSystemTools::ExpandListArgument(files, relFiles); + std::vector<std::string> absFiles; + if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles)) + { + return false; + } - // Create the files install generator. - if (!resourceArgs.GetDestination().empty()) - { - resourceGenerator = CreateInstallFilesGenerator(absFiles, - resourceArgs, false); + // Create the files install generator. + if (!publicHeaderArgs.GetDestination().empty()) + { + publicHeaderGenerator = + CreateInstallFilesGenerator(absFiles, publicHeaderArgs, false); + } + else + { + cmOStringStream e; + e << "INSTALL TARGETS - target " << target.GetName() << " has " + << "PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION."; + cmSystemTools::Message(e.str().c_str(), "Warning"); + } } - else + + files = target.GetProperty("RESOURCE"); + if ((files) && (*files)) { - cmOStringStream e; - e << "INSTALL TARGETS - target " << target.GetName() << " has " - << "RESOURCE files but no RESOURCE DESTINATION."; - cmSystemTools::Message(e.str().c_str(), "Warning"); + std::vector<std::string> relFiles; + cmSystemTools::ExpandListArgument(files, relFiles); + std::vector<std::string> absFiles; + if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles)) + { + return false; + } + + // Create the files install generator. + if (!resourceArgs.GetDestination().empty()) + { + resourceGenerator = CreateInstallFilesGenerator(absFiles, + resourceArgs, false); + } + else + { + cmOStringStream e; + e << "INSTALL TARGETS - target " << target.GetName() << " has " + << "RESOURCE files but no RESOURCE DESTINATION."; + cmSystemTools::Message(e.str().c_str(), "Warning"); + } } } - } // Keep track of whether we're installing anything in each category installsArchive = installsArchive || archiveGenerator != 0; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 8f62322..377b43a 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -168,9 +168,7 @@ public: "On non-DLL platforms mySharedLib will be installed to <prefix>/lib " "and /some/full/path. On DLL platforms the mySharedLib DLL will be " "installed to <prefix>/bin and /some/full/path and its import library " - "will be installed to <prefix>/lib/static and /some/full/path. " - "On non-DLL platforms mySharedLib will be installed to <prefix>/lib " - "and /some/full/path." + "will be installed to <prefix>/lib/static and /some/full/path." "\n" "The EXPORT option associates the installed target files with an " "export called <export-name>. " diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 4625ed1..764dc38 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2012) SET(KWSYS_DATE_STAMP_MONTH 01) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 18) +SET(KWSYS_DATE_STAMP_DAY 25) diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt index 6209c8f..8f24afe 100644 --- a/Tests/BundleUtilities/CMakeLists.txt +++ b/Tests/BundleUtilities/CMakeLists.txt @@ -82,3 +82,52 @@ add_custom_target(testbundleutils2_test ALL DEPENDS testbundleutils1 module2 ) add_dependencies(testbundleutils2_test testbundleutils2) + + +if(APPLE AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 9.0) +###### Test a Bundle application using dependencies +###### and @rpaths on Mac OS X 10.5 or greater + + # a shared library + add_library(shared-3 SHARED shared.cpp shared.h) + + # another shared library + add_library(shared2-3 SHARED shared2.cpp shared2.h) + + # a framework library + add_library(framework-3 SHARED framework.cpp framework.h) + set_target_properties(framework-3 PROPERTIES FRAMEWORK 1) + + # build dependencies with @rpath install name + set_target_properties(shared-3 shared2-3 framework-3 PROPERTIES + INSTALL_NAME_DIR "@rpath" + BUILD_WITH_INSTALL_RPATH 1) + + # a loadable module (depends on shared2) + # testbundleutils1 will load this at runtime + add_library(module3 MODULE module.cpp module.h) + set_target_properties(module3 PROPERTIES PREFIX "" LINK_FLAGS "-Wl,-rpath,@loader_path/") + get_target_property(module_loc module3 LOCATION) + target_link_libraries(module3 shared2-3) + + # a non-bundle application + add_executable(testbundleutils3 testbundleutils3.cpp) + target_link_libraries(testbundleutils3 shared-3 framework-3 ${CMAKE_DL_LIBS}) + get_target_property(loc testbundleutils3 LOCATION) + + set_target_properties(testbundleutils3 module3 PROPERTIES + LINK_FLAGS "-Wl,-rpath,@loader_path/") + + # add custom target to install and test the app + add_custom_target(testbundleutils3_test ALL + COMMAND ${CMAKE_COMMAND} + "-DINPUT=${loc}" + "-DMODULE=${module_loc}" + "-DINPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" + "-DOUTPUTDIR=${CMAKE_CURRENT_BINARY_DIR}/testdir3" + -P "${CMAKE_CURRENT_SOURCE_DIR}/bundleutils.cmake" + DEPENDS testbundleutils3 module3 + ) + + add_dependencies(testbundleutils3_test testbundleutils3) +endif() diff --git a/Tests/BundleUtilities/testbundleutils3.cpp b/Tests/BundleUtilities/testbundleutils3.cpp new file mode 100644 index 0000000..9df13e9 --- /dev/null +++ b/Tests/BundleUtilities/testbundleutils3.cpp @@ -0,0 +1,33 @@ + +#include "framework.h" +#include "shared.h" +#include "stdio.h" + +#if defined(WIN32) +#include <windows.h> +#else +#include "dlfcn.h" +#endif + +int main(int, char**) +{ + framework(); + shared(); + +#if defined(WIN32) + HANDLE lib = LoadLibraryA("module3.dll"); + if(!lib) + { + printf("Failed to open module3\n"); + } +#else + void* lib = dlopen("module3.so", RTLD_LAZY); + if(!lib) + { + printf("Failed to open module3\n%s\n", dlerror()); + } +#endif + + + return lib == 0 ? 1 : 0; +} diff --git a/Tests/CMakeCommands/target_link_libraries/depC.cpp b/Tests/CMakeCommands/target_link_libraries/depC.cpp index 93410a8..60bed59 100644 --- a/Tests/CMakeCommands/target_link_libraries/depC.cpp +++ b/Tests/CMakeCommands/target_link_libraries/depC.cpp @@ -10,4 +10,4 @@ DepA DepC::getA() { DepA a; return a; -}
\ No newline at end of file +} diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt new file mode 100644 index 0000000..8a38f06 --- /dev/null +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required (VERSION 2.8) +project(AllFindModules) + +if (POLICY CMP0017) + cmake_policy(SET CMP0017 NEW) +endif () + +# Avoid ctest truncation of output +message(STATUS "CTEST_FULL_OUTPUT") + +file(GLOB FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/Find*.cmake" ) + +macro(do_find MODULE_NAME) + message(STATUS " Checking Find${MODULE_NAME}") + find_package(${MODULE_NAME}) +endmacro(do_find) + +foreach(FIND_MODULE ${FIND_MODULES}) + string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") + + # It is only possible to use either Qt3 or Qt4 in one project. + # Since FindQt will complain if both are found we explicitely + # filter out this and FindQt3. FindKDE3 also depends on Qt3 and + # is therefore also blocked + + if (NOT MODULE_NAME STREQUAL "Qt" AND + NOT MODULE_NAME STREQUAL "Qt3" AND + NOT MODULE_NAME STREQUAL "KDE3") + do_find(${MODULE_NAME}) + endif () + +endforeach(FIND_MODULE) + +# Qt4 is not present, so we can check Qt3 +if(NOT QT4_FOUND) + foreach(FIND_MODULE "Qt3" "Qt" "KDE3") + do_find(${FIND_MODULE}) + endforeach(FIND_MODULE) +endif(NOT QT4_FOUND) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index f6aa9b5..20e6a3a 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -14,3 +14,5 @@ set_property(TEST CMakeOnly.LinkInterfaceLoop PROPERTY TIMEOUT 90) add_CMakeOnly_test(CheckSymbolExists) add_CMakeOnly_test(CheckCXXSymbolExists) + +add_CMakeOnly_test(AllFindModules) diff --git a/Tests/CMakeTests/If-Invalid-Argument.cmake b/Tests/CMakeTests/If-Invalid-Argument.cmake new file mode 100644 index 0000000..b4fb97f --- /dev/null +++ b/Tests/CMakeTests/If-Invalid-Argument.cmake @@ -0,0 +1,2 @@ +if (NOT foo bar STREQUAL "foo bar") +endif() diff --git a/Tests/CMakeTests/IfTest.cmake.in b/Tests/CMakeTests/IfTest.cmake.in index e5211b4..639e226 100644 --- a/Tests/CMakeTests/IfTest.cmake.in +++ b/Tests/CMakeTests/IfTest.cmake.in @@ -156,3 +156,11 @@ foreach(_bad 2x -2x) endforeach() test_vars("") + +set(Invalid-Argument-RESULT 1) +set(Invalid-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?If-Invalid-Argument.cmake:1 \\(if\\):.*Unknown arguments specified.*") + +include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") +check_cmake_test(If + Invalid-Argument +) diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt index 953d05c..5cdbc59b 100644 --- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt @@ -5,9 +5,6 @@ IF (MUDSLIDE_TYPE MATCHES MUCHO) ADD_DEFINITIONS(-DMUCHO_MUDSLIDE) ENDIF (MUDSLIDE_TYPE MATCHES MUCHO) -IF(WATCOM) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -ENDIF(WATCOM) INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index e99105a..846cbb0 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -12,12 +12,6 @@ INCLUDE (CheckFunctionExists) CHECK_FUNCTION_EXISTS(printf HAVE_PRINTF) CHECK_FUNCTION_EXISTS(vsblabla HAVE_VSBLABLA) -INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) -CHECK_INCLUDE_FILE("sys/prctl.h" HAVE_SYS_PRCTL_H) - -INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake) -CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM) - CONFIGURE_FILE(${LoadCommand_SOURCE_DIR}/LoadedCommand.h.in ${LoadCommand_BINARY_DIR}/LoadedCommand.h) diff --git a/Tests/LoadCommand/LoadedCommand.h.in b/Tests/LoadCommand/LoadedCommand.h.in index 7a0a15d..7516a66 100644 --- a/Tests/LoadCommand/LoadedCommand.h.in +++ b/Tests/LoadCommand/LoadedCommand.h.in @@ -5,9 +5,3 @@ /* Check for functions */ #cmakedefine HAVE_PRINTF #cmakedefine HAVE_VSBLABLA - -/* Check for headers */ -#cmakedefine HAVE_SYS_PRCTL_H - -/* Check for libraries */ -#cmakedefine HAVE_LIBM diff --git a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp index 445a652..eec46d3 100644 --- a/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp +++ b/Tests/Module/GenerateExportHeader/nodeprecated/src/main.cpp @@ -6,4 +6,4 @@ int main(int, char**) SomeClass sc; sc.someMethod(); return 0; -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp index 445a652..eec46d3 100644 --- a/Tests/Module/GenerateExportHeader/override_symbol/main.cpp +++ b/Tests/Module/GenerateExportHeader/override_symbol/main.cpp @@ -6,4 +6,4 @@ int main(int, char**) SomeClass sc; sc.someMethod(); return 0; -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp index 7326b78..427ec29 100644 --- a/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp +++ b/Tests/Module/GenerateExportHeader/override_symbol/someclass.cpp @@ -4,4 +4,4 @@ void SomeClass::someMethod() const { -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/prefix/main.cpp b/Tests/Module/GenerateExportHeader/prefix/main.cpp index d04ae3c..507f6fd 100644 --- a/Tests/Module/GenerateExportHeader/prefix/main.cpp +++ b/Tests/Module/GenerateExportHeader/prefix/main.cpp @@ -5,4 +5,4 @@ int main(int argc, char **argv) { UsePrefixClass upc; return upc.someMethod(); -}
\ No newline at end of file +} diff --git a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp index 8337ab8..1fd2cb2 100644 --- a/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp +++ b/Tests/Module/GenerateExportHeader/prefix/useprefixclass.cpp @@ -4,4 +4,4 @@ int UsePrefixClass::someMethod() const { return 0; -}
\ No newline at end of file +} diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake index 115181d..522ee76 100644 --- a/Utilities/Release/dashmacmini2_release.cmake +++ b/Utilities/Release/dashmacmini2_release.cmake @@ -5,14 +5,14 @@ set(INSTALL_PREFIX /) set(HOST dashmacmini2) set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j2") -set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") +set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-universal BUILD_QtDialog:BOOL=TRUE -QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Software/QtBinUniversal/bin/qmake +QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Dashboards/Support/qt-4.6.3/bin/bin/qmake ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake) |