diff options
34 files changed, 619 insertions, 281 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index d6df305..ed0b6fb 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -64,7 +64,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" # Skip this with Xcode for now. AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode) - CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log) + CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log + "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Parsed ${lang} implicit link information from above output:\n${log}\n\n") ENDIF() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 03ddd78..3801d7d 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -169,6 +169,9 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran") + LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") # Try to identify the compiler. SET(CMAKE_Fortran_COMPILER_ID) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index f6a52c6..1e9b4e0 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -67,29 +67,29 @@ SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1) # Create a set of shared library variable specific to Fortran # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) +ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +ENDIF() IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) @@ -100,25 +100,25 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) ENDIF() # repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) +IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) +ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index defdb47..5405bda 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -16,7 +16,7 @@ # This is used internally by CMake and should not be included by user # code. -function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) +function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) set(implicit_libs_tmp "") set(implicit_dirs_tmp) set(log "") @@ -59,6 +59,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) # Unix library full path. list(APPEND implicit_libs_tmp ${arg}) set(log "${log} arg [${arg}] ==> lib [${arg}]\n") + elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$" + AND obj_regex AND "${arg}" MATCHES "${obj_regex}") + # Object file full path. + list(APPEND implicit_libs_tmp ${arg}) + set(log "${log} arg [${arg}] ==> obj [${arg}]\n") elseif("${arg}" MATCHES "^-Y(P,)?") # Sun search path. string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in index 3b50e74..dee576f 100755 --- a/Modules/CPack.STGZ_Header.sh.in +++ b/Modules/CPack.STGZ_Header.sh.in @@ -80,7 +80,7 @@ then if [ "x${cpack_skip_license}x" != "xTRUEx" ] then - more << ____cpack__here_doc____ + more << '____cpack__here_doc____' @CPACK_RESOURCE_FILE_LICENSE_CONTENT@ ____cpack__here_doc____ echo diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake new file mode 100644 index 0000000..b68c479 --- /dev/null +++ b/Modules/Compiler/NAG-Fortran.cmake @@ -0,0 +1,32 @@ +# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files. +if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED) + message(STATUS "Detecting NAG Fortran directory") + # Run with -dryrun to see sample "link" line. + execute_process( + COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun + OUTPUT_VARIABLE _dryrun + ERROR_VARIABLE _dryrun + ) + # Match an object file. + string(REGEX MATCH "/[^ ]*/[^ /][^ /]*\\.o" _nag_obj "${_dryrun}") + if(_nag_obj) + # Parse object directory and convert to a regex. + string(REGEX REPLACE "/[^/]*$" "" _nag_dir "${_nag_obj}") + string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _nag_regex "${_nag_dir}") + set(CMAKE_Fortran_IMPLICIT_OBJECT_REGEX "^${_nag_regex}/") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Detecting NAG Fortran directory with -dryrun found\n" + " object: ${_nag_obj}\n" + " directory: ${_nag_dir}\n" + " regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n" + "from output:\n${_dryrun}\n\n") + message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}") + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n") + message(STATUS "Detecting NAG Fortran directory - failed") + endif() +endif() + +set(CMAKE_Fortran_MODDIR_FLAG "-mdir ") +set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC") diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 94bbed5..b605164 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -40,16 +40,7 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT _LANGUAGES_ MATCHES Fortran) - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.") - else(BLAS_FIND_REQUIRED) - message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") # - return() - endif(BLAS_FIND_REQUIRED) -endif(NOT _LANGUAGES_ MATCHES Fortran) - -include(CheckFortranFunctionExists) +include(CheckFunctionExists) macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) # This macro checks for the existence of the combination of fortran libraries @@ -107,7 +98,7 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) @@ -246,13 +237,24 @@ endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") #BLAS in acml library? if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" - "acml" + "acml;acml_mv" + "" + ) + endif(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml_mp;acml_mv" "" ) endif(NOT BLAS_LIBRARIES) @@ -300,6 +302,9 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") #BLAS in intel mkl 10 library? (em64t 64bit) if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) @@ -340,7 +345,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -352,6 +357,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "" "mkl_intel;mkl_intel_thread;mkl_core;guide" "${CMAKE_THREAD_LIBS_INIT}" + "${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -365,7 +371,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -376,7 +382,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -391,7 +397,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, 32bit) @@ -402,7 +408,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, em64t 64bit) @@ -413,7 +419,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index 18014af..4bcaae9 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -45,10 +45,12 @@ set(module_symbols my_module_mp_my_sub_ # Intel MY_MODULE_mp_MY_SUB # Intel on Windows my_module_my_sub_ # PGI + my_module_MP_my_sub # NAG mymodule$mysub # HP mymodule_mp_mysub_ # Intel MYMODULE_mp_MYSUB # Intel on Windows mymodule_mysub_ # PGI + mymodule_MP_mysub # NAG ${FortranCInterface_MODULE_SYMBOLS} ) list(REMOVE_DUPLICATES module_symbols) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index b157f72..1576982 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -3,7 +3,7 @@ SET(CYGWIN 1) SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -SET(CMAKE_SHARED_MODULE_PREFIX "lib") +SET(CMAKE_SHARED_MODULE_PREFIX "cyg") SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake new file mode 100644 index 0000000..933f9e1 --- /dev/null +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -0,0 +1,5 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need -fpp explicitly on case-insensitive filesystem. +set(CMAKE_Fortran_COMPILE_OBJECT + "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>") diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake new file mode 100644 index 0000000..353bae6 --- /dev/null +++ b/Modules/Platform/Linux-NAG-Fortran.cmake @@ -0,0 +1,10 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need one "-Wl," level to send flag through to gcc. +# Use "-Xlinker" to get through gcc to real linker. +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic") diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index ded329d..46be99b 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -285,7 +285,7 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const { // The Component installation support should only // be activated if explicitly requested by the user // (for backward compatibility reason) - if (IsSet("CPACK_ARCHIVE_COMPONENT_INSTALL")) + if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) { return true; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 92e5b6a..feda52c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -551,7 +551,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::vector<std::string> componentsVector; bool componentInstall = false; - if (this->SupportsComponentInstallation()) + /* + * We do a component install iff + * - the CPack generator support component + * - the user did not request Monolithic install + * (this works at CPack time too) + */ + if (this->SupportsComponentInstallation() & + !(this->IsSet("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" @@ -1063,7 +1070,13 @@ bool cmCPackGenerator::IsSet(const char* name) const } //---------------------------------------------------------------------- -const char* cmCPackGenerator::GetOption(const char* op) +bool cmCPackGenerator::IsOn(const char* name) const +{ + return cmSystemTools::IsOn(GetOption(name)); +} + +//---------------------------------------------------------------------- +const char* cmCPackGenerator::GetOption(const char* op) const { const char* ret = this->MakefileMap->GetDefinition(op); if(!ret) diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index c450763..f44a334 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -88,8 +88,9 @@ public: //! Set and get the options void SetOption(const char* op, const char* value); void SetOptionIfNotSet(const char* op, const char* value); - const char* GetOption(const char* op); + const char* GetOption(const char* op) const; bool IsSet(const char* name) const; + bool IsOn(const char* name) const; //! Set all the variables int SetCMakeRoot(); diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 34e93d3..a5db78f 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -108,7 +108,7 @@ int cmCPackRPMGenerator::PackageFiles() bool cmCPackRPMGenerator::SupportsComponentInstallation() const { - if (IsSet("CPACK_RPM_COMPONENT_INSTALL")) + if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) { return true; } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 93c2963..94614cf 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -653,32 +653,37 @@ bool cmCTestMultiProcessHandler::CheckCycles() it != this->Tests.end(); ++it) { //DFS from each element to itself + int root = it->first; + std::set<int> visited; std::stack<int> s; - std::vector<int> visited; - - s.push(it->first); - + s.push(root); while(!s.empty()) { int test = s.top(); s.pop(); - - for(TestSet::iterator d = this->Tests[test].begin(); - d != this->Tests[test].end(); ++d) + if(visited.insert(test).second) { - if(std::find(visited.begin(), visited.end(), *d) != visited.end()) + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) { - //cycle exists - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " - "the test dependency graph for the test \"" - << this->Properties[it->first]->Name << "\"." << std::endl - << "Please fix the cycle and run ctest again." << std::endl); - return false; + if(*d == root) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error: a cycle exists in the test dependency graph " + "for the test \"" << this->Properties[root]->Name << + "\".\nPlease fix the cycle and run ctest again.\n"); + return false; + } + else + { + s.push(*d); + } } - s.push(*d); } - visited.push_back(test); } } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl); return true; } diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index f6b3234..7af6ec8 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -161,6 +161,7 @@ bool cmAddCustomCommandCommand filename += "/"; } filename += copy; + cmSystemTools::ConvertToUnixSlashes(filename); break; case doing_source: // We do not want to convert the argument to SOURCE because diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index b8a0c95..0fe64ad 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -169,8 +169,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator() ->GetLanguageFromExtension(ext.c_str())); const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH"); - fprintf(fout, "cmake_minimum_required(VERSION %u.%u)\n", - cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion()); + fprintf(fout, "cmake_minimum_required(VERSION %u.%u.%u.%u)\n", + cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion(), + cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); @@ -396,28 +397,18 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } else { - if(!cmSystemTools::RemoveFile(fullPath.c_str())) + // Sometimes anti-virus software hangs on to new files so we + // cannot delete them immediately. Try a few times. + int tries = 5; + while(!cmSystemTools::RemoveFile(fullPath.c_str()) && + --tries && cmSystemTools::FileExists(fullPath.c_str())) { - bool removed = false; - int numAttempts = 0; - // sometimes anti-virus software hangs on to - // new files and we can not delete them, so try - // 5 times with .5 second delay between tries. - while(!removed && numAttempts < 5) - { - cmSystemTools::Delay(500); - if(cmSystemTools::RemoveFile(fullPath.c_str())) - { - removed = true; - } - numAttempts++; - } - if(!removed) - { - std::string m = "Remove failed on file: "; - m += fullPath; - cmSystemTools::ReportLastSystemError(m.c_str()); - } + cmSystemTools::Delay(500); + } + if(tries == 0) + { + std::string m = "Remove failed on file: " + fullPath; + cmSystemTools::ReportLastSystemError(m.c_str()); } } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9983e5d..1463680 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1364,8 +1364,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target, cmOStringStream e; e << "Attempt to add link library \"" << lib << "\" to target \"" - << target << "\" which is not built by this project."; - cmSystemTools::Error(e.str().c_str()); + << target << "\" which is not built in this directory."; + this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 969cfdb..9dcd8f1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1527,6 +1527,12 @@ void cmMakefileTargetGenerator this->LocalGenerator->AppendRuleDepend(depends, this->BuildFileNameFull.c_str()); + // Add a dependency on the link definitions file, if any. + if(!this->ModuleDefinitionFile.empty()) + { + depends.push_back(this->ModuleDefinitionFile); + } + // Add dependencies on the external object files. for(std::vector<std::string>::const_iterator obj = this->ExternalObjects.begin(); @@ -1723,8 +1729,6 @@ const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() this->Target->GetProperty("Fortran_MODULE_DIRECTORY"); const char* moddir_flag = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); - const char* moddir_default = - this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); if(target_mod_dir && moddir_flag) { // Compute the full path to the module directory. @@ -1745,10 +1749,6 @@ const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() // Make sure the module output directory exists. cmSystemTools::MakeDirectory(this->FortranModuleDirectory.c_str()); } - else if(moddir_default && moddir_flag) - { - this->FortranModuleDirectory = moddir_default; - } this->FortranModuleDirectoryComputed = true; } @@ -1774,7 +1774,12 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) } // Add a module output directory flag if necessary. - if(const char* mod_dir = this->GetFortranModuleDirectory()) + const char* mod_dir = this->GetFortranModuleDirectory(); + if(!mod_dir) + { + mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); + } + if(mod_dir) { const char* moddir_flag = this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 43a0d7c..ce57df7 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -62,6 +62,10 @@ public: " target_link_libraries(<target> [item1 [item2 [...]]]\n" " [[debug|optimized|general] <item>] ...)\n" "Specify libraries or flags to use when linking a given target. " + "The named <target> must have been created in the current directory " + "by a command such as add_executable or add_library. " + "The remaining arguments specify library names or flags." + "\n" "If a library name matches that of another target in the project " "a dependency will automatically be added in the build system to make " "sure the library being linked is up-to-date before the target links. " diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 4818ce9..d727b32 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -151,10 +151,6 @@ public: void RunMemoryCheck(); public: -#define VENDOR_STRING_LENGTH (12 + 1) -#define CHIPNAME_STRING_LENGTH (48 + 1) -#define SERIALNUMBER_STRING_LENGTH (29 + 1) - typedef struct tagID { int Type; @@ -163,9 +159,9 @@ public: int Revision; int ExtendedFamily; int ExtendedModel; - char ProcessorName[CHIPNAME_STRING_LENGTH]; - char Vendor[VENDOR_STRING_LENGTH]; - char SerialNumber[SERIALNUMBER_STRING_LENGTH]; + kwsys_stl::string ProcessorName; + kwsys_stl::string Vendor; + kwsys_stl::string SerialNumber; } ID; typedef struct tagCPUPowerManagement @@ -530,7 +526,12 @@ SystemInformationImplementation::SystemInformationImplementation() this->CurrentPositionInFile = 0; this->ChipManufacturer = UnknownManufacturer; memset(&this->Features, 0, sizeof(CPUFeatures)); - memset(&this->ChipID, 0, sizeof(ID)); + this->ChipID.Type = 0; + this->ChipID.Family = 0; + this->ChipID.Model = 0; + this->ChipID.Revision = 0; + this->ChipID.ExtendedFamily = 0; + this->ChipID.ExtendedModel = 0; this->CPUSpeedInMHz = 0; this->NumberOfLogicalCPU = 0; this->NumberOfPhysicalCPU = 0; @@ -623,7 +624,7 @@ void SystemInformationImplementation::RunMemoryCheck() /** Get the vendor string */ const char * SystemInformationImplementation::GetVendorString() { - return this->ChipID.Vendor; + return this->ChipID.Vendor.c_str(); } /** Get the OS Name */ @@ -726,14 +727,14 @@ kwsys_stl::string SystemInformationImplementation::GetSteppingCode() /** Return the stepping code of the CPU present. */ const char * SystemInformationImplementation::GetExtendedProcessorName() { - return this->ChipID.ProcessorName; + return this->ChipID.ProcessorName.c_str(); } /** Return the serial number of the processor * in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */ const char * SystemInformationImplementation::GetProcessorSerialNumber() { - return this->ChipID.SerialNumber; + return this->ChipID.SerialNumber.c_str(); } /** Return the logical processors per physical */ @@ -1022,21 +1023,21 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() /** Find the manufacturer given the vendor id */ void SystemInformationImplementation::FindManufacturer() { - if (strcmp (this->ChipID.Vendor, "GenuineIntel") == 0) this->ChipManufacturer = Intel; // Intel Corp. - else if (strcmp (this->ChipID.Vendor, "UMC UMC UMC ") == 0) this->ChipManufacturer = UMC; // United Microelectronics Corp. - else if (strcmp (this->ChipID.Vendor, "AuthenticAMD") == 0) this->ChipManufacturer = AMD; // Advanced Micro Devices - else if (strcmp (this->ChipID.Vendor, "AMD ISBETTER") == 0) this->ChipManufacturer = AMD; // Advanced Micro Devices (1994) - else if (strcmp (this->ChipID.Vendor, "CyrixInstead") == 0) this->ChipManufacturer = Cyrix; // Cyrix Corp., VIA Inc. - else if (strcmp (this->ChipID.Vendor, "NexGenDriven") == 0) this->ChipManufacturer = NexGen; // NexGen Inc. (now AMD) - else if (strcmp (this->ChipID.Vendor, "CentaurHauls") == 0) this->ChipManufacturer = IDT; // IDT/Centaur (now VIA) - else if (strcmp (this->ChipID.Vendor, "RiseRiseRise") == 0) this->ChipManufacturer = Rise; // Rise - else if (strcmp (this->ChipID.Vendor, "GenuineTMx86") == 0) this->ChipManufacturer = Transmeta; // Transmeta - else if (strcmp (this->ChipID.Vendor, "TransmetaCPU") == 0) this->ChipManufacturer = Transmeta; // Transmeta - else if (strcmp (this->ChipID.Vendor, "Geode By NSC") == 0) this->ChipManufacturer = NSC; // National Semiconductor - else if (strcmp (this->ChipID.Vendor, "Sun") == 0) this->ChipManufacturer = Sun; // Sun Microelectronics - else if (strcmp (this->ChipID.Vendor, "IBM") == 0) this->ChipManufacturer = IBM; // IBM Microelectronics - else if (strcmp (this->ChipID.Vendor, "Motorola") == 0) this->ChipManufacturer = Motorola; // Motorola Microelectronics - else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer + if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp. + else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp. + else if (this->ChipID.Vendor == "AuthenticAMD") this->ChipManufacturer = AMD; // Advanced Micro Devices + else if (this->ChipID.Vendor == "AMD ISBETTER") this->ChipManufacturer = AMD; // Advanced Micro Devices (1994) + else if (this->ChipID.Vendor == "CyrixInstead") this->ChipManufacturer = Cyrix; // Cyrix Corp., VIA Inc. + else if (this->ChipID.Vendor == "NexGenDriven") this->ChipManufacturer = NexGen; // NexGen Inc. (now AMD) + else if (this->ChipID.Vendor == "CentaurHauls") this->ChipManufacturer = IDT; // IDT/Centaur (now VIA) + else if (this->ChipID.Vendor == "RiseRiseRise") this->ChipManufacturer = Rise; // Rise + else if (this->ChipID.Vendor == "GenuineTMx86") this->ChipManufacturer = Transmeta; // Transmeta + else if (this->ChipID.Vendor == "TransmetaCPU") this->ChipManufacturer = Transmeta; // Transmeta + else if (this->ChipID.Vendor == "Geode By NSC") this->ChipManufacturer = NSC; // National Semiconductor + else if (this->ChipID.Vendor == "Sun") this->ChipManufacturer = Sun; // Sun Microelectronics + else if (this->ChipID.Vendor == "IBM") this->ChipManufacturer = IBM; // IBM Microelectronics + else if (this->ChipID.Vendor == "Motorola") this->ChipManufacturer = Motorola; // Motorola Microelectronics + else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer } @@ -1094,10 +1095,12 @@ bool SystemInformationImplementation::RetrieveCPUIdentity() } // Process the returned information. - memcpy (this->ChipID.Vendor, &(localCPUVendor[0]), sizeof (int)); - memcpy (&(this->ChipID.Vendor[4]), &(localCPUVendor[1]), sizeof (int)); - memcpy (&(this->ChipID.Vendor[8]), &(localCPUVendor[2]), sizeof (int)); - this->ChipID.Vendor[12] = '\0'; + char vbuf[13]; + memcpy (&(vbuf[0]), &(localCPUVendor[0]), sizeof (int)); + memcpy (&(vbuf[4]), &(localCPUVendor[1]), sizeof (int)); + memcpy (&(vbuf[8]), &(localCPUVendor[2]), sizeof (int)); + vbuf[12] = '\0'; + this->ChipID.Vendor = vbuf; this->FindManufacturer(); @@ -1792,7 +1795,8 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber() } // Process the returned information. - sprintf (this->ChipID.SerialNumber, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x", + char sn[128]; + sprintf (sn, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x", ((SerialNumber[0] & 0xff000000) >> 24), ((SerialNumber[0] & 0x00ff0000) >> 16), ((SerialNumber[0] & 0x0000ff00) >> 8), @@ -1805,7 +1809,7 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber() ((SerialNumber[2] & 0x00ff0000) >> 16), ((SerialNumber[2] & 0x0000ff00) >> 8), ((SerialNumber[2] & 0x000000ff) >> 0)); - + this->ChipID.SerialNumber = sn; return true; #else @@ -1873,6 +1877,15 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement() #endif } +void SystemInformationStripLeadingSpace(kwsys_stl::string& str) +{ + // Because some manufacturers have leading white space - we have to post-process the name. + kwsys_stl::string::size_type pos = str.find_first_not_of(" "); + if(pos != kwsys_stl::string::npos) + { + str = str.substr(pos); + } +} /** */ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() @@ -1886,7 +1899,6 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() return false; #if USE_ASM_INSTRUCTIONS - int ProcessorNameStartPos = 0; int CPUExtendedIdentity[12]; // Use assembly to detect CPUID information... @@ -1942,47 +1954,25 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() } // Process the returned information. - memcpy (this->ChipID.ProcessorName, &(CPUExtendedIdentity[0]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[4]), &(CPUExtendedIdentity[1]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[8]), &(CPUExtendedIdentity[2]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[12]), &(CPUExtendedIdentity[3]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[16]), &(CPUExtendedIdentity[4]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[20]), &(CPUExtendedIdentity[5]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[24]), &(CPUExtendedIdentity[6]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[28]), &(CPUExtendedIdentity[7]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[32]), &(CPUExtendedIdentity[8]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[36]), &(CPUExtendedIdentity[9]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[40]), &(CPUExtendedIdentity[10]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[44]), &(CPUExtendedIdentity[11]), sizeof (int)); - this->ChipID.ProcessorName[48] = '\0'; + char nbuf[49]; + memcpy (&(nbuf[0]), &(CPUExtendedIdentity[0]), sizeof (int)); + memcpy (&(nbuf[4]), &(CPUExtendedIdentity[1]), sizeof (int)); + memcpy (&(nbuf[8]), &(CPUExtendedIdentity[2]), sizeof (int)); + memcpy (&(nbuf[12]), &(CPUExtendedIdentity[3]), sizeof (int)); + memcpy (&(nbuf[16]), &(CPUExtendedIdentity[4]), sizeof (int)); + memcpy (&(nbuf[20]), &(CPUExtendedIdentity[5]), sizeof (int)); + memcpy (&(nbuf[24]), &(CPUExtendedIdentity[6]), sizeof (int)); + memcpy (&(nbuf[28]), &(CPUExtendedIdentity[7]), sizeof (int)); + memcpy (&(nbuf[32]), &(CPUExtendedIdentity[8]), sizeof (int)); + memcpy (&(nbuf[36]), &(CPUExtendedIdentity[9]), sizeof (int)); + memcpy (&(nbuf[40]), &(CPUExtendedIdentity[10]), sizeof (int)); + memcpy (&(nbuf[44]), &(CPUExtendedIdentity[11]), sizeof (int)); + nbuf[48] = '\0'; + this->ChipID.ProcessorName = nbuf; // Because some manufacturers have leading white space - we have to post-process the name. - if (this->ChipManufacturer == Intel) - { - for (int nCounter = 0; nCounter < CHIPNAME_STRING_LENGTH; nCounter ++) - { - // There will either be NULL (\0) or spaces ( ) as the leading characters. - if ((this->ChipID.ProcessorName[nCounter] != '\0') && (this->ChipID.ProcessorName[nCounter] != ' ')) - { - // We have found the starting position of the name. - ProcessorNameStartPos = nCounter; - // Terminate the loop. - break; - } - } - - // Check to see if there is any white space at the start. - if (ProcessorNameStartPos == 0) - { - return true; - } - - // Now move the name forward so that there is no white space. - memmove(this->ChipID.ProcessorName, &(this->ChipID.ProcessorName[ProcessorNameStartPos]), (CHIPNAME_STRING_LENGTH - ProcessorNameStartPos)); - } - + SystemInformationStripLeadingSpace(this->ChipID.ProcessorName); return true; - #else return false; #endif @@ -1999,53 +1989,53 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() // Check the family / model / revision to determine the CPU ID. switch (this->ChipID.Family) { case 3: - sprintf (this->ChipID.ProcessorName, "Newer i80386 family"); + this->ChipID.ProcessorName = "Newer i80386 family"; break; case 4: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"i80486DX-25/33"); break; - case 1: sprintf (this->ChipID.ProcessorName,"i80486DX-50"); break; - case 2: sprintf (this->ChipID.ProcessorName,"i80486SX"); break; - case 3: sprintf (this->ChipID.ProcessorName,"i80486DX2"); break; - case 4: sprintf (this->ChipID.ProcessorName,"i80486SL"); break; - case 5: sprintf (this->ChipID.ProcessorName,"i80486SX2"); break; - case 7: sprintf (this->ChipID.ProcessorName,"i80486DX2 WriteBack"); break; - case 8: sprintf (this->ChipID.ProcessorName,"i80486DX4"); break; - case 9: sprintf (this->ChipID.ProcessorName,"i80486DX4 WriteBack"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 80486 family"); return false; + case 0: this->ChipID.ProcessorName = "i80486DX-25/33"; break; + case 1: this->ChipID.ProcessorName = "i80486DX-50"; break; + case 2: this->ChipID.ProcessorName = "i80486SX"; break; + case 3: this->ChipID.ProcessorName = "i80486DX2"; break; + case 4: this->ChipID.ProcessorName = "i80486SL"; break; + case 5: this->ChipID.ProcessorName = "i80486SX2"; break; + case 7: this->ChipID.ProcessorName = "i80486DX2 WriteBack"; break; + case 8: this->ChipID.ProcessorName = "i80486DX4"; break; + case 9: this->ChipID.ProcessorName = "i80486DX4 WriteBack"; break; + default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false; } break; case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"P5 A-Step"); break; - case 1: sprintf (this->ChipID.ProcessorName,"P5"); break; - case 2: sprintf (this->ChipID.ProcessorName,"P54C"); break; - case 3: sprintf (this->ChipID.ProcessorName,"P24T OverDrive"); break; - case 4: sprintf (this->ChipID.ProcessorName,"P55C"); break; - case 7: sprintf (this->ChipID.ProcessorName,"P54C"); break; - case 8: sprintf (this->ChipID.ProcessorName,"P55C (0.25micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Pentium family"); return false; + case 0: this->ChipID.ProcessorName = "P5 A-Step"; break; + case 1: this->ChipID.ProcessorName = "P5"; break; + case 2: this->ChipID.ProcessorName = "P54C"; break; + case 3: this->ChipID.ProcessorName = "P24T OverDrive"; break; + case 4: this->ChipID.ProcessorName = "P55C"; break; + case 7: this->ChipID.ProcessorName = "P54C"; break; + case 8: this->ChipID.ProcessorName = "P55C (0.25micron)"; break; + default: this->ChipID.ProcessorName = "Unknown Pentium family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"P6 A-Step"); break; - case 1: sprintf (this->ChipID.ProcessorName,"P6"); break; - case 3: sprintf (this->ChipID.ProcessorName,"Pentium II (0.28 micron)"); break; - case 5: sprintf (this->ChipID.ProcessorName,"Pentium II (0.25 micron)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"Pentium II With On-Die L2 Cache"); break; - case 7: sprintf (this->ChipID.ProcessorName,"Pentium III (0.25 micron)"); break; - case 8: sprintf (this->ChipID.ProcessorName,"Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "); break; - case 0xa: sprintf (this->ChipID.ProcessorName,"Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "); break; - case 0xb: sprintf (this->ChipID.ProcessorName,"Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "); break; - case 23: sprintf (this->ChipID.ProcessorName, "Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown P6 family"); return false; + case 0: this->ChipID.ProcessorName = "P6 A-Step"; break; + case 1: this->ChipID.ProcessorName = "P6"; break; + case 3: this->ChipID.ProcessorName = "Pentium II (0.28 micron)"; break; + case 5: this->ChipID.ProcessorName = "Pentium II (0.25 micron)"; break; + case 6: this->ChipID.ProcessorName = "Pentium II With On-Die L2 Cache"; break; + case 7: this->ChipID.ProcessorName = "Pentium III (0.25 micron)"; break; + case 8: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "; break; + case 0xa: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "; break; + case 0xb: this->ChipID.ProcessorName = "Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "; break; + case 23: this->ChipID.ProcessorName = "Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz"; break; + default: this->ChipID.ProcessorName = "Unknown P6 family"; return false; } break; case 7: - sprintf (this->ChipID.ProcessorName,"Intel Merced (IA-64)"); + this->ChipID.ProcessorName = "Intel Merced (IA-64)"; break; case 0xf: // Check the extended family bits... @@ -2054,21 +2044,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 0: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.18 micron)"); break; - case 1: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.18 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.13 micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Pentium 4 family"); return false; + case 0: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break; + case 1: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break; + case 2: this->ChipID.ProcessorName = "Pentium IV (0.13 micron)"; break; + default: this->ChipID.ProcessorName = "Unknown Pentium 4 family"; return false; } break; case 1: - sprintf (this->ChipID.ProcessorName,"Intel McKinley (IA-64)"); + this->ChipID.ProcessorName = "Intel McKinley (IA-64)"; break; default: - sprintf (this->ChipID.ProcessorName,"Pentium"); + this->ChipID.ProcessorName = "Pentium"; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Intel family"); + this->ChipID.ProcessorName = "Unknown Intel family"; return false; } break; @@ -2080,49 +2070,49 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: switch (this->ChipID.Model) { - case 3: sprintf (this->ChipID.ProcessorName,"80486DX2"); break; - case 7: sprintf (this->ChipID.ProcessorName,"80486DX2 WriteBack"); break; - case 8: sprintf (this->ChipID.ProcessorName,"80486DX4"); break; - case 9: sprintf (this->ChipID.ProcessorName,"80486DX4 WriteBack"); break; - case 0xe: sprintf (this->ChipID.ProcessorName,"5x86"); break; - case 0xf: sprintf (this->ChipID.ProcessorName,"5x86WB"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 80486 family"); return false; + case 3: this->ChipID.ProcessorName = "80486DX2"; break; + case 7: this->ChipID.ProcessorName = "80486DX2 WriteBack"; break; + case 8: this->ChipID.ProcessorName = "80486DX4"; break; + case 9: this->ChipID.ProcessorName = "80486DX4 WriteBack"; break; + case 0xe: this->ChipID.ProcessorName = "5x86"; break; + case 0xf: this->ChipID.ProcessorName = "5x86WB"; break; + default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false; } break; case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"SSA5 (PR75, PR90, PR100)"); break; - case 1: sprintf (this->ChipID.ProcessorName,"5k86 (PR120, PR133)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"5k86 (PR166)"); break; - case 3: sprintf (this->ChipID.ProcessorName,"5k86 (PR200)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"K6 (0.30 micron)"); break; - case 7: sprintf (this->ChipID.ProcessorName,"K6 (0.25 micron)"); break; - case 8: sprintf (this->ChipID.ProcessorName,"K6-2"); break; - case 9: sprintf (this->ChipID.ProcessorName,"K6-III"); break; - case 0xd: sprintf (this->ChipID.ProcessorName,"K6-2+ or K6-III+ (0.18 micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 80586 family"); return false; + case 0: this->ChipID.ProcessorName = "SSA5 (PR75, PR90 = PR100)"; break; + case 1: this->ChipID.ProcessorName = "5k86 (PR120 = PR133)"; break; + case 2: this->ChipID.ProcessorName = "5k86 (PR166)"; break; + case 3: this->ChipID.ProcessorName = "5k86 (PR200)"; break; + case 6: this->ChipID.ProcessorName = "K6 (0.30 micron)"; break; + case 7: this->ChipID.ProcessorName = "K6 (0.25 micron)"; break; + case 8: this->ChipID.ProcessorName = "K6-2"; break; + case 9: this->ChipID.ProcessorName = "K6-III"; break; + case 0xd: this->ChipID.ProcessorName = "K6-2+ or K6-III+ (0.18 micron)"; break; + default: this->ChipID.ProcessorName = "Unknown 80586 family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 1: sprintf (this->ChipID.ProcessorName,"Athlon- (0.25 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"Athlon- (0.18 micron)"); break; - case 3: sprintf (this->ChipID.ProcessorName,"Duron- (SF core)"); break; - case 4: sprintf (this->ChipID.ProcessorName,"Athlon- (Thunderbird core)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"Athlon- (Palomino core)"); break; - case 7: sprintf (this->ChipID.ProcessorName,"Duron- (Morgan core)"); break; + case 1: this->ChipID.ProcessorName = "Athlon- (0.25 micron)"; break; + case 2: this->ChipID.ProcessorName = "Athlon- (0.18 micron)"; break; + case 3: this->ChipID.ProcessorName = "Duron- (SF core)"; break; + case 4: this->ChipID.ProcessorName = "Athlon- (Thunderbird core)"; break; + case 6: this->ChipID.ProcessorName = "Athlon- (Palomino core)"; break; + case 7: this->ChipID.ProcessorName = "Duron- (Morgan core)"; break; case 8: if (this->Features.ExtendedFeatures.SupportsMP) - sprintf (this->ChipID.ProcessorName,"Athlon - MP (Thoroughbred core)"); - else sprintf (this->ChipID.ProcessorName,"Athlon - XP (Thoroughbred core)"); + this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)"; + else this->ChipID.ProcessorName = "Athlon - XP (Thoroughbred core)"; break; - default: sprintf (this->ChipID.ProcessorName,"Unknown K7 family"); return false; + default: this->ChipID.ProcessorName = "Unknown K7 family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown AMD family"); + this->ChipID.ProcessorName = "Unknown AMD family"; return false; } break; @@ -2133,12 +2123,12 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 4: sprintf (this->ChipID.ProcessorName,"Crusoe TM3x00 and TM5x00"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Crusoe family"); return false; + case 4: this->ChipID.ProcessorName = "Crusoe TM3x00 and TM5x00"; break; + default: this->ChipID.ProcessorName = "Unknown Crusoe family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Transmeta family"); + this->ChipID.ProcessorName = "Unknown Transmeta family"; return false; } break; @@ -2149,13 +2139,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"mP6 (0.25 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"mP6 (0.18 micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Rise family"); return false; + case 0: this->ChipID.ProcessorName = "mP6 (0.25 micron)"; break; + case 2: this->ChipID.ProcessorName = "mP6 (0.18 micron)"; break; + default: this->ChipID.ProcessorName = "Unknown Rise family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Rise family"); + this->ChipID.ProcessorName = "Unknown Rise family"; return false; } break; @@ -2166,13 +2156,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: switch (this->ChipID.Model) { - case 1: sprintf (this->ChipID.ProcessorName,"U5D"); break; - case 2: sprintf (this->ChipID.ProcessorName,"U5S"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown UMC family"); return false; + case 1: this->ChipID.ProcessorName = "U5D"; break; + case 2: this->ChipID.ProcessorName = "U5S"; break; + default: this->ChipID.ProcessorName = "Unknown UMC family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown UMC family"); + this->ChipID.ProcessorName = "Unknown UMC family"; return false; } break; @@ -2183,21 +2173,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 4: sprintf (this->ChipID.ProcessorName,"C6"); break; - case 8: sprintf (this->ChipID.ProcessorName,"C2"); break; - case 9: sprintf (this->ChipID.ProcessorName,"C3"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); return false; + case 4: this->ChipID.ProcessorName = "C6"; break; + case 8: this->ChipID.ProcessorName = "C2"; break; + case 9: this->ChipID.ProcessorName = "C3"; break; + default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 6: sprintf (this->ChipID.ProcessorName,"VIA Cyrix III - Samuel"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); return false; + case 6: this->ChipID.ProcessorName = "VIA Cyrix III - Samuel"; break; + default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); + this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; } break; @@ -2208,32 +2198,32 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: switch (this->ChipID.Model) { - case 4: sprintf (this->ChipID.ProcessorName,"MediaGX GX, GXm"); break; - case 9: sprintf (this->ChipID.ProcessorName,"5x86"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Cx5x86 family"); return false; + case 4: this->ChipID.ProcessorName = "MediaGX GX = GXm"; break; + case 9: this->ChipID.ProcessorName = "5x86"; break; + default: this->ChipID.ProcessorName = "Unknown Cx5x86 family"; return false; } break; case 5: switch (this->ChipID.Model) { - case 2: sprintf (this->ChipID.ProcessorName,"Cx6x86"); break; - case 4: sprintf (this->ChipID.ProcessorName,"MediaGX GXm"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Cx6x86 family"); return false; + case 2: this->ChipID.ProcessorName = "Cx6x86"; break; + case 4: this->ChipID.ProcessorName = "MediaGX GXm"; break; + default: this->ChipID.ProcessorName = "Unknown Cx6x86 family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"6x86MX"); break; - case 5: sprintf (this->ChipID.ProcessorName,"Cyrix M2 Core"); break; - case 6: sprintf (this->ChipID.ProcessorName,"WinChip C5A Core"); break; - case 7: sprintf (this->ChipID.ProcessorName,"WinChip C5B\\C5C Core"); break; - case 8: sprintf (this->ChipID.ProcessorName,"WinChip C5C-T Core"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 6x86MX\\Cyrix III family"); return false; + case 0: this->ChipID.ProcessorName = "6x86MX"; break; + case 5: this->ChipID.ProcessorName = "Cyrix M2 Core"; break; + case 6: this->ChipID.ProcessorName = "WinChip C5A Core"; break; + case 7: this->ChipID.ProcessorName = "WinChip C5B\\C5C Core"; break; + case 8: this->ChipID.ProcessorName = "WinChip C5C-T Core"; break; + default: this->ChipID.ProcessorName = "Unknown 6x86MX\\Cyrix III family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Cyrix family"); + this->ChipID.ProcessorName = "Unknown Cyrix family"; return false; } break; @@ -2244,21 +2234,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"Nx586 or Nx586FPU"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown NexGen family"); return false; + case 0: this->ChipID.ProcessorName = "Nx586 or Nx586FPU"; break; + default: this->ChipID.ProcessorName = "Unknown NexGen family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown NexGen family"); + this->ChipID.ProcessorName = "Unknown NexGen family"; return false; } break; case NSC: - sprintf (this->ChipID.ProcessorName,"Cx486SLC \\ DLC \\ Cx486S A-Step"); + this->ChipID.ProcessorName = "Cx486SLC \\ DLC \\ Cx486S A-Step"; break; default: - sprintf (this->ChipID.ProcessorName,"Unknown family"); // We cannot identify the processor. + this->ChipID.ProcessorName = "Unknown family"; // We cannot identify the processor. return false; } @@ -2365,7 +2355,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() this->ChipID.Family = atoi(this->ExtractValueFromCpuInfoFile(buffer,"cpu family").c_str()); // Chip Vendor - strcpy(this->ChipID.Vendor,this->ExtractValueFromCpuInfoFile(buffer,"vendor_id").c_str()); + this->ChipID.Vendor = this->ExtractValueFromCpuInfoFile(buffer,"vendor_id"); this->FindManufacturer(); // Chip Model @@ -2964,7 +2954,7 @@ bool SystemInformationImplementation::ParseSysCtl() kwsys_stl::string machineBuf(retBuf); if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos) { - strcpy(this->ChipID.Vendor, "IBM"); + this->ChipID.Vendor = "IBM"; len = 4; err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0); err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0); @@ -2982,13 +2972,14 @@ bool SystemInformationImplementation::ParseSysCtl() len = 128; err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0); // Chip Vendor - strcpy(this->ChipID.Vendor,retBuf); + this->ChipID.Vendor = retBuf; this->FindManufacturer(); - len=CHIPNAME_STRING_LENGTH; + ::memset(retBuf, 0, 128); err = sysctlbyname("machdep.cpu.brand_string", - this->ChipID.ProcessorName, &len, NULL, 0); + retBuf, &len, NULL, 0); + this->ChipID.ProcessorName = retBuf; // Chip Model len = sizeof(value); @@ -3175,11 +3166,11 @@ bool SystemInformationImplementation::QuerySolarisInfo() this->ChipID.Family = 0; // Chip Vendor - strcpy(this->ChipID.Vendor,"Sun"); + this->ChipID.Vendor = "Sun"; this->FindManufacturer(); // Chip Model - sprintf(this->ChipID.ProcessorName,"%s",this->ParseValueFromKStat("-s cpu_type").c_str()); + this->ChipID.ProcessorName = this->ParseValueFromKStat("-s cpu_type"); this->ChipID.Model = 0; // Cache size @@ -3233,7 +3224,7 @@ bool SystemInformationImplementation::QueryHaikuInfo() char vbuf[13]; strncpy(vbuf, cpu_info.eax_0.vendor_id, 12); vbuf[12] = '\0'; - strcpy(this->ChipID.Vendor,vbuf); + this->ChipID.Vendor = vbuf; this->FindManufacturer(); diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 6803332..433a86f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 15) +SET(KWSYS_DATE_STAMP_DAY 21) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 04f0774..7409b0b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -486,6 +486,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK}) set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) + set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] @@ -534,6 +535,34 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents") ENDIF(CTEST_RUN_CPackComponents) + IF(CTEST_RUN_CPackComponentsForAll) + set(CPackComponentsForAll_EXTRA_OPTIONS) + + set(CPackRun_CPackGen "-DCPackGen=ZIP") + set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") + set(CPackRun_CPackComponentWay "-DCPackComponentWay=default") + + ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" + "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project CPackComponentsForAll + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-options + -DCPACK_BINARY_ZIP:BOOL=ON + ${CPackComponentsForAll_EXTRA_OPTIONS} + --graphviz=CPackComponentsForAll.dot + --test-command ${CMAKE_CMAKE_COMMAND} + "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" + "${CPackRun_CPackCommand}" + "${CPackRun_CPackGen}" + "${CPackRun_CPackComponentWay}" + -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake") + + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll") + ENDIF(CTEST_RUN_CPackComponentsForAll) + # By default, turn this test off (because it takes a long time...) # if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators) @@ -779,6 +808,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} ) + SET_TESTS_PROPERTIES(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing") ADD_TEST(wrapping ${CMAKE_CTEST_COMMAND} diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 0ab2a67..3fb4652 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -77,6 +77,13 @@ set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;p set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2") list(APPEND platforms linux64_pgf90) +# nagfor dummy.f -Wl,-v +set(linux64_nagfor_text " /usr/libexec/gcc/x86_64-redhat-linux/4.4.5/collect2 --no-add-needed --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../.. /usr/local/NAG/lib/f90_init.o /usr/local/NAG/lib/quickfit.o dummy.o -rpath /usr/local/NAG/lib /usr/local/NAG/lib/libf53.so /usr/local/NAG/lib/libf53.a -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crtn.o") +set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickfit.o;/usr/local/NAG/lib/libf53.a;m;c") +set(linux64_nagfor_dirs "/usr/lib/gcc/x86_64-redhat-linux/4.4.5;/usr/lib64;/lib64;/usr/lib") +set(linux64_nagfor_obj_regex "^/usr/local/NAG/lib") +list(APPEND platforms linux64_nagfor) + # gcc dummy.c -v # in strange path set(linux64_test1_text " /this/might/match/as/a/linker/ld/but/it/is/not because the ld is not the last path component @@ -380,7 +387,7 @@ list(APPEND platforms msys_g77) # Test parsing for all above examples. foreach(p IN LISTS platforms) - cmake_parse_implicit_link_info("${${p}_text}" libs dirs log) + cmake_parse_implicit_link_info("${${p}_text}" libs dirs log "${${p}_obj_regex}") foreach(v libs dirs) if(NOT "${${v}}" STREQUAL "${${p}_${v}}") diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt new file mode 100644 index 0000000..971b2dc --- /dev/null +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -0,0 +1,120 @@ +# CPack Example: User-selectable Installation Components +# +# In this example, we have a simple library (mylib) with an example +# application (mylibapp). We create a binary installer (a CPack Generator) +# which supports CPack components. +# +# Depending on the CPack generator and on some CPACK_xxx var values +# the generator may produce a single (NSIS, PackageMaker) +# or several package files (Archive Generators, RPM, DEB) +cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR) +project(CPackComponentsForAll) + +# Create the mylib library +add_library(mylib mylib.cpp) + +# Create the mylibapp application +add_executable(mylibapp mylibapp.cpp) +target_link_libraries(mylibapp mylib) + +# Duplicate of mylibapp application +# which won't be put in any component (?mistake?) +add_executable(mylibapp2 mylibapp.cpp) +target_link_libraries(mylibapp2 mylib) + +# Create installation targets. Note that we put each kind of file +# into a different component via COMPONENT. These components will +# be used to create the installation components. +install(TARGETS mylib + ARCHIVE + DESTINATION lib + COMPONENT libraries) +install(TARGETS mylibapp + RUNTIME + DESTINATION bin + COMPONENT applications) + +# This application does not belong to any component +# thus (as of cmake 2.8.2) it will be left "uninstalled" +# by a component-aware installer unless a +# CPACK_MONOLITHIC_INSTALL=1 is set (at cmake time). +install(TARGETS mylibapp2 + RUNTIME + DESTINATION bin) + +install(FILES mylib.h + DESTINATION include + COMPONENT headers) + +# CPack boilerplate for this project +set(CPACK_PACKAGE_NAME "MyLib") +set(CPACK_PACKAGE_CONTACT "None") +set(CPACK_PACKAGE_VENDOR "CMake.org") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example") +set(CPACK_PACKAGE_VERSION "1.0.2") +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "2") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") + +# Tell CPack all of the components to install. The "ALL" +# refers to the fact that this is the set of components that +# will be included when CPack is instructed to put everything +# into the binary installer (the default behavior). +set(CPACK_COMPONENTS_ALL applications libraries headers Unspecified) + +# Set the displayed names for each of the components to install. +# These will be displayed in the list of components inside the installer. +set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "MyLib Application") +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") + +# Provide descriptions for each of the components to install. +# When the user hovers the mouse over the name of a component, +# the description will be shown in the "Description" box in the +# installer. If no descriptions are provided, the "Description" +# box will be removed. +set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION + "An extremely useful application that makes use of MyLib") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Static libraries used to build programs with MyLib") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C++ header files for use with MyLib") + +# Put the components into two different groups: "Runtime" and "Development" +set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime") +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") + +# Expand the "Development" group by default, since we have so few components. +# Also, provide this group with a description. +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_EXPANDED ON) +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION + "All of the tools you'll ever need to develop software") + +# It doesn't make sense to install the headers without the libraries +# (because you could never use the headers!), so make the headers component +# depend on the libraries component. +set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) + +# Create two installation types with pre-selected components. +# The "Developer" installation has just the library and headers, +# while the "Full" installation has everything. +set(CPACK_ALL_INSTALL_TYPES Full Developer) +set(CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything") +set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full) +set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) +set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) + +# We may use the CPack specific config file in order +# to tailor CPack behavio on a CPack generator specific way +# (Behavior would be different for RPM or TGZ or DEB ...) +if (USE_CPACK_PROJECT_CONFIG) + # Setup project specific CPack-time CPack Config file. + configure_file(${MyLib_SOURCE_DIR}/MyLibCPackConfig.cmake.in + ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake + @ONLY) + set(CPACK_PROJECT_CONFIG_FILE ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake) +endif (USE_CPACK_PROJECT_CONFIG) +# Include CPack to introduce the appropriate targets +include(CPack)
\ No newline at end of file diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in new file mode 100644 index 0000000..7ffafae --- /dev/null +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in @@ -0,0 +1,7 @@ +if(CPACK_GENERATOR MATCHES "ZIP") +# set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) +endif(CPACK_GENERATOR MATCHES "ZIP") + +if(CPACK_GENERATOR MATCHES "TGZ") + set(CPACK_MONOLITHIC_INSTALL 1) +endif(CPACK_GENERATOR MATCHES "TGZ") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake new file mode 100644 index 0000000..11f72ec --- /dev/null +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -0,0 +1,73 @@ +message(STATUS "=============================================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackComponentsForAll_BINARY_DIR) + message(FATAL_ERROR "CPackComponentsForAll_BINARY_DIR not set") +endif(NOT CPackComponentsForAll_BINARY_DIR) + +if(NOT CPackGen) + message(FATAL_ERROR "CPackGen not set") +endif(NOT CPackGen) +get_filename_component(CPACK_LOCATION ${CMAKE_COMMAND} PATH) +set(CPackCommand "${CPACK_LOCATION}/cpack") +message("cpack = ${CPackCommand}") +if(NOT CPackCommand) + message(FATAL_ERROR "CPackCommand not set") +endif(NOT CPackCommand) + +if(NOT CPackComponentWay) + message(FATAL_ERROR "CPackComponentWay not set") +endif(NOT CPackComponentWay) + +set(expected_file_mask "") +# The usual default behavior is to expect a single file +# Then some specific generators (Archive, RPM, ...) +# May produce several numbers of files depending on +# CPACK_COMPONENT_xxx values +set(expected_count 1) +set(config_type $ENV{CMAKE_CONFIG_TYPE}) +set(config_args ) +if(config_type) + set(config_args -C ${config_type}) +endif() +message(" ${config_args}") +execute_process(COMMAND ${CPackCommand} -G ${CPackGen} ${config_args} + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_error + WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) + +if (CPack_result) + message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") +else (CPack_result) + message(STATUS "CPack_output=${CPack_output}") +endif(CPack_result) + +if(CPackGen MATCHES "ZIP") + set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") + if (${CPackComponentWay} STREQUAL "default") + set(expected_count 1) + endif(${CPackComponentWay} STREQUAL "default") +endif(CPackGen MATCHES "ZIP") + +# Now verify if the number of expected file is OK +# - using expected_file_mask and +# - expected_count +if(expected_file_mask) + file(GLOB expected_file "${expected_file_mask}") + + message(STATUS "expected_count='${expected_count}'") + message(STATUS "expected_file='${expected_file}'") + message(STATUS "expected_file_mask='${expected_file_mask}'") + + if(NOT expected_file) + message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") + endif(NOT expected_file) + + list(LENGTH expected_file actual_count) + message(STATUS "actual_count='${actual_count}'") + if(NOT actual_count EQUAL expected_count) + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") + endif(NOT actual_count EQUAL expected_count) +endif(expected_file_mask) diff --git a/Tests/CPackComponentsForAll/mylib.cpp b/Tests/CPackComponentsForAll/mylib.cpp new file mode 100644 index 0000000..8ddac19 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib.cpp @@ -0,0 +1,7 @@ +#include "mylib.h" +#include "stdio.h" + +void mylib_function() +{ + printf("This is mylib"); +} diff --git a/Tests/CPackComponentsForAll/mylib.h b/Tests/CPackComponentsForAll/mylib.h new file mode 100644 index 0000000..5d0a822 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib.h @@ -0,0 +1 @@ +void mylib_function(); diff --git a/Tests/CPackComponentsForAll/mylibapp.cpp b/Tests/CPackComponentsForAll/mylibapp.cpp new file mode 100644 index 0000000..a438ac7 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylibapp.cpp @@ -0,0 +1,6 @@ +#include "mylib.h" + +int main() +{ + mylib_function(); +} diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 746c9a7..13f4233 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -55,7 +55,7 @@ ADD_CUSTOM_COMMAND( # Test creating files from a custom target # ################################################################ -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.dvi +ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}//doc1.dvi # test 2 slashes DEPENDS ${PROJECT_SOURCE_DIR}/doc1.tex COMMAND ${CMAKE_COMMAND} ARGS -E copy ${PROJECT_SOURCE_DIR}/doc1.tex diff --git a/Tests/Testing/Sub/Sub2/CMakeLists.txt b/Tests/Testing/Sub/Sub2/CMakeLists.txt index 3a7295d..fb9e861 100644 --- a/Tests/Testing/Sub/Sub2/CMakeLists.txt +++ b/Tests/Testing/Sub/Sub2/CMakeLists.txt @@ -3,3 +3,15 @@ # ADD_EXECUTABLE(testing2 testing2.cxx) ADD_TEST(testing.2 ${Testing_BINARY_DIR}/bin/testing2) + +add_test(NotCycle.a ${CMAKE_COMMAND} -E echo a) +add_test(NotCycle.test1 ${CMAKE_COMMAND} -E echo test1) +set_property(TEST NotCycle.test1 PROPERTY DEPENDS NotCycle.a) + +add_test(NotCycle.b ${CMAKE_COMMAND} -E echo b) +add_test(NotCycle.test2 ${CMAKE_COMMAND} -E echo test2) +set_property(TEST NotCycle.test2 PROPERTY DEPENDS NotCycle.b NotCycle.test1) + +add_test(NotCycle.c ${CMAKE_COMMAND} -E echo c) +add_test(NotCycle.test3 ${CMAKE_COMMAND} -E echo test3) +set_property(TEST NotCycle.test3 PROPERTY DEPENDS NotCycle.c NotCycle.test1 NotCycle.test2) diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt index 0c274f3..2420c97 100644 --- a/Utilities/Release/Cygwin/CMakeLists.txt +++ b/Utilities/Release/Cygwin/CMakeLists.txt @@ -1,8 +1,8 @@ -FILE(GLOB INSTALLED_CURSES /usr/bin/cygncurses*.dll) +FILE(GLOB INSTALLED_CURSES /usr/bin/cygncurses-*.dll) SET(MAX 0) FOREACH(f ${INSTALLED_CURSES}) IF(NOT "${f}" MATCHES "\\+") - STRING(REGEX REPLACE ".*([0-9]).dll" "\\1" NUMBER "${f}") + STRING(REGEX REPLACE ".*-([0-9]*).dll" "\\1" NUMBER "${f}") IF(NUMBER GREATER MAX) SET(MAX ${NUMBER}) ENDIF(NUMBER GREATER MAX) |