diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..878221f9b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +.gitattributes export-ignore + +bootstrap crlf=input +configure crlf=input +*.[1-9] crlf=input +*.sh crlf=input +*.sh.in crlf=input + +*.bat -crlf +*.dsp -crlf +*.dsptemplate -crlf +*.dsw -crlf +*.sln -crlf +*.vcproj -crlf diff --git a/CMakeLists.txt b/CMakeLists.txt index 872370a3d..c4ab27a9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,8 @@ MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY) # Allow empty endif() and such with CMake 2.4. SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1) +SET(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) + IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) # Since the built CMake will install itself instead of the # generating CMake, tell it that the install rules were generated @@ -27,6 +29,17 @@ IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) INSTALL(CODE "SET(CMAKE_INSTALL_SELF_2_4 1)") ENDIF() +IF("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + # Disallow architecture-specific try_run. It may not run on the host. + MACRO(TRY_RUN) + IF(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + MESSAGE(FATAL_ERROR "TRY_RUN not allowed with CMAKE_TRY_COMPILE_OSX_ARCHITECTURES=[${CMAKE_TRY_COMPILE_OSX_ARCHITECTURES}]") + ELSE() + _TRY_RUN(${ARGV}) + ENDIF() + ENDMACRO() +ENDIF() + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script @@ -139,9 +152,9 @@ MACRO(CMAKE_SETUP_TESTING) # the ctest from this cmake is used for testing # and not the ctest from the cmake building and testing # cmake. - SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest") - SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake") - SET(CMAKE_CPACK_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cpack") + SET(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") + SET(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") + SET(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") ENDIF(BUILD_TESTING) # configure some files for testing @@ -183,7 +196,7 @@ MACRO (CMAKE_BUILD_UTILITIES) SET(KWSYS_USE_CommandLineArguments 1) SET(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) SET(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}") - SUBDIRS(Source/kwsys) + ADD_SUBDIRECTORY(Source/kwsys) #--------------------------------------------------------------------- # Setup third-party libraries. @@ -212,7 +225,7 @@ MACRO (CMAKE_BUILD_UTILITIES) ELSE(CMAKE_USE_SYSTEM_ZLIB) SET(CMAKE_ZLIB_INCLUDES) SET(CMAKE_ZLIB_LIBRARIES cmzlib) - SUBDIRS(Utilities/cmzlib) + ADD_SUBDIRECTORY(Utilities/cmzlib) ENDIF(CMAKE_USE_SYSTEM_ZLIB) #--------------------------------------------------------------------- @@ -235,7 +248,7 @@ MACRO (CMAKE_BUILD_UTILITIES) ENDIF(NOT CMAKE_BUILD_CURL_SHARED) SET(CMAKE_CURL_INCLUDES) SET(CMAKE_CURL_LIBRARIES cmcurl) - SUBDIRS(Utilities/cmcurl) + ADD_SUBDIRECTORY(Utilities/cmcurl) ENDIF(CMAKE_USE_SYSTEM_CURL) #--------------------------------------------------------------------- @@ -252,7 +265,7 @@ MACRO (CMAKE_BUILD_UTILITIES) SET(CMAKE_COMPRESS_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress") SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") - SUBDIRS(Utilities/cmcompress) + ADD_SUBDIRECTORY(Utilities/cmcompress) #--------------------------------------------------------------------- # Build expat library for CMake and CTest. @@ -267,7 +280,7 @@ MACRO (CMAKE_BUILD_UTILITIES) ELSE(CMAKE_USE_SYSTEM_EXPAT) SET(CMAKE_EXPAT_INCLUDES) SET(CMAKE_EXPAT_LIBRARIES cmexpat) - SUBDIRS(Utilities/cmexpat) + ADD_SUBDIRECTORY(Utilities/cmexpat) ENDIF(CMAKE_USE_SYSTEM_EXPAT) #--------------------------------------------------------------------- @@ -302,7 +315,7 @@ MACRO (CMAKE_BUILD_UTILITIES) SET(BUILD_CursesDialog 0) ENDIF (UNIX) IF(BUILD_CursesDialog) - SUBDIRS(Source/CursesDialog/form) + ADD_SUBDIRECTORY(Source/CursesDialog/form) ENDIF(BUILD_CursesDialog) ENDMACRO (CMAKE_BUILD_UTILITIES) @@ -315,8 +328,8 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) -SET(CMake_VERSION_PATCH 0) -#SET(CMake_VERSION_RC 8) +SET(CMake_VERSION_PATCH 1) +#SET(CMake_VERSION_RC 5) # We use odd minor numbers for development versions. # Use a date for the development patch level. @@ -334,13 +347,15 @@ SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}") ENABLE_TESTING() INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) +# Set up test-time configuration. +SET_DIRECTORY_PROPERTIES(PROPERTIES + TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake") + # where to write the resulting executables and libraries SET(BUILD_SHARED_LIBS OFF) -SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE INTERNAL - "Where to put the executables for CMake") +SET(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL "Where to put the libraries for CMake") -INCLUDE_REGULAR_EXPRESSION("^.*$") # The CMake executables usually do not need any rpath to run in the build or # install tree. @@ -356,6 +371,10 @@ MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR) STRING(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}") STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}") +IF(BUILD_TESTING) + INCLUDE(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) +ENDIF() + # include special compile flags for some compilers INCLUDE(CompileFlags.cmake) @@ -442,9 +461,9 @@ MARK_AS_ADVANCED(CMAKE_STRICT) # build the remaining subdirectories -SUBDIRS(Source) -SUBDIRS(Utilities) -SUBDIRS(Tests) +ADD_SUBDIRECTORY(Source) +ADD_SUBDIRECTORY(Utilities) +ADD_SUBDIRECTORY(Tests) # add a test ADD_TEST(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" @@ -470,3 +489,10 @@ INSTALL( #----------------------------------------------------------------------- # End of the main section of the CMakeLists file #----------------------------------------------------------------------- + +# As a special case when building CMake itself, CMake 2.8.0 and below +# look up EXECUTABLE_OUTPUT_PATH in the top-level CMakeLists.txt file +# to compute the location of the "cmake" executable. We set it here +# so that those CMake versions can find it. We wait until after all +# the add_subdirectory() calls to avoid affecting the subdirectories. +SET(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 8553b4b48..0add34b92 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -16,6 +16,8 @@ set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) +set(CTEST_CDASH_VERSION "1.6") +set(CTEST_CDASH_QUERY_VERSION TRUE) # use old trigger stuff so that cmake 2.4 and below will not # get errors on trigger diff --git a/ChangeLog.manual b/ChangeLog.manual index 275ae3efd..847d9b38b 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,92 @@ +Changes in CMake 2.8.1 +- Fix failing test on cygwin +- Add a new serach path for MPICH2 + +Changes in CMake 2.8.1 RC 5 +- Fix FindQt4 to work with OpenGL on the mac +- Add .git .bzr and .hg to the list of default CPack ignore directories. + +Changes in CMake 2.8.1 RC 4 +- CTest: Do not hide test GUI windows (fixes 2.8.0 regression) +- Documentation: Clarify CMAKE_MODULE_PATH variable +- FindQt4: Add support for QtDeclartive module +- FortranCInterface: Fix PathScale detection +- Suppress GNU flag -fPIC on Windows (fixes 2.8.1-rc1 regression) + +Changes in CMake 2.8.1 RC 3 +- Add CMAKE_XCODE_ATTRIBUTE_ interface to set compiler (#9125) +- Fix Eclipse files for targets in subdirectories (#9978) +- Fix custom command rule hashes to avoid extra rebuilds +- Print non-make generator name in initial compiler test + +Changes in CMake 2.8.1 RC 2 +- CPack: Avoid deleting long PATH values with NSIS (#10257) +- CTest: Fix and test cost-based test scheduler +- CTest: Fix and test git updates for case of out-dated index +- CTest: Fix regression caused by fix for (#2336) in rc1 +- CTest: Setup command-line dashboard support with Git +- FindCUDA: Improve docs, use -rpath on Apple, fix dependency scanning +- Fix OS X deployment-target and sysroot defaults (#9959,#9898,#10155) +- Recognize the Compaq Fortran compiler + +Changes in CMake 2.8.1 RC 1 +- Add "NMake Makefiles JOM" generator +- Add PathScale compiler support +- Add per-configuration OUTPUT_DIRECTORY properties +- Add per-target OSX_ARCHITECTURES property +- check_type_size(): Handle mixed-size universal binaries +- CPack: Document Mac generators +- CPack: Improve RPM spec files +- Create CMAKE_FORCE_Fortran_COMPILER for cross-compiling +- CTest: Add --http1.0 command-line option +- CTest: Add --timeout command-line option +- CTest: Do not munge UTF-8 output in XML files +- CTest: Document CTEST_USE_LAUNCHERS option +- CTest: Fix killing of whole test process trees +- CTest: Handle failure of running invalid executables +- CTest: Honor the -C arg to ctest (#2336) +- CTest: Improve host system introspection +- CTest: Optionally randomize test order (--schedule-random) +- CTest: Skip tests with unsatisfied REQUIRED_FILES test property +- CTest: Submit arbitrary results with ATTACHED_FILES test property +- ctest_build(): Enhance signature +- ctest_start(): Add APPEND option +- ctest_start(): Move CTEST_CHECKOUT_COMMAND from ctest_update +- ctest_update(): Submit global tree revision in Update.xml +- Cygwin: Do not export all symbols from DLLs (#10122) +- Cygwin: Name DLLs with SOVERSION, not VERSION (#10122) +- Detect 32/64-bit Windows with Intel compiler +- Eclipse generator enhancements +- ExternalProject: Add TIMEOUT parameter +- FindCUDA: Respect CUDA version differences +- FindCURL: Find import libraries on Windows +- FindDCMTK: Look in more places +- FindGTest: Handle spaces better (#10065) +- FindGTK2: Look in fink locations on Mac OS X +- FindHDF5: Follow find-module API conventions +- FindJava: Support for versioned find +- FindJNI: Honor find_package() REQUIRED and QUIET options +- FindMPI: Improve Windows support +- FindOpenSSL: Fix MinGW support +- FindPythonLibs: Look in config for static library +- FindQt4: Misc enhancements, sync with KDE vesion +- FindRuby: Fix version convention on Windows +- FindX11: Improve documentation +- Fortran: Detect address size (#10119) +- FortranCInterface: Honor user flags +- Improve VS 2010 beta2 support +- link_directories(): Treat relative paths consistently (CMP0015) +- Modernize FindLibXslt and FindLibXml.cmake +- Refactor platform info to simplify adding new compilers +- Support cross-compiling versioned DLLs +- UseQt4: Provide dependencies only for static Qt (#10021) +- Address issues: + #2336, #3571, #5041, #7541, #8725, #9011, #9042, #9054, #9163, + #9171, #9450, #9697, #9764, #9782, #9792, #9862, #9894, #9913, + #9916, #9917, #9918, #9949, #9965, #9970, #9982, #9985, #10003, + #10014, #10021, #10032, #10055, #10060, #10065, #10114, #10119, + #10122, #10126, #10136. + Changes in CMake 2.8.0 Release - CPack: Honor CPACK_NSIS_DISPLAY_NAME (fixes regression) diff --git a/Docs/cmake-indent.vim b/Docs/cmake-indent.vim index 6c5d3340f..f149873ed 100644 --- a/Docs/cmake-indent.vim +++ b/Docs/cmake-indent.vim @@ -1,10 +1,10 @@ " ============================================================================= " " Program: CMake - Cross-Platform Makefile Generator -" Module: $RCSfile: cmake-indent.vim,v $ +" Module: $RCSfile$ " Language: VIM -" Date: $Date: 2008-01-16 16:53:53 $ -" Version: $Revision: 1.9 $ +" Date: $Date$ +" Version: $Revision$ " " ============================================================================= @@ -12,8 +12,8 @@ " Language: CMake (ft=cmake) " Author: Andy Cedilnik " Maintainer: Karthik Krishnan -" Last Change: $Date: 2008-01-16 16:53:53 $ -" Version: $Revision: 1.9 $ +" Last Change: $Date$ +" Version: $Revision$ " " Licence: The CMake license applies to this file. See " http://www.cmake.org/HTML/Copyright.html diff --git a/Docs/cmake-syntax.vim b/Docs/cmake-syntax.vim index df11a58fd..80b348eef 100644 --- a/Docs/cmake-syntax.vim +++ b/Docs/cmake-syntax.vim @@ -1,10 +1,10 @@ " ============================================================================= " " Program: CMake - Cross-Platform Makefile Generator -" Module: $RCSfile: cmake-syntax.vim,v $ +" Module: $RCSfile$ " Language: VIM -" Date: $Date: 2008-08-25 14:31:28 $ -" Version: $Revision: 1.10 $ +" Date: $Date$ +" Version: $Revision$ " " ============================================================================= @@ -12,8 +12,8 @@ " Language: CMake " Author: Andy Cedilnik " Maintainer: Karthik Krishnan -" Last Change: $Date: 2008-08-25 14:31:28 $ -" Version: $Revision: 1.10 $ +" Last Change: $Date$ +" Version: $Revision$ " " Licence: The CMake license applies to this file. See " http://www.cmake.org/HTML/Copyright.html diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index b7014cf8e..c6537cf3b 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -23,6 +23,17 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) + # Old CMake versions did not support OS X universal binaries anyway, + # so just get through this with at least some size for the types. + LIST(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS) + IF(${NUM_ARCHS} GREATER 1) + IF(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + MESSAGE(WARNING "This module does not work with OS X universal binaries.") + SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1) + LIST(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + ENDIF() + ENDIF() + INCLUDE (CheckTypeSize) CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT) CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG) @@ -70,6 +81,11 @@ IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL "Use sproc libs.") + + IF(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES) + ENDIF() ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) MARK_AS_ADVANCED( diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 842885764..051df4cc7 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,8 +2,10 @@ SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") SET(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") SET(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") SET(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@") +@SET_MSVC_C_ARCHITECTURE_ID@ SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") +SET(CMAKE_LINKER "@CMAKE_LINKER@") SET(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) SET(CMAKE_C_COMPILER_LOADED 1) SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) @@ -36,6 +38,7 @@ IF(CMAKE_C_COMPILER_ABI) ENDIF(CMAKE_C_COMPILER_ABI) SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@") +@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ SET(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") SET(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index a999e8db5..5d004c70a 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -36,6 +36,9 @@ #elif defined(__PGI) # define COMPILER_ID "PGI" +#elif defined(__PATHSCALE__) +# define COMPILER_ID "PathScale" + #elif defined(__GNUC__) # define COMPILER_ID "GNU" @@ -93,6 +96,7 @@ int main(int argc, char* argv[]) int require = 0; require += info_compiler[argc]; require += info_platform[argc]; + require += info_arch[argc]; (void)argv; return require; } diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 0cd461839..b264da1c9 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,8 +2,10 @@ SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") SET(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") SET(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") SET(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@") +@SET_MSVC_CXX_ARCHITECTURE_ID@ SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") +SET(CMAKE_LINKER "@CMAKE_LINKER@") SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) SET(CMAKE_CXX_COMPILER_LOADED 1) SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) @@ -37,6 +39,7 @@ IF(CMAKE_CXX_COMPILER_ABI) ENDIF(CMAKE_CXX_COMPILER_ABI) SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@") +@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ SET(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") SET(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 2c8aa3c3c..00ab8e217 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -38,6 +38,9 @@ #elif defined(__PGI) # define COMPILER_ID "PGI" +#elif defined(__PATHSCALE__) +# define COMPILER_ID "PathScale" + #elif defined(__GNUC__) # define COMPILER_ID "GNU" diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 9929dfa0d..0a7e9903e 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -114,6 +114,14 @@ IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) +IF(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG) + SET(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) +ENDIF() + +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG) + SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) +ENDIF() + IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}) ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) @@ -147,14 +155,6 @@ IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG) - SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_FLAG}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP) - SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP) - # Initialize CXX link type selection flags from C versions. FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index a655b0fd0..17fa05faf 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -171,11 +171,13 @@ ENDIF (CMAKE_CROSSCOMPILING INCLUDE(CMakeFindBinUtils) - +IF(MSVC_C_ARCHITECTURE_ID) + SET(SET_MSVC_C_ARCHITECTURE_ID + "SET(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})") +ENDIF(MSVC_C_ARCHITECTURE_ID) # configure variables set in this file for fast reload later on CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCCompiler.cmake" @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - + ) SET(CMAKE_C_COMPILER_ENV_VAR "CC") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 13d944e01..117010624 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -176,7 +176,10 @@ ENDIF (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) INCLUDE(CMakeFindBinUtils) - +IF(MSVC_CXX_ARCHITECTURE_ID) + SET(SET_MSVC_CXX_ARCHITECTURE_ID + "SET(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})") +ENDIF(MSVC_CXX_ARCHITECTURE_ID) # configure all variables set in this file CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 3899462b6..bddd6a1e8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -42,6 +42,11 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) ENDIF(NOT CMAKE_${lang}_COMPILER_ID) ENDFOREACH(flags) + # If the compiler is still unknown, try to query its vendor. + IF(NOT CMAKE_${lang}_COMPILER_ID) + CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) + ENDIF() + # if the format is unknown after all files have been checked, put "Unknown" in the cache IF(NOT CMAKE_EXECUTABLE_FORMAT) SET(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") @@ -57,6 +62,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + PARENT_SCOPE) ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID) #----------------------------------------------------------------------------- @@ -171,7 +178,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) SET(COMPILER_ID) SET(PLATFORM_ID) FILE(STRINGS ${file} - CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:") + CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 3 REGEX "INFO:") SET(HAVE_COMPILER_TWICE 0) FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") @@ -185,12 +192,17 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" PLATFORM_ID "${info}") ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") + IF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") + STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1" + ARCHITECTURE_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") ENDFOREACH(info) # Check if a valid compiler and platform were found. IF(COMPILER_ID AND NOT COMPILER_ID_TWICE) SET(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") SET(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") + SET(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE) # Check the compiler identification string. @@ -234,5 +246,42 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # Return the information extracted. SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + PARENT_SCOPE) SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) + +#----------------------------------------------------------------------------- +# Function to query the compiler vendor. +# This uses a table with entries of the form +# list(APPEND CMAKE_${lang}_COMPILER_ID_VENDORS ${vendor}) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor} -some-vendor-flag) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output") +# We try running the compiler with the flag for each vendor and +# matching its regular expression in the output. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) + FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) + SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) + SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${flags} + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + ) + IF("${output}" MATCHES "${regex}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "matched \"${regex}\":\n${output}") + SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) + BREAK() + ELSE() + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "did not match \"${regex}\":\n${output}") + ENDIF() + ENDFOREACH() +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 8adacd67c..0637d20d5 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -62,9 +62,6 @@ IF(NOT CMAKE_Fortran_COMPILER) # The order is 95 or newer compilers first, then 90, # then 77 or older compilers, gnu is always last in the group, # so if you paid for a compiler it is picked by default. - # NOTE for testing purposes this list is DUPLICATED in - # CMake/Source/CMakeLists.txt, IF YOU CHANGE THIS LIST, - # PLEASE UPDATE THAT FILE AS WELL! SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran gfortran-4 g95 f90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 @@ -165,6 +162,11 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) "-fpp" ) + # Table of per-vendor compiler id flags with expected output. + 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") + # Try to identify the compiler. SET(CMAKE_Fortran_COMPILER_ID) INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index c9793b451..b7a681acd 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -16,6 +16,13 @@ # It also bypasses the check for working compiler and basic compiler # information tests. # +# Macro CMAKE_FORCE_Fortran_COMPILER has the following signature: +# CMAKE_FORCE_Fortran_COMPILER( ) +# It sets CMAKE_Fortran_COMPILER to the given compiler and the cmake +# internal variable CMAKE_Fortran_COMPILER_ID to the given compiler-id. +# It also bypasses the check for working compiler and basic compiler +# information tests. +# # So a simple toolchain file could look like this: # INCLUDE (CMakeForceCompiler) # SET(CMAKE_SYSTEM_NAME Generic) @@ -60,3 +67,16 @@ MACRO(CMAKE_FORCE_CXX_COMPILER compiler id) SET(CMAKE_COMPILER_IS_GNUCXX 1) ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") ENDMACRO(CMAKE_FORCE_CXX_COMPILER) + +MACRO(CMAKE_FORCE_Fortran_COMPILER compiler id) + SET(CMAKE_Fortran_COMPILER "${compiler}") + SET(CMAKE_Fortran_COMPILER_ID_RUN TRUE) + SET(CMAKE_Fortran_COMPILER_ID ${id}) + SET(CMAKE_Fortran_COMPILER_WORKS TRUE) + SET(CMAKE_Fortran_COMPILER_FORCED TRUE) + + # Set old compiler id variables. + IF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + SET(CMAKE_COMPILER_IS_GNUG77 1) + ENDIF("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") +ENDMACRO(CMAKE_FORCE_Fortran_COMPILER) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index d8a9ed6cd..ba2b46d63 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -30,5 +30,17 @@ ELSE(UNIX) SET(CMAKE_Fortran_OUTPUT_EXTENSION .obj) ENDIF(UNIX) +# Save compiler ABI information. +SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@") +SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@") + +IF(CMAKE_Fortran_SIZEOF_DATA_PTR) + SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}") +ENDIF(CMAKE_Fortran_SIZEOF_DATA_PTR) + +IF(CMAKE_Fortran_COMPILER_ABI) + SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}") +ENDIF(CMAKE_Fortran_COMPILER_ABI) + SET(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") SET(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F index cf8662fb8..b8efb426e 100644 --- a/Modules/CMakeFortranCompilerABI.F +++ b/Modules/CMakeFortranCompilerABI.F @@ -1,3 +1,33 @@ - PROGRAM CMakeFortranCompilerId - PRINT *, 'ABI Detection Binary' + PROGRAM CMakeFortranCompilerABI +#if 0 +! Address Size +#endif +#if defined(_LP64) + PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(_M_IA64) + PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(_M_X64) + PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(_M_AMD64) + PRINT *, 'INFO:sizeof_dptr[8]' + +#elif defined(_ILP32) + PRINT *, 'INFO:sizeof_dptr[4]' +#elif defined(_M_IX86) + PRINT *, 'INFO:sizeof_dptr[4]' +#endif + +#if 0 +! Application Binary Interface +#endif +#if defined(__sgi) && defined(_ABIO32) + PRINT *, 'INFO:abi[ELF O32]' +#elif defined(__sgi) && defined(_ABIN32) + PRINT *, 'INFO:abi[ELF N32]' +#elif defined(__sgi) && defined(_ABI64) + PRINT *, 'INFO:abi[ELF 64]' +#elif defined(__ELF__) + PRINT *, 'INFO:abi[ELF]' +#endif + PRINT *, 'ABI Detection' END diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index c92f127a2..107470cd0 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -8,6 +8,8 @@ PRINT *, 'INFO:compiler[SunPro]' #elif defined(__G95__) PRINT *, 'INFO:compiler[G95]' +#elif defined(__PATHSCALE__) + PRINT *, 'INFO:compiler[PathScale]' #elif defined(__GNUC__) PRINT *, 'INFO:compiler[GNU]' #elif defined(__IBMC__) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index ea4feb08d..97a5e7e91 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -89,6 +89,14 @@ IF(NOT 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) +IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) + SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) +ENDIF() + +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) + SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) +ENDIF() + # repeat for modules IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) @@ -98,14 +106,6 @@ IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG) - SET(CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG) - -IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG_SEP) - SET(CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Fortran_FLAG_SEP) - IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index c66d5c52f..c0f3aa6aa 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -88,6 +88,3 @@ MARK_AS_ADVANCED( CMAKE_SKIP_RPATH CMAKE_VERBOSE_MAKEFILE ) - -# always include the gcc compiler information -INCLUDE(Platform/gcc) diff --git a/Modules/CMakeJOMFindMake.cmake b/Modules/CMakeJOMFindMake.cmake new file mode 100644 index 000000000..a72420ab6 --- /dev/null +++ b/Modules/CMakeJOMFindMake.cmake @@ -0,0 +1,18 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + + +SET (CMAKE_MAKE_PROGRAM "jom" CACHE STRING + "Program used to build from makefiles.") +MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 8e786ba79..e20348aac 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -82,8 +82,33 @@ #endif +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is becase + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID "" +#endif + /* Construct the string literal in pieces to prevent the source from getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 8d4d51fde..75d737f9a 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -63,8 +63,6 @@ ENDIF(CMAKE_EXTRA_GENERATOR) IF(NOT CMAKE_MODULE_EXISTS) SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}") SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}") - SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) - SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) ENDIF(NOT CMAKE_MODULE_EXISTS) diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 856a65b47..eeaff7d64 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -12,13 +12,15 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE(CMakeTestCompilerCommon) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C compiler can actually compile # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. IF(NOT CMAKE_C_COMPILER_WORKS) - MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER}") + PrintTestCompilerStatus("C" "") FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c "#ifdef __cplusplus\n" "# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n" @@ -38,7 +40,7 @@ IF(NOT CMAKE_C_COMPILER_WORKS) ENDIF(NOT CMAKE_C_COMPILER_WORKS) IF(NOT CMAKE_C_COMPILER_WORKS) - MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER} -- broken") + PrintTestCompilerStatus("C" " -- broken") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the C compiler works failed with " "the following output:\n${OUTPUT}\n\n") @@ -53,7 +55,7 @@ IF(NOT CMAKE_C_COMPILER_WORKS) "CMake will not be able to correctly generate this project.") ELSE(NOT CMAKE_C_COMPILER_WORKS) IF(C_TEST_WAS_RUN) - MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER} -- works") + PrintTestCompilerStatus("C" " -- works") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the C compiler works passed with " "the following output:\n${OUTPUT}\n\n") diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 81b848499..72bb8f2c9 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -12,13 +12,15 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE(CMakeTestCompilerCommon) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C++ compiler can actually compile # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. IF(NOT CMAKE_CXX_COMPILER_WORKS) - MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER}") + PrintTestCompilerStatus("CXX" "") FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx "#ifndef __cplusplus\n" "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n" @@ -31,7 +33,7 @@ IF(NOT CMAKE_CXX_COMPILER_WORKS) ENDIF(NOT CMAKE_CXX_COMPILER_WORKS) IF(NOT CMAKE_CXX_COMPILER_WORKS) - MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- broken") + PrintTestCompilerStatus("CXX" " -- broken") # if the compiler is broken make sure to remove the platform file # since Windows-cl configures both c/cxx files both need to be removed # when c or c++ fails @@ -46,7 +48,7 @@ IF(NOT CMAKE_CXX_COMPILER_WORKS) "CMake will not be able to correctly generate this project.") ELSE(NOT CMAKE_CXX_COMPILER_WORKS) IF(CXX_TEST_WAS_RUN) - MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- works") + PrintTestCompilerStatus("CXX" " -- works") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the CXX compiler works passed with " "the following output:\n${OUTPUT}\n\n") diff --git a/Modules/CMakeTestCompilerCommon.cmake b/Modules/CMakeTestCompilerCommon.cmake new file mode 100644 index 000000000..4307627d9 --- /dev/null +++ b/Modules/CMakeTestCompilerCommon.cmake @@ -0,0 +1,21 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +function(PrintTestCompilerStatus LANG MSG) + IF(CMAKE_GENERATOR MATCHES Make) + MESSAGE(STATUS "Check for working ${LANG} compiler: ${CMAKE_${LANG}_COMPILER}${MSG}") + ELSE() + MESSAGE(STATUS "Check for working ${LANG} compiler using: ${CMAKE_GENERATOR}${MSG}") + ENDIF() +endfunction() diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index 31857b117..6f419c28b 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -12,13 +12,15 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) +INCLUDE(CMakeTestCompilerCommon) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected Fortran compiler can actually compile # and link the most basic of programs. If not, a fatal error # is set and cmake stops processing commands and will not generate # any makefiles or projects. IF(NOT CMAKE_Fortran_COMPILER_WORKS) - MESSAGE(STATUS "Check for working Fortran compiler: ${CMAKE_Fortran_COMPILER}") + PrintTestCompilerStatus("Fortran" "") FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f " PROGRAM TESTFortran PRINT *, 'Hello' @@ -31,7 +33,7 @@ IF(NOT CMAKE_Fortran_COMPILER_WORKS) ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS) IF(NOT CMAKE_Fortran_COMPILER_WORKS) - MESSAGE(STATUS "Check for working Fortran compiler: ${CMAKE_Fortran_COMPILER} -- broken") + PrintTestCompilerStatus("Fortran" " -- broken") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the Fortran compiler works failed with " "the following output:\n${OUTPUT}\n\n") @@ -41,7 +43,7 @@ IF(NOT CMAKE_Fortran_COMPILER_WORKS) "CMake will not be able to correctly generate this project.") ELSE(NOT CMAKE_Fortran_COMPILER_WORKS) IF(FORTRAN_TEST_WAS_RUN) - MESSAGE(STATUS "Check for working Fortran compiler: ${CMAKE_Fortran_COMPILER} -- works") + PrintTestCompilerStatus("Fortran" " -- works") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran compiler works passed with " "the following output:\n${OUTPUT}\n\n") diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake old mode 100755 new mode 100644 diff --git a/Modules/CPack.DS_Store.in b/Modules/CPack.DS_Store.in old mode 100755 new mode 100644 diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in old mode 100644 new mode 100755 diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 93cf28e1c..2991ada2f 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -107,6 +107,66 @@ # that won't be packaged when building a source package. This is a # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* # +# The following variables are specific to the DragNDrop installers +# built on Mac OS X: +# +# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk +# image. Defaults to CPACK_PACKAGE_FILE_NAME. +# +# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO +# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF +# bzip2-compressed). Refer to hdiutil(1) for more information on +# other available formats. +# +# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. +# can be used to specify the Finder window position/geometry and +# layout (such as hidden toolbars, placement of the icons etc.). +# This file has to be generated by the Finder (either manually or +# through OSA-script) using a normal folder from which the .DS_Store +# file can then be extracted. +# +# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be +# used as the background for the Finder Window when the disk image +# is opened. By default no background image is set. The background +# image is applied after applying the custom .DS_Store file. +# +# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to +# operate on disk image files on Mac OS X. This variable can be used +# to override the automatically detected command (or specify its +# location if the auto-detection fails to find it.) +# +# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set +# extended attributes on files and directories on Mac OS X. This +# variable can be used to override the automatically detected +# command (or specify its location if the auto-detection fails to +# find it.) +# +# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile +# resources on Mac OS X. This variable can be used to override the +# automatically detected command (or specify its location if the +# auto-detection fails to find it.) +# +# Installers built on Mac OS X using the Bundle generator use the +# aforementioned DragNDrop variables, plus the following Bundle-specific +# parameters: +# +# CPACK_BUNDLE_NAME - The name of the generated bundle. This +# appears in the OSX finder as the bundle name. Required. +# +# CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used +# as the Info.plist for the generated bundle. This assumes that +# the caller has generated or specified their own Info.plist file. +# Required. +# +# CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as +# the icon for the generated bundle. This is the icon that appears +# in the OSX finder for the bundle, and in the OSX dock when the +# bundle is opened. Required. +# +# CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that +# will be run whenever an end-user double-clicks the generated bundle +# in the OSX Finder. Optional. +# # The following variables are specific to the graphical installers built # on Windows using the Nullsoft Installation System. # @@ -866,7 +926,7 @@ cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source") cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source") cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES - "/CVS/;/\\\\\\\\.svn/;\\\\\\\\.swp$;\\\\\\\\.#;/#") + "/CVS/;/\\\\\\\\.svn/;/\\\\\\\\.bzr/;/\\\\\\\\.hg/;/\\\\\\\\.git/;\\\\\\\\.swp$;\\\\\\\\.#;/#") SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 5167fa765..29a12184f 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -4,7 +4,7 @@ # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration # # However CPackRPM has specific features which are controlled by -# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on +# the specifics CPACK_RPM_XXX variables. You'll find a detailed usage on # the wiki: # http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 # However as a handy reminder here comes the list of specific variables: @@ -44,7 +44,7 @@ # The RPM package group. # CPACK_RPM_PACKAGE_VENDOR # Mandatory : YES -# Default : CPACK_PACKAGE_VENDOR if set or"unknown" +# Default : CPACK_PACKAGE_VENDOR if set or "unknown" # The RPM package group. # CPACK_RPM_PACKAGE_DESCRIPTION # Mandatory : YES @@ -52,7 +52,14 @@ # CPACK_RPM_PACKAGE_REQUIRES # Mandatory : NO # Default : - -# May be used to set RPM dependencies. +# May be used to set RPM dependencies (requires). +# Note that you must enclose the complete requires string between quotes, +# for example: +# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") +# CPACK_RPM_PACKAGES_PROVIDES +# Mandatory : NO +# Default : - +# May be used to set RPM dependencies (provides). # CPACK_RPM_SPEC_INSTALL_POST # Mandatory : NO # Default : - @@ -69,6 +76,38 @@ # May be set when invoking cpack in order to trace debug informations # during CPack RPM run. For example you may launch CPack like this # cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM +# CPACK_RPM_USER_BINARY_SPECFILE +# Mandatory : NO +# Default : - +# May be set by the user in order to specify a USER binary spec file +# to be used by CPackRPM instead of generating the file. +# The specified file will be processed by CONFIGURE_FILE( @ONLY). +# CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE +# Mandatory : NO +# Default : - +# If set CPack will generate a template for USER specified binary +# spec file and stop with an error. For example launch CPack like this +# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM +# The user may then use this file in order to hand-craft is own +# binary spec file which may be used with CPACK_RPM_USER_BINARY_SPECFILE. +# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE +# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE +# Mandatory : NO +# Default : - +# May be used to embbed a pre (un)installation script in the spec file. +# The refered script file(s) will be read and directly +# put after the %pre or %preun section +# One may verify which scriptlet has been included with +# rpm -qp --scripts package.rpm +# CPACK_RPM_POST_INSTALL_SCRIPT_FILE +# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE +# Mandatory : NO +# Default : - +# May be used to embbed a post (un)installation script in the spec file. +# The refered script file(s) will be read and directly +# put after the %post or %postun section +# One may verify which scriptlet has been included with +# rpm -qp --scripts package.rpm #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -236,6 +275,16 @@ IF(CPACK_RPM_PACKAGE_REQUIRES) SET(TMP_RPM_REQUIRES "Requires: ${CPACK_RPM_PACKAGE_REQUIRES}") ENDIF(CPACK_RPM_PACKAGE_REQUIRES) +# CPACK_RPM_PACKAGE_PROVIDES +# Placeholder used to specify binary RPM dependencies (if any) +# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html +IF(CPACK_RPM_PACKAGE_PROVIDES) + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: User defined Provides:\n ${CPACK_RPM_PACKAGE_PROVIDES}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + SET(TMP_RPM_PROVIDES "Provides: ${CPACK_RPM_PACKAGE_PROVIDES}") +ENDIF(CPACK_RPM_PACKAGE_PROVIDES) + # CPACK_RPM_SPEC_INSTALL_POST # May be used to define a RPM post intallation script # for example setting it to "/bin/true" may prevent @@ -247,6 +296,48 @@ IF(CPACK_RPM_SPEC_INSTALL_POST) SET(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") ENDIF(CPACK_RPM_SPEC_INSTALL_POST) +# CPACK_RPM_POST_INSTALL_SCRIPT_FILE +# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE +# May be used to embbed a post (un)installation script in the spec file. +# The refered script file(s) will be read and directly +# put after the %post or %postun section +if(CPACK_RPM_POST_INSTALL_SCRIPT_FILE) + if(EXISTS ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) + file(READ ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_POSTINSTALL) + else(EXISTS ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) + message("CPackRPM:Warning: CPACK_RPM_POST_INSTALL_SCRIPT_FILE <${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}> does not exists - ignoring") + endif(EXISTS ${CPACK_RPM_POST_INSTALL_SCRIPT_FILE}) +endif(CPACK_RPM_POST_INSTALL_SCRIPT_FILE) + +if(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE) + if(EXISTS ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) + file(READ ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_POSTUNINSTALL) + else(EXISTS ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) + message("CPackRPM:Warning: CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}> does not exists - ignoring") + endif(EXISTS ${CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE}) +endif(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE) + +# CPACK_RPM_PRE_INSTALL_SCRIPT_FILE +# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE +# May be used to embbed a pre (un)installation script in the spec file. +# The refered script file(s) will be read and directly +# put after the %pre or %preun section +if(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE) + if(EXISTS ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) + file(READ ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_PREINSTALL) + else(EXISTS ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) + message("CPackRPM:Warning: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}> does not exists - ignoring") + endif(EXISTS ${CPACK_RPM_PRE_INSTALL_SCRIPT_FILE}) +endif(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE) + +if(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE) + if(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) + file(READ ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE} CPACK_RPM_SPEC_PREUNINSTALL) + else(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) + message("CPackRPM:Warning: CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE <${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}> does not exists - ignoring") + endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE}) +endif(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE) + # CPACK_RPM_SPEC_MORE_DEFINE # This is a generated spec rpm file spaceholder IF(CPACK_RPM_SPEC_MORE_DEFINE) @@ -255,10 +346,6 @@ IF(CPACK_RPM_SPEC_MORE_DEFINE) ENDIF(CPACK_RPM_PACKAGE_DEBUG) ENDIF(CPACK_RPM_SPEC_MORE_DEFINE) -# CPACK_RPM_USER_BINARY_SPECFILE -# FIXME when this is set then CPack should us the -# user provided file. - # Now we may create the RPM build tree structure SET(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") MESSAGE(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") @@ -279,75 +366,111 @@ SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") # Use files tree to construct files command (spec file) -EXECUTE_PROCESS(COMMAND find -type f +# We should not forget to include symlinks (thus -o -type l) +# We must remove the './' due to the local search (thus the sed) +# Then we must authorize any man pages extension (adding * at the end) +# because rpmbuild may automatically compress those files +EXECUTE_PROCESS(COMMAND find -type f -o -type l COMMAND sed {s/\\.//} + COMMAND sed {s/.*man.*\\/.*/&*/} WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) - + +# The name of the final spec file to be used by rpmbuild SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") -IF(CPACK_RPM_USER_BINARY_SPECFILE) - # User may have specified SPECFILE just use it - MESSAGE("CPackRPM: Will use user specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") - # Note that user provided file is processed for @var replacement - CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) -ELSE(CPACK_RPM_USER_BINARY_SPECFILE) - # No User specified spec file generate a valid one using var values - IF(CPACK_RPM_PACKAGE_DEBUG) - MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") - MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) - FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE} - "# -*- rpm-spec -*- -Buildroot: ${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} -Summary: ${CPACK_RPM_PACKAGE_SUMMARY} -Name: ${CPACK_RPM_PACKAGE_NAME} -Version: ${CPACK_RPM_PACKAGE_VERSION} -Release: ${CPACK_RPM_PACKAGE_RELEASE} -License: ${CPACK_RPM_PACKAGE_LICENSE} -Group: ${CPACK_RPM_PACKAGE_GROUP} -Vendor: ${CPACK_RPM_PACKAGE_VENDOR} -${TMP_RPM_REQUIRES} -${TMP_RPM_BUILDARCH} - -#p define prefix ${CMAKE_INSTALL_PREFIX} -%define _rpmdir ${CPACK_RPM_DIRECTORY} -%define _rpmfilename ${CPACK_RPM_FILE_NAME} + +# Print out some debug information if we were asked for that +IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + MESSAGE("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + MESSAGE("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") + MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") + MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") +ENDIF(CPACK_RPM_PACKAGE_DEBUG) + +# USER generated spec file handling. +# We should generate a spec file template: +# - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE +# - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE +# +IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in + "# -*- rpm-spec -*- +Buildroot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@ +Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ +Name: \@CPACK_RPM_PACKAGE_NAME\@ +Version: \@CPACK_RPM_PACKAGE_VERSION\@ +Release: \@CPACK_RPM_PACKAGE_RELEASE\@ +License: \@CPACK_RPM_PACKAGE_LICENSE\@ +Group: \@CPACK_RPM_PACKAGE_GROUP\@ +Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ +\@TMP_RPM_REQUIRES\@ +\@TMP_RPM_PROVIDES\@ +\@TMP_RPM_BUILDARCH\@ + +#p define prefix \@CMAKE_INSTALL_PREFIX\@ +%define _rpmdir \@CPACK_RPM_DIRECTORY\@ +%define _rpmfilename \@CPACK_RPM_FILE_NAME\@ %define _unpackaged_files_terminate_build 0 -%define _topdir ${CPACK_RPM_DIRECTORY} -${TMP_RPM_SPEC_INSTALL_POST} -${CPACK_RPM_SPEC_MORE_DEFINE} - +%define _topdir \@CPACK_RPM_DIRECTORY\@ +\@TMP_RPM_SPEC_INSTALL_POST\@ +\@CPACK_RPM_SPEC_MORE_DEFINE\@ + %description -${CPACK_RPM_PACKAGE_DESCRIPTION} +\@CPACK_RPM_PACKAGE_DESCRIPTION\@ -# This is a shortcutted spec file -# generated by CMake RPM generator -# we skip the _prepn _build and _install -# steps because CPack does that for us -# WE MUST NOT DO ANYTHING in those steps because they -# may fail for non-privileged user -#p prep +# This is a shortcutted spec file generated by CMake RPM generator +# we skip _install step because CPack does that for us. +# We do only save CPack installed tree in _prepr +# and then restore it in build. +%prep +mv $RPM_BUILD_ROOT \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot #p build -#p install +%install +if [ -e $RPM_BUILD_ROOT ]; +then + mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT +else + mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT +fi %clean +%post +\@CPACK_RPM_SPEC_POSTINSTALL\@ + +%postun +\@CPACK_RPM_SPEC_POSTUNINSTALL\@ + +%pre +\@CPACK_RPM_SPEC_PREINSTALL\@ + +%preun +\@CPACK_RPM_SPEC_PREUNINSTALL\@ + %files %defattr(-,root,root,-) -#p dir %{prefix} -#p {prefix}/* ${CPACK_RPM_INSTALL_FILES} %changelog +* Sat Nov 28 2009 Erk + Refix backup/restore install tree for OpenSuSE 11.2 +* Sun Nov 22 2009 Erk + Include symlinks in the file list. +* Sat Nov 14 2009 Erk + Replace prep and build step with backup and restore + of the previously CPack installed tree. This should + mimic what is expected in rpmbuild usual steps +* Wed Nov 11 2009 Erk + Add support for USER defined pre/post[un]install scripts +* Wed Oct 07 2009 Erk + Add user custom spec file support * Sat Oct 03 2009 Kami Update to handle more precisely the files section * Mon Oct 03 2008 Erk @@ -358,9 +481,28 @@ ${CPACK_RPM_INSTALL_FILES} * Tue Aug 16 2007 Erk Generated by CPack RPM Generator and associated macros ") + # Stop here if we were asked to only generate a template USER spec file + # The generated file may then be used as a template by user who wants + # to customize their own spec file. + IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) + MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in") + ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) +ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + +# After that we may either use a user provided spec file +# or generate one using appropriate variables value. +IF(CPACK_RPM_USER_BINARY_SPECFILE) + # User may have specified SPECFILE just use it + MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") + # The user provided file is processed for @var replacement + CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) +ELSE(CPACK_RPM_USER_BINARY_SPECFILE) + # No User specified spec file, will use the generated spec file + MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") + # Note the just created file is processed for @var replacement + CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) ENDIF(CPACK_RPM_USER_BINARY_SPECFILE) - IF(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE EXECUTE_PROCESS( diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index aaa604064..2d0702e96 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -1,13 +1,49 @@ # - Configure a project for testing with CTest/CDash -# This file configures a project to use the CTest/CDash/Dart -# testing/dashboard process. This module should be included -# in the CMakeLists.txt file at the top of a project. Typical usage: -# INCLUDE(CTest) -# IF(BUILD_TESTING) -# # ... testing related CMake code ... -# ENDIF(BUILD_TESTING) -# The BUILD_TESTING option is created by the CTest module to determine -# whether testing support should be enabled. The default is ON. +# Include this module in the top CMakeLists.txt file of a project to +# enable testing with CTest and dashboard submissions to CDash: +# project(MyProject) +# ... +# include(CTest) +# The module automatically creates a BUILD_TESTING option that selects +# whether to enable testing support (ON by default). After including +# the module, use code like +# if(BUILD_TESTING) +# # ... CMake code to create tests ... +# endif() +# to creating tests when testing is enabled. +# +# To enable submissions to a CDash server, create a CTestConfig.cmake +# file at the top of the project with content such as +# set(CTEST_PROJECT_NAME "MyProject") +# set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +# set(CTEST_DROP_METHOD "http") +# set(CTEST_DROP_SITE "my.cdash.org") +# set(CTEST_DROP_LOCATION "/submit.php?project=MyProject") +# set(CTEST_DROP_SITE_CDASH TRUE) +# (the CDash server can provide the file to a project administrator +# who configures 'MyProject'). +# Settings in the config file are shared by both this CTest module and +# the CTest command-line tool's dashboard script mode (ctest -S). +# +# While building a project for submission to CDash, CTest scans the +# build output for errors and warnings and reports them with +# surrounding context from the build log. This generic approach works +# for all build tools, but does not give details about the command +# invocation that produced a given problem. One may get more detailed +# reports by adding +# set(CTEST_USE_LAUNCHERS 1) +# to the CTestConfig.cmake file. When this option is enabled, the +# CTest module tells CMake's Makefile generators to invoke every +# command in the generated build system through a CTest launcher +# program. (Currently the CTEST_USE_LAUNCHERS option is ignored on +# non-Makefile generators.) During a manual build each launcher +# transparently runs the command it wraps. During a CTest-driven +# build for submission to CDash each launcher reports detailed +# information when its command fails or warns. +# (Setting CTEST_USE_LAUNCHERS in CTestConfig.cmake is convenient, but +# also adds the launcher overhead even for manual builds. One may +# instead set it in a CTest dashboard script and add it to the CMake +# cache for the build tree.) #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -84,62 +120,45 @@ IF(BUILD_TESTING) ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT") - # make program just needs to use CMAKE_MAKE_PROGRAM which is required - # to be defined by cmake - SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM}) - FIND_PROGRAM(CVSCOMMAND cvs ) SET(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING "Options passed to the cvs update command.") FIND_PROGRAM(SVNCOMMAND svn) FIND_PROGRAM(BZRCOMMAND bzr) FIND_PROGRAM(HGCOMMAND hg) + FIND_PROGRAM(GITCOMMAND git) IF(NOT UPDATE_TYPE) IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") SET(UPDATE_TYPE cvs) - ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - SET(UPDATE_TYPE svn) - ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - SET(UPDATE_TYPE bzr) - ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") - SET(UPDATE_TYPE hg) - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") - ENDIF(NOT UPDATE_TYPE) - - IF(NOT UPDATE_TYPE) - IF(NOT __CTEST_UPDATE_TYPE_COMPLAINED) - SET(__CTEST_UPDATE_TYPE_COMPLAINED 1 CACHE INTERNAL "Already complained about update type.") - MESSAGE(STATUS "CTest cannot determine repository type. Please set UPDATE_TYPE to 'cvs' or 'svn'. CTest update will not work.") - ENDIF(NOT __CTEST_UPDATE_TYPE_COMPLAINED) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") + SET(UPDATE_TYPE svn) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") + SET(UPDATE_TYPE bzr) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") + SET(UPDATE_TYPE hg) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + SET(UPDATE_TYPE git) + ENDIF() ENDIF(NOT UPDATE_TYPE) STRING(TOLOWER "${UPDATE_TYPE}" _update_type) IF("${_update_type}" STREQUAL "cvs") SET(UPDATE_COMMAND "${CVSCOMMAND}") SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") - ELSE("${_update_type}" STREQUAL "cvs") - IF("${_update_type}" STREQUAL "svn") - SET(UPDATE_COMMAND "${SVNCOMMAND}") - SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") - ELSE("${_update_type}" STREQUAL "svn") - IF("${_update_type}" STREQUAL "bzr") - SET(UPDATE_COMMAND "${BZRCOMMAND}") - SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") - ELSE("${_update_type}" STREQUAL "bzr") - IF("${_update_type}" STREQUAL "hg") - SET(UPDATE_COMMAND "${HGCOMMAND}") - SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") - ENDIF("${_update_type}" STREQUAL "hg") - ENDIF("${_update_type}" STREQUAL "bzr") - ENDIF("${_update_type}" STREQUAL "svn") - ENDIF("${_update_type}" STREQUAL "cvs") + ELSEIF("${_update_type}" STREQUAL "svn") + SET(UPDATE_COMMAND "${SVNCOMMAND}") + SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "bzr") + SET(UPDATE_COMMAND "${BZRCOMMAND}") + SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "hg") + SET(UPDATE_COMMAND "${HGCOMMAND}") + SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "git") + SET(UPDATE_COMMAND "${GITCOMMAND}") + SET(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") + ENDIF() SET(DART_TESTING_TIMEOUT 1500 CACHE STRING "Maximum time allowed before CTest will kill the test.") @@ -202,8 +221,17 @@ IF(BUILD_TESTING) ENDIF(DART_CXX_NAME MATCHES "devenv") SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") ENDIF(NOT BUILDNAME) - # set the build command - BUILD_COMMAND(MAKECOMMAND ${MAKEPROGRAM} ) + + # the build command + BUILD_COMMAND(MAKECOMMAND CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") + SET(MAKECOMMAND ${MAKECOMMAND} CACHE STRING "Command to build the project") + + # the default build configuration the ctest build handler will use + # if there is no -C arg given to ctest: + SET(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") + IF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") + SET(DEFAULT_CTEST_CONFIGURATION_TYPE "Release") + ENDIF(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") IF(NOT "${CMAKE_GENERATOR}" MATCHES "Make") SET(CTEST_USE_LAUNCHERS 0) @@ -223,6 +251,7 @@ IF(BUILD_TESTING) SVNCOMMAND BZRCOMMAND HGCOMMAND + GITCOMMAND CVS_UPDATE_OPTIONS SVN_UPDATE_OPTIONS BZR_UPDATE_OPTIONS diff --git a/Modules/CheckTypeSize.c.in b/Modules/CheckTypeSize.c.in new file mode 100644 index 000000000..b6c368801 --- /dev/null +++ b/Modules/CheckTypeSize.c.in @@ -0,0 +1,37 @@ +@headers@ + +#undef KEY +#if defined(__i386) +# define KEY '_','_','i','3','8','6' +#elif defined(__x86_64) +# define KEY '_','_','x','8','6','_','6','4' +#elif defined(__ppc__) +# define KEY '_','_','p','p','c','_','_' +#elif defined(__ppc64__) +# define KEY '_','_','p','p','c','6','4','_','_' +#endif + +#define SIZE (sizeof(@type@)) +char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[', + ('0' + ((SIZE / 10000)%10)), + ('0' + ((SIZE / 1000)%10)), + ('0' + ((SIZE / 100)%10)), + ('0' + ((SIZE / 10)%10)), + ('0' + (SIZE % 10)), + ']', +#ifdef KEY + ' ','k','e','y','[', KEY, ']', +#endif + '\0'}; + +#ifdef __CLASSIC_C__ +int main(argc, argv) int argc; char *argv[]; +#else +int main(int argc, char *argv[]) +#endif +{ + int require = 0; + require += info_size[argc]; + (void)argv; + return require; +} diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 3701467dc..6f4b43760 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -1,16 +1,29 @@ # - Check sizeof a type # CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY]) -# Check if the type exists and determine size of type. if the type -# exists, the size will be stored to the variable. This also -# calls check_include_file for sys/types.h stdint.h -# and stddef.h, setting HAVE_SYS_TYPES_H, HAVE_STDINT_H, -# and HAVE_STDDEF_H. This is because many types are stored -# in these include files. -# VARIABLE - variable to store size if the type exists. -# HAVE_${VARIABLE} - does the variable exists or not -# BUILTIN_TYPES_ONLY - The third argument is optional and if -# it is set to the string BUILTIN_TYPES_ONLY -# this macro will not check for any header files. +# Check if the type exists and determine its size. +# On return, "HAVE_${VARIABLE}" holds the existence of the type, +# and "${VARIABLE}" holds one of the following: +# = type has non-zero size +# "0" = type has arch-dependent size (see below) +# "" = type does not exist +# Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor +# code to define the macro "${VARIABLE}" to the size of the type, or +# leave the macro undefined if the type does not exist. +# +# The variable "${VARIABLE}" may be "0" when CMAKE_OSX_ARCHITECTURES +# has multiple architectures for building OS X universal binaries. +# This indicates that the type size varies across architectures. +# In this case "${VARIABLE}_CODE" contains C preprocessor tests +# mapping from each architecture macro to the corresponding type size. +# The list of architecture macros is stored in "${VARIABLE}_KEYS", and +# the value for each key is stored in "${VARIABLE}-${KEY}". +# +# If the BUILTIN_TYPES_ONLY option is not given, the macro checks for +# headers , , and , and saves results +# in HAVE_SYS_TYPES_H, HAVE_STDINT_H, and HAVE_STDDEF_H. The type +# size check automatically includes the available headers, thus +# supporting checks of types defined in the headers. +# # The following variables may be set before calling this macro to # modify the way the check is run: # @@ -18,9 +31,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link - -# These variables are referenced in CheckTypeSizeC.c so we have -# to check for them. +# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -37,81 +48,144 @@ include(CheckIncludeFile) -MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) - IF(NOT "${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY") +cmake_policy(PUSH) +cmake_minimum_required(VERSION 2.6 FATAL_ERROR) + +get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +#----------------------------------------------------------------------------- +# Helper function. DO NOT CALL DIRECTLY. +function(__check_type_size_impl type var map builtin) + message(STATUS "Check size of ${type}") + + # Include header files. + set(headers) + if(builtin) + if(HAVE_SYS_TYPES_H) + set(headers "${headers}#include \n") + endif() + if(HAVE_STDINT_H) + set(headers "${headers}#include \n") + endif() + if(HAVE_STDDEF_H) + set(headers "${headers}#include \n") + endif() + endif() + foreach(h ${CMAKE_EXTRA_INCLUDE_FILES}) + set(headers "${headers}#include \"${h}\"\n") + endforeach() + + # Perform the check. + set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c) + set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin) + configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY) + try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src} + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS + "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}" + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}" + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" + OUTPUT_VARIABLE output + COPY_FILE ${bin} + ) + + if(HAVE_${var}) + # The check compiled. Load information from the binary. + file(STRINGS ${bin} strings LIMIT_COUNT 10 REGEX "INFO:size") + + # Parse the information strings. + set(regex_size ".*INFO:size\\[0*([^]]*)\\].*") + set(regex_key " key\\[([^]]*)\\]") + set(keys) + set(code) + set(mismatch) + set(first 1) + foreach(info ${strings}) + if("${info}" MATCHES "${regex_size}") + # Get the type size. + string(REGEX REPLACE "${regex_size}" "\\1" size "${info}") + if(first) + set(${var} ${size}) + elseif(NOT "${size}" STREQUAL "${${var}}") + set(mismatch 1) + endif() + set(first 0) + + # Get the architecture map key. + string(REGEX MATCH "${regex_key}" key "${info}") + string(REGEX REPLACE "${regex_key}" "\\1" key "${key}") + if(key) + set(code "${code}\nset(${var}-${key} \"${size}\")") + list(APPEND keys ${key}) + endif() + endif() + endforeach() + + # Update the architecture-to-size map. + if(mismatch AND keys) + configure_file(${__check_type_size_dir}/CheckTypeSizeMap.cmake.in ${map} @ONLY) + set(${var} 0) + else() + file(REMOVE ${map}) + endif() + + if(mismatch AND NOT keys) + message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") + endif() + + message(STATUS "Check size of ${type} - done") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining size of ${type} passed with the following output:\n${output}\n\n") + set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") + else(HAVE_${var}) + # The check failed to compile. + message(STATUS "Check size of ${type} - failed") + file(READ ${src} content) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") + set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZE: ${type} unknown") + file(REMOVE ${map}) + endif(HAVE_${var}) +endfunction() + +#----------------------------------------------------------------------------- +macro(CHECK_TYPE_SIZE TYPE VARIABLE) + # Optionally check for standard headers. + if("${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY") + set(_builtin 0) + else() + set(_builtin 1) check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(stdint.h HAVE_STDINT_H) check_include_file(stddef.h HAVE_STDDEF_H) - ENDIF(NOT "${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY") - - IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") - MESSAGE(STATUS "Check size of ${TYPE}") - SET(CHECK_TYPE_SIZE_TYPE "${TYPE}") - SET(MACRO_CHECK_TYPE_SIZE_FLAGS - "${CMAKE_REQUIRED_FLAGS}") - FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H) - IF("${def}") - SET(MACRO_CHECK_TYPE_SIZE_FLAGS - "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") - ENDIF("${def}") - ENDFOREACH(def) - SET(CHECK_TYPE_SIZE_PREINCLUDE) - SET(CHECK_TYPE_SIZE_PREMAIN) - SET(CHECK_TYPE_SIZE_ADD_LIBRARIES) - SET(CHECK_TYPE_SIZE_ADD_INCLUDES) - - FOREACH(def ${CMAKE_EXTRA_INCLUDE_FILES}) - SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n") - ENDFOREACH(def) - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_TYPE_SIZE_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CHECK_TYPE_SIZE_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ENDIF(CMAKE_REQUIRED_INCLUDES) - - CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CheckTypeSizeC.c.in" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSizeC.c" IMMEDIATE @ONLY) - FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSizeC.c" - CHECK_TYPE_SIZE_FILE_CONTENT) - TRY_COMPILE(HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSizeC.c" - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} - "${CHECK_TYPE_SIZE_ADD_LIBRARIES}" - "${CHECK_TYPE_SIZE_ADD_INCLUDES}" - OUTPUT_VARIABLE OUTPUT - COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" ) - - IF(HAVE_${VARIABLE}) - FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize.bin" - CMAKE_CHECKTYPESIZE_STRINGS LIMIT_COUNT 2 REGEX "INFO:sizeof") - - SET(CMAKE_CHECKTYPESIZE_FIRST_RESULT "FIRST_LOOP") - FOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS}) - IF("${info}" MATCHES ".*INFO:sizeof\\[0*([^]]*)\\].*") - STRING(REGEX REPLACE ".*INFO:sizeof\\[0*([^]]*)\\].*" "\\1" ${VARIABLE} "${info}") - ENDIF("${info}" MATCHES ".*INFO:sizeof\\[0*([^]]*)\\].*") - IF("${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "FIRST_LOOP") - SET(CMAKE_CHECKTYPESIZE_FIRST_RESULT "${${VARIABLE}}") - ENDIF("${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "FIRST_LOOP") - IF(NOT "${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "${${VARIABLE}}") - MESSAGE(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") - ENDIF(NOT "${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "${${VARIABLE}}") - - ENDFOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS}) - MESSAGE(STATUS "Check size of ${TYPE} - done") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n") - ELSE(HAVE_${VARIABLE}) - MESSAGE(STATUS "Check size of ${TYPE} - failed") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSizeC.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n") - SET(${VARIABLE}) - ENDIF(HAVE_${VARIABLE}) - SET(${VARIABLE} "${${VARIABLE}}" CACHE INTERNAL "Result of CHECK_TYPE_SIZE" FORCE) - ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") -ENDMACRO(CHECK_TYPE_SIZE) + endif() + + # Compute or load the size or size map. + set(${VARIABLE}_KEYS) + set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${VARIABLE}.cmake) + if(NOT DEFINED HAVE_${VARIABLE}) + __check_type_size_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin}) + endif() + include(${_map_file} OPTIONAL) + set(_map_file) + set(_builtin) + + # Create preprocessor code. + if(${VARIABLE}_KEYS) + set(${VARIABLE}_CODE) + set(_if if) + foreach(key ${${VARIABLE}_KEYS}) + set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n") + set(_if elif) + endforeach() + set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#else\n# error ${VARIABLE} unknown\n#endif") + set(_if) + elseif(${VARIABLE}) + set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}") + else() + set(${VARIABLE}_CODE "/* #undef ${VARIABLE} */") + endif() +endmacro() + +#----------------------------------------------------------------------------- +cmake_policy(POP) diff --git a/Modules/CheckTypeSizeC.c.in b/Modules/CheckTypeSizeC.c.in deleted file mode 100644 index 8bcf1a0cc..000000000 --- a/Modules/CheckTypeSizeC.c.in +++ /dev/null @@ -1,48 +0,0 @@ -#cmakedefine CHECK_TYPE_SIZE_TYPE @CHECK_TYPE_SIZE_TYPE@ -#ifdef CHECK_TYPE_SIZE_TYPE - -@CHECK_TYPE_SIZE_PREINCLUDE@ -#ifdef HAVE_SYS_TYPES_H -# include -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef HAVE_STDINT_H -# include -#endif /* HAVE_STDINT_H */ - -#ifdef HAVE_STDDEF_H -# include -#endif /* HAVE_STDDEF_H */ - -@CHECK_TYPE_SIZE_PREMAIN@ - -#ifdef __CLASSIC_C__ -# define const -#endif - -#define SIZE (sizeof(@CHECK_TYPE_SIZE_TYPE@)) -const char info_sizeof[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','o','f','[', - ('0' + ((SIZE / 10000)%10)), - ('0' + ((SIZE / 1000)%10)), - ('0' + ((SIZE / 100)%10)), - ('0' + ((SIZE / 10)%10)), - ('0' + (SIZE % 10)), - ']','\0'}; - -#ifdef __CLASSIC_C__ -int main(argc, argv) int argc; char *argv[]; -#else -int main(int argc, char *argv[]) -#endif -{ - int require = 0; - require += info_sizeof[argc]; - (void)argv; - return require; -} - -#else /* CHECK_TYPE_SIZE_TYPE */ - -# error "CHECK_TYPE_SIZE_TYPE has to specify the type" - -#endif /* CHECK_TYPE_SIZE_TYPE */ diff --git a/Modules/CheckTypeSizeMap.cmake.in b/Modules/CheckTypeSizeMap.cmake.in new file mode 100644 index 000000000..1e73cfff1 --- /dev/null +++ b/Modules/CheckTypeSizeMap.cmake.in @@ -0,0 +1 @@ +set(@var@_KEYS "@keys@")@code@ diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index abf384ab8..9a5137a4b 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -1 +1,2 @@ -SET(CMAKE_C_VERBOSE_FLAG "-v") +include(Compiler/GNU) +__compiler_gnu(C) diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake index f3c6b5f82..879ab8f80 100644 --- a/Modules/Compiler/GNU-CXX.cmake +++ b/Modules/Compiler/GNU-CXX.cmake @@ -1 +1,2 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +include(Compiler/GNU) +__compiler_gnu(CXX) diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index 7f7c1289a..6e0f5f3d5 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -1 +1,14 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +include(Compiler/GNU) +__compiler_gnu(Fortran) + +# No -DNDEBUG for Fortran. +SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") +SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") + +# We require updates to CMake C++ code to support preprocessing rules +# for Fortran. +SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) + +# Fortran-specific feature flags. +SET(CMAKE_Fortran_MODDIR_FLAG -J) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake new file mode 100644 index 000000000..63652b655 --- /dev/null +++ b/Modules/Compiler/GNU.cmake @@ -0,0 +1,38 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_GNU) + return() +endif() +set(__COMPILER_GNU 1) + +macro(__compiler_gnu lang) + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-v") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + if(NOT APPLE) + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") + endif(NOT APPLE) +endmacro() diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake index abf384ab8..da88c0116 100644 --- a/Modules/Compiler/PGI-C.cmake +++ b/Modules/Compiler/PGI-C.cmake @@ -1 +1,4 @@ -SET(CMAKE_C_VERBOSE_FLAG "-v") +include(Compiler/PGI) +__compiler_pgi(C) +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG") diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake index f3c6b5f82..97c9555b1 100644 --- a/Modules/Compiler/PGI-CXX.cmake +++ b/Modules/Compiler/PGI-CXX.cmake @@ -1 +1,4 @@ -SET(CMAKE_CXX_VERBOSE_FLAG "-v") +include(Compiler/PGI) +__compiler_pgi(CXX) +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG") diff --git a/Modules/Compiler/PGI-Fortran.cmake b/Modules/Compiler/PGI-Fortran.cmake index 7f7c1289a..1d2631552 100644 --- a/Modules/Compiler/PGI-Fortran.cmake +++ b/Modules/Compiler/PGI-Fortran.cmake @@ -1 +1,12 @@ -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") +include(Compiler/PGI) +__compiler_pgi(Fortran) + +SET(CMAKE_Fortran_FLAGS_INIT "${CMAKE_Fortran_FLAGS_INIT} -Mpreprocess -Kieee") +SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "${CMAKE_Fortran_FLAGS_DEBUG_INIT} -Mbounds") + +# We require updates to CMake C++ code to support preprocessing rules +# for Fortran. +SET(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE) +SET(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE) + +SET(CMAKE_Fortran_MODDIR_FLAG "-module ") diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake new file mode 100644 index 000000000..c6960fcac --- /dev/null +++ b/Modules/Compiler/PGI.cmake @@ -0,0 +1,35 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_PGI) + return() +endif() +set(__COMPILER_PGI 1) + +macro(__compiler_pgi lang) + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-v") + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -O0") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O2 -s") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-fast -O3 -Mipa=fast") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt") + + # Preprocessing and assembly rules. + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") +endmacro() diff --git a/Modules/Compiler/PathScale-C.cmake b/Modules/Compiler/PathScale-C.cmake new file mode 100644 index 000000000..9db54afa0 --- /dev/null +++ b/Modules/Compiler/PathScale-C.cmake @@ -0,0 +1,4 @@ +include(Compiler/PathScale) +__compiler_pathscale(C) +set(CMAKE_C_FLAGS_MINSIZEREL_INIT "${CMAKE_C_FLAGS_MINSIZEREL_INIT} -DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE_INIT "${CMAKE_C_FLAGS_RELEASE_INIT} -DNDEBUG") diff --git a/Modules/Compiler/PathScale-CXX.cmake b/Modules/Compiler/PathScale-CXX.cmake new file mode 100644 index 000000000..4dd766048 --- /dev/null +++ b/Modules/Compiler/PathScale-CXX.cmake @@ -0,0 +1,4 @@ +include(Compiler/PathScale) +__compiler_pathscale(CXX) +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT} -DNDEBUG") diff --git a/Modules/Compiler/PathScale-Fortran.cmake b/Modules/Compiler/PathScale-Fortran.cmake new file mode 100644 index 000000000..20c9d7efb --- /dev/null +++ b/Modules/Compiler/PathScale-Fortran.cmake @@ -0,0 +1,4 @@ +include(Compiler/PathScale) +__compiler_pathscale(Fortran) + +SET(CMAKE_Fortran_MODDIR_FLAG "-module ") diff --git a/Modules/Compiler/PathScale.cmake b/Modules/Compiler/PathScale.cmake new file mode 100644 index 000000000..a53112b86 --- /dev/null +++ b/Modules/Compiler/PathScale.cmake @@ -0,0 +1,31 @@ + +#============================================================================= +# Copyright 2002-2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_PATHSCALE) + return() +endif() +set(__COMPILER_PATHSCALE 1) + +macro(__compiler_pathscale lang) + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-v") + + # Initial configuration flags. + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -O0") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g -O2") +endmacro() diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 4e7e50b5f..4ac918ed1 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -1,6 +1,5 @@ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index c3f079d41..fe549d637 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -1,6 +1,5 @@ SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h") diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 0933bf71d..ae38f86f7 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -1,6 +1,5 @@ SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") -SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-h") diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 2eea45cd0..be2b691ee 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -15,6 +15,8 @@ BuildName: @BUILDNAME@ # Submission information IsCDash: @CTEST_DROP_SITE_CDASH@ +CDashVersion: @CTEST_CDASH_VERSION@ +QueryCDashVersion: @CTEST_CDASH_QUERY_VERSION@ DropSite: @DROP_SITE@ DropLocation: @DROP_LOCATION@ DropSiteUser: @DROP_SITE_USER@ @@ -30,6 +32,7 @@ NightlyStartTime: @NIGHTLY_START_TIME@ # Commands for the build/test/submit cycle ConfigureCommand: "@CMAKE_COMMAND@" "@PROJECT_SOURCE_DIR@" MakeCommand: @MAKECOMMAND@ +DefaultCTestConfigurationType: @DEFAULT_CTEST_CONFIGURATION_TYPE@ # CVS options # Default is "-d -P -A" diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 84c732263..0302d5c4b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -17,6 +17,7 @@ # [SVN_REPOSITORY url] # URL of Subversion repo # [SVN_REVISION rev] # Revision to checkout from Subversion repo # [URL /.../src.tgz] # Full path or URL of source +# [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command # [PATCH_COMMAND cmd...] # Command to patch downloaded source @@ -203,19 +204,24 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED function(_ep_write_downloadfile_script script_filename remote local timeout) - if(NOT timeout) - set(timeout 30) + if(timeout) + set(timeout_args TIMEOUT ${timeout}) + set(timeout_msg "${timeout} seconds") + else() + set(timeout_args "# no TIMEOUT") + set(timeout_msg "none") endif() file(WRITE ${script_filename} "message(STATUS \"downloading... src='${remote}' - dst='${local}'\") + dst='${local}' + timeout='${timeout_msg}'\") file(DOWNLOAD \"${remote}\" \"${local}\" - TIMEOUT ${timeout} + ${timeout_args} STATUS status LOG log) @@ -694,7 +700,8 @@ function(_ep_add_download_command name) message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() set(file ${download_dir}/${fname}) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "") + get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download and extract) for '${name}'") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 428be9e1c..ea9eb2525 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -63,7 +63,7 @@ # Currently this module searches for the following version numbers: # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, -# 1.40, 1.40.0 +# 1.40, 1.40.0, 1.41, 1.41.0 # # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should # add both 1.x and 1.x.0 as shown above. Official Boost include directories @@ -264,6 +264,17 @@ FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) ENDFUNCTION() +# +# A convenience function for marking desired components +# as found or not +# +function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE) + endforeach() +endfunction() + # # End functions/macros # @@ -286,7 +297,7 @@ else(Boost_FIND_VERSION_EXACT) # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" + "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33") set(_boost_TEST_VERSIONS) @@ -760,6 +771,10 @@ ELSE (_boost_IN_CACHE) endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) + if (NOT Boost_FOUND) + _Boost_MARK_COMPONENTS_FOUND(OFF) + endif() + if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) # If the user requested an exact version of Boost, check # that. We already know that the Boost version we have is >= the @@ -773,10 +788,12 @@ ELSE (_boost_IN_CACHE) # We'll set Boost_FOUND true again if we have an exact version match. set(Boost_FOUND FALSE) + _Boost_MARK_COMPONENTS_FOUND(OFF) if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) set( Boost_FOUND TRUE ) + _Boost_MARK_COMPONENTS_FOUND(ON) endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) @@ -796,19 +813,18 @@ ELSE (_boost_IN_CACHE) set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") endif (NOT Boost_FOUND) - if (Boost_FOUND) - set(_boost_CHECKED_COMPONENT FALSE) - set(_Boost_MISSING_COMPONENTS) - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} COMPONENT) - set(_boost_CHECKED_COMPONENT TRUE) - if(NOT Boost_${COMPONENT}_FOUND) - string(TOLOWER ${COMPONENT} COMPONENT) - list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) - set( Boost_FOUND FALSE) - endif(NOT Boost_${COMPONENT}_FOUND) - endforeach(COMPONENT) - endif (Boost_FOUND) + # Always check for missing components + set(_boost_CHECKED_COMPONENT FALSE) + set(_Boost_MISSING_COMPONENTS "") + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) + set(_boost_CHECKED_COMPONENT TRUE) + if(NOT Boost_${COMPONENT}_FOUND) + string(TOLOWER ${COMPONENT} COMPONENT) + list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) + set( Boost_FOUND FALSE) + endif(NOT Boost_${COMPONENT}_FOUND) + endforeach(COMPONENT) if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") @@ -876,9 +892,9 @@ ELSE (_boost_IN_CACHE) IF (Boost_FOUND) IF (NOT Boost_FIND_QUIETLY) MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - ENDIF(NOT Boost_FIND_QUIETLY) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE(STATUS "Found the following Boost libraries:") + if(Boost_FIND_COMPONENTS) + message(STATUS "Found the following Boost libraries:") + endif() ENDIF(NOT Boost_FIND_QUIETLY) FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} ) STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT ) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 7c28498d6..6539057ba 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -106,9 +106,12 @@ # specified. All of the non CUDA C files are compiled using the standard # build rules specified by CMAKE and the cuda files are compiled to object # files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is -# added automatically to include_directories(). Standard CMake target calls -# can be used on the target after calling this macro -# (e.g. set_target_properties and target_link_libraries). +# added automatically to include_directories(). Some standard CMake target +# calls can be used on the target after calling this macro +# (e.g. set_target_properties and target_link_libraries), but setting +# properties that adjust compilation flags will not affect code compiled by +# nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE, +# CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS. # # CUDA_ADD_LIBRARY( cuda_target file0 file1 ... # [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] ) @@ -476,7 +479,7 @@ mark_as_advanced(CUDA_NVCC_EXECUTABLE) if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION) # Compute the version. - exec_program(${CUDA_NVCC_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE NVCC_OUT) + execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT) string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT}) string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT}) set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.") @@ -543,6 +546,14 @@ endmacro() # CUDA_LIBRARIES find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library") set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) +if(APPLE) + # We need to add the path to cudart to the linker using rpath, since the + # library name for the cuda libraries is prepended with @rpath. + get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH) + if(_cuda_path_to_cudart) + list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}") + endif() +endif() # 1.1 toolkit on linux doesn't appear to have a separate library on # some platforms. @@ -813,7 +824,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if(CUDA_HOST_COMPILATION_CPP) set(CUDA_C_OR_CXX CXX) else(CUDA_HOST_COMPILATION_CPP) - set(nvcc_flags ${nvcc_flags} --host-compilation C) + if(CUDA_VERSION VERSION_LESS "3.0") + set(nvcc_flags ${nvcc_flags} --host-compilation C) + else() + message(WARNING "--host-compilation flag is deprecated in CUDA version >= 3.0. Removing --host-compilation C flag" ) + endif() set(CUDA_C_OR_CXX C) endif(CUDA_HOST_COMPILATION_CPP) diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake old mode 100755 new mode 100644 diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake old mode 100755 new mode 100644 index 4a9a7d4d6..7349da322 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -150,18 +150,39 @@ cuda_execute_process( COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}" ) +# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag +# for dependency generation and hope for the best. +set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}") +set(CUDA_VERSION @CUDA_VERSION@) +if(CUDA_VERSION VERSION_LESS "3.0") + cmake_policy(PUSH) + # CMake policy 0007 NEW states that empty list elements are not + # ignored. I'm just setting it to avoid the warning that's printed. + cmake_policy(SET CMP0007 NEW) + # Note that this will remove all occurances of -G. + list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G") + cmake_policy(POP) +endif() + +# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This +# can cause incorrect dependencies when #including files based on this macro which is +# defined in the generating passes of nvcc invokation. We will go ahead and manually +# define this for now until a future version fixes this bug. +set(CUDACC_DEFINE -D__CUDACC__) + # Generate the dependency file cuda_execute_process( "Generating dependency file: ${NVCC_generated_dependency_file}" COMMAND "${CUDA_NVCC_EXECUTABLE}" + -M + ${CUDACC_DEFINE} "${source_file}" - ${CUDA_NVCC_FLAGS} - ${nvcc_flags} + -o "${NVCC_generated_dependency_file}" ${CCBIN} + ${nvcc_flags} ${nvcc_host_compiler_flags} + ${depends_CUDA_NVCC_FLAGS} -DNVCC - -M - -o "${NVCC_generated_dependency_file}" ${CUDA_NVCC_INCLUDE_ARGS} ) @@ -209,12 +230,12 @@ cuda_execute_process( "Generating ${generated_file}" COMMAND "${CUDA_NVCC_EXECUTABLE}" "${source_file}" - ${CUDA_NVCC_FLAGS} - ${nvcc_flags} + ${format_flag} -o "${generated_file}" ${CCBIN} + ${nvcc_flags} ${nvcc_host_compiler_flags} + ${CUDA_NVCC_FLAGS} -DNVCC - ${format_flag} -o "${generated_file}" ${CUDA_NVCC_INCLUDE_ARGS} ) diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index 3d8ae3a63..f301b2409 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -23,7 +23,13 @@ FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h) MARK_AS_ADVANCED(CURL_INCLUDE_DIR) # Look for the library. -FIND_LIBRARY(CURL_LIBRARY NAMES curl) +FIND_LIBRARY(CURL_LIBRARY NAMES + curl + # Windows MSVC prebuilts: + curllib + libcurl_imp + curllib_static +) MARK_AS_ADVANCED(CURL_LIBRARY) # handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if @@ -34,7 +40,4 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARY CURL_INCLUDE_DIR IF(CURL_FOUND) SET(CURL_LIBRARIES ${CURL_LIBRARY}) SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) -ELSE(CURL_FOUND) - SET(CURL_LIBRARIES) - SET(CURL_INCLUDE_DIRS) ENDIF(CURL_FOUND) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 335826bc4..2c3fce5b9 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,4 +1,4 @@ -# - find DCMTK libraries +# - find DCMTK libraries and applications # # DCMTK_INCLUDE_DIR - Directories to include to use DCMTK @@ -9,10 +9,11 @@ # DCMTK_DIR can be used to make it simpler to find the various include # directories and compiled libraries if you've just compiled it in the # source tree. Just set it to the root of the tree where you extracted -# the source. +# the source (default to /usr/include/dcmtk/) #============================================================================= # Copyright 2004-2009 Kitware, Inc. +# Copyright 2009 Mathieu Malaterre # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -26,14 +27,26 @@ # # Written for VXL by Amitha Perera. +# Upgraded for GDCM by Mathieu Malaterre. # +IF( NOT DCMTK_FOUND ) + SET( DCMTK_DIR "/usr/include/dcmtk/" + CACHE PATH "Root of DCMTK source tree (optional)." ) + MARK_AS_ADVANCED( DCMTK_DIR ) +ENDIF( NOT DCMTK_FOUND ) + + FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h - ${DCMTK_DIR}/config/include ${DCMTK_DIR}/include + ${DCMTK_DIR}/config/include + ${DCMTK_DIR}/config + ${DCMTK_DIR}/include ) FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h - ${DCMTK_DIR}/ofstd/include ${DCMTK_DIR}/include/ofstd + ${DCMTK_DIR}/ofstd/include + ${DCMTK_DIR}/ofstd + ${DCMTK_DIR}/include/ofstd ) FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd @@ -47,8 +60,9 @@ FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h - ${DCMTK_DIR}/dcmdata/include ${DCMTK_DIR}/include/dcmdata + ${DCMTK_DIR}/dcmdata + ${DCMTK_DIR}/dcmdata/include ) FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata @@ -63,6 +77,7 @@ FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h ${DCMTK_DIR}/dcmimgle/include + ${DCMTK_DIR}/dcmimgle ${DCMTK_DIR}/include/dcmimgle ) @@ -75,17 +90,18 @@ FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle ${DCMTK_DIR}/lib ) +# MM: I could not find this library on debian system / dcmtk 3.5.4 FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb -${DCMTK_DIR}/imagectn/libsrc/Release -${DCMTK_DIR}/imagectn/libsrc/ -${DCMTK_DIR}/imagectn/libsrc/Debug -) + ${DCMTK_DIR}/imagectn/libsrc/Release + ${DCMTK_DIR}/imagectn/libsrc/ + ${DCMTK_DIR}/imagectn/libsrc/Debug + ) FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet -${DCMTK_DIR}/dcmnet/libsrc/Release -${DCMTK_DIR}/dcmnet/libsrc/Debug -${DCMTK_DIR}/dcmnet/libsrc/ -) + ${DCMTK_DIR}/dcmnet/libsrc/Release + ${DCMTK_DIR}/dcmnet/libsrc/Debug + ${DCMTK_DIR}/dcmnet/libsrc/ + ) IF( DCMTK_config_INCLUDE_DIR @@ -137,7 +153,30 @@ ENDIF( DCMTK_config_INCLUDE_DIR AND DCMTK_dcmimgle_INCLUDE_DIR AND DCMTK_dcmimgle_LIBRARY ) -IF( NOT DCMTK_FOUND ) - SET( DCMTK_DIR "" CACHE PATH "Root of DCMTK source tree (optional)." ) - MARK_AS_ADVANCED( DCMTK_DIR ) -ENDIF( NOT DCMTK_FOUND ) +FIND_PROGRAM(DCMTK_DCMDUMP_EXECUTABLE dcmdump + ${DCMTK_DIR}/bin + ) + +FIND_PROGRAM(DCMTK_DCMDJPEG_EXECUTABLE dcmdjpeg + ${DCMTK_DIR}/bin + ) + +FIND_PROGRAM(DCMTK_DCMDRLE_EXECUTABLE dcmdrle + ${DCMTK_DIR}/bin + ) + +MARK_AS_ADVANCED( + DCMTK_DCMDUMP_EXECUTABLE + DCMTK_DCMDJPEG_EXECUTABLE + DCMTK_DCMDRLE_EXECUTABLE + DCMTK_config_INCLUDE_DIR + DCMTK_dcmdata_INCLUDE_DIR + DCMTK_dcmdata_LIBRARY + DCMTK_dcmimgle_INCLUDE_DIR + DCMTK_dcmimgle_LIBRARY + DCMTK_imagedb_LIBRARY + DCMTK_dcmnet_LIBRARY + DCMTK_ofstd_INCLUDE_DIR + DCMTK_ofstd_LIBRARY + ) + diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 39beae9bb..c8714178d 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -64,6 +64,9 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) +# Version 0.8 (1/4/2010) +# * Get module working under MacOSX fink by adding /sw/include, /sw/lib +# to PATHS and the gobject library # Version 0.7 (3/22/09) # * Checked into CMake CVS # * Added versioning support @@ -167,6 +170,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) /opt/gnome/lib /opt/openwin/include /usr/openwin/lib + /sw/include + /sw/lib $ENV{GTKMM_BASEPATH}/include $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include @@ -277,6 +282,7 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) /opt/gnome/lib64 /usr/openwin/lib /usr/openwin/lib64 + /sw/lib $ENV{GTKMM_BASEPATH}/lib [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib @@ -386,10 +392,12 @@ endif() foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h) _GTK2_FIND_LIBRARY (GTK2_GLIB_LIBRARY glib false true) + + _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT_INCLUDE_DIR gobject/gobject.h) + _GTK2_FIND_LIBRARY (GTK2_GOBJECT_LIBRARY gobject false true) _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 4960b389c..1bcd46956 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -15,16 +15,17 @@ # # Accepts the following variables as input: # -# GTEST_ROOT - (as CMake or env. variable) +# GTEST_ROOT - (as a CMake or environment variable) # The root directory of the gtest install prefix # -# GTEST_MSVC_SEARCH - If on MSVC, enables searching the build tree of -# GTest if set to MD or MT (defaults: MD) +# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to +# "MD" or "MT" to enable searching a GTest build tree +# (defaults: "MD") # #----------------------- # Example Usage: # -# enable_testing(true) +# enable_testing() # find_package(GTest REQUIRED) # include_directories(${GTEST_INCLUDE_DIRS}) # @@ -36,8 +37,10 @@ #----------------------- # # If you would like each Google test to show up in CTest as -# a test you may use the following macro. NOTE: It WILL slow -# down your tests, so be warned. +# a test you may use the following macro. +# NOTE: It will slow down your tests by running an executable +# for each test and test fixture. You will also have to rerun +# CMake after adding or removing tests or test fixtures. # # GTEST_ADD_TESTS(executable extra_args ARGN) # executable = The path to the test executable @@ -76,7 +79,7 @@ function(GTEST_ADD_TESTS executable extra_args) file(READ "${source}" contents) string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) - string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit}) + string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) endforeach() endforeach() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index d2092eff5..a84e6779d 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -28,7 +28,8 @@ # with the HDF5 distribution that may be useful for regression testing. # # This module will define the following variables: -# HDF5_INCLUDE_DIR - Location of the hdf5 includes +# HDF5_INCLUDE_DIRS - Location of the hdf5 includes +# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated) # HDF5_DEFINITIONS - Required compiler definitions for HDF5 # HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings. # HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings @@ -106,7 +107,7 @@ endmacro() # Parse a compile line for definitions, includes, library paths, and libraries. macro( _HDF5_parse_compile_line - compile_line + compile_line_var include_paths definitions library_paths @@ -114,7 +115,7 @@ macro( _HDF5_parse_compile_line # Match the include paths string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags - "${compile_line}" + "${${compile_line_var}}" ) foreach( IPATH ${include_path_flags} ) string( REGEX REPLACE "^-I" "" IPATH ${IPATH} ) @@ -123,14 +124,14 @@ macro( _HDF5_parse_compile_line endforeach() # Match the definitions - string( REGEX MATCHALL "-D[^ ]*" definition_flags "${compile_line}" ) + string( REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}" ) foreach( DEF ${definition_flags} ) list( APPEND ${definitions} ${DEF} ) endforeach() # Match the library paths string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags - "${compile_line}" + "${${compile_line_var}}" ) foreach( LPATH ${library_path_flags} ) @@ -143,7 +144,7 @@ macro( _HDF5_parse_compile_line # match only -l's preceded by a space or comma # this is to exclude directory names like xxx-linux/ string( REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags - "${compile_line}" ) + "${${compile_line_var}}" ) # strip the -l from all of the library flags and add to the search list foreach( LIB ${library_name_flags} ) string( REGEX REPLACE "^[, ]-l" "" LIB ${LIB} ) @@ -151,7 +152,7 @@ macro( _HDF5_parse_compile_line endforeach() endmacro() -if( HDF5_INCLUDE_DIR AND HDF5_LIBRARIES ) +if( HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES ) # Do nothing: we already have HDF5_INCLUDE_PATH and HDF5_LIBRARIES in the # cache, it would be a shame to override them else() @@ -179,7 +180,7 @@ else() foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} ) if( HDF5_${LANGUAGE}_COMPILE_LINE ) - _HDF5_parse_compile_line( ${HDF5_${LANGUAGE}_COMPILE_LINE} + _HDF5_parse_compile_line( HDF5_${LANGUAGE}_COMPILE_LINE HDF5_${LANGUAGE}_INCLUDE_FLAGS HDF5_${LANGUAGE}_DEFINITIONS HDF5_${LANGUAGE}_LIBRARY_DIRS @@ -209,7 +210,7 @@ else() Include ) mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR ) - list( APPEND HDF5_INCLUDE_DIR ${HDF5_${LANGUAGE}_INCLUDE_DIR} ) + list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} ) set( HDF5_${LANGUAGE}_LIBRARY_NAMES ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT} @@ -266,8 +267,8 @@ else() # We may have picked up some duplicates in various lists during the above # process for the language bindings (both the C and C++ bindings depend on # libz for example). Remove the duplicates. - if( HDF5_INCLUDE_DIR ) - list( REMOVE_DUPLICATES HDF5_INCLUDE_DIR ) + if( HDF5_INCLUDE_DIRS ) + list( REMOVE_DUPLICATES HDF5_INCLUDE_DIRS ) endif() if( HDF5_LIBRARIES_DEBUG ) list( REMOVE_DUPLICATES HDF5_LIBRARIES_DEBUG ) @@ -292,16 +293,16 @@ else() # If the HDF5 include directory was found, open H5pubconf.h to determine if # HDF5 was compiled with parallel IO support set( HDF5_IS_PARALLEL FALSE ) - if( HDF5_INCLUDE_DIR ) - if( EXISTS "${HDF5_INCLUDE_DIR}/h5pubconf.h" ) - file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" + foreach( _dir HDF5_INCLUDE_DIRS ) + if( EXISTS "${_dir}/H5pubconf.h" ) + file( STRINGS "${_dir}/H5pubconf.h" HDF5_HAVE_PARALLEL_DEFINE REGEX "HAVE_PARALLEL 1" ) if( HDF5_HAVE_PARALLEL_DEFINE ) set( HDF5_IS_PARALLEL TRUE ) endif() endif() - endif() + endforeach() set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL "HDF5 library compiled with parallel IO support" ) mark_as_advanced( HDF5_IS_PARALLEL ) @@ -310,14 +311,18 @@ endif() find_package_handle_standard_args( HDF5 DEFAULT_MSG HDF5_LIBRARIES - HDF5_INCLUDE_DIR + HDF5_INCLUDE_DIRS ) mark_as_advanced( - HDF5_INCLUDE_DIR + HDF5_INCLUDE_DIRS HDF5_LIBRARIES HDF5_DEFINTIONS HDF5_LIBRARY_DIRS HDF5_C_COMPILER_EXECUTABLE HDF5_CXX_COMPILER_EXECUTABLE ) +# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of +# HDF5_INCLUDE_DIRS +set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) + diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 47f96e0ed..a61c683b6 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -5,6 +5,7 @@ # # JNI_INCLUDE_DIRS = the include dirs to use # JNI_LIBRARIES = the libraries to use +# JNI_FOUND = TRUE if JNI headers and libraries were found. # JAVA_AWT_LIBRARY = the path to the jawt library # JAVA_JVM_LIBRARY = the path to the jvm library # JAVA_INCLUDE_PATH = the include path to jni.h @@ -206,6 +207,10 @@ FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h ${JAVA_INCLUDE_PATH} ) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY + JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) + MARK_AS_ADVANCED( JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 4fddfeef3..7eb6d900c 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -3,13 +3,34 @@ # include files and libraries are. This code sets the following # variables: # -# JAVA_RUNTIME = the full path to the Java runtime -# JAVA_COMPILE = the full path to the Java compiler -# JAVA_ARCHIVE = the full path to the Java archiver +# Java_JAVA_EXECUTABLE = the full path to the Java runtime +# Java_JAVAC_EXECUTABLE = the full path to the Java compiler +# Java_JAR_EXECUTABLE = the full path to the Java archiver +# Java_VERSION_STRING = Version of the package found (java version), eg. 1.6.0_12 +# Java_VERSION_MAJOR = The major version of the package found. +# Java_VERSION_MINOR = The minor version of the package found. +# Java_VERSION_PATCH = The patch version of the package found. +# Java_VERSION_TWEAK = The tweak version of the package found (after '_') +# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak) # +# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be +# identical. For example some java version may return: +# Java_VERSION_STRING = 1.5.0_17 +# and +# Java_VERSION = 1.5.0.17 +# +# another example is the Java OEM, with: +# Java_VERSION_STRING = 1.6.0-oem +# and +# Java_VERSION = 1.6.0 +# +# NOTE: At the moment this script will look for javac and jar component, +# which means it will fail if javac or jar is not found.:w +# See Bug #9840 #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2009 Mathieu Malaterre # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -21,20 +42,23 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -SET(JAVA_BIN_PATH - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin" +# The HINTS option should only be used for values computed from the system. +SET(_JAVA_HINTS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin" $ENV{JAVA_HOME}/bin - /usr/bin + ) +# Hard-coded guesses should still go in PATHS. This ensures that the user +# environment can always override hard guesses. +SET(_JAVA_PATHS /usr/lib/java/bin /usr/share/java/bin - /usr/local/bin /usr/local/java/bin /usr/local/java/share/bin /usr/java/j2sdk1.4.2_04 @@ -43,23 +67,102 @@ SET(JAVA_BIN_PATH /usr/lib/j2sdk1.5-sun/bin /opt/sun-jdk-1.5.0.04/bin ) -FIND_PROGRAM(JAVA_RUNTIME +FIND_PROGRAM(Java_JAVA_EXECUTABLE NAMES java - PATHS ${JAVA_BIN_PATH} + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} ) -FIND_PROGRAM(JAVA_ARCHIVE +IF(Java_JAVA_EXECUTABLE) + set(_java_version_acceptable TRUE) + EXECUTE_PROCESS(COMMAND ${Java_JAVA_EXECUTABLE} -version + RESULT_VARIABLE res + OUTPUT_VARIABLE var + ERROR_VARIABLE var # sun-java output to stderr + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE) + IF( res ) + MESSAGE( FATAL_ERROR "Error executing java -version" ) + ELSE() + # extract major/minor version and patch level from "java -version" output + # Tested on linux using + # 1. Sun / Sun OEM + # 2. OpenJDK 1.6 + # 3. GCJ 1.5 + # 4. Kaffe 1.4.2 + IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_]+[oem-]*\".*") + # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer + STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_]+)[oem-]*\".*" + "\\1" Java_VERSION_STRING "${var}" ) + ELSEIF(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + # Kaffe style + STRING( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" + "\\1" Java_VERSION_STRING "${var}" ) + ELSE() + IF(NOT Java_FIND_QUIETLY) + message(WARNING "regex not supported: ${var}. Please report") + set(_java_version_acceptable FALSE) + ENDIF(NOT Java_FIND_QUIETLY) + ENDIF() + STRING( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) + STRING( REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_MINOR "${Java_VERSION_STRING}" ) + STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Java_VERSION_PATCH "${Java_VERSION_STRING}" ) + # warning tweak version can be empty: + STRING( REGEX REPLACE "[0-9]+\\.[0-9]+\\.[0-9]+\\_?([0-9]*)$" "\\1" Java_VERSION_TWEAK "${Java_VERSION_STRING}" ) + if( Java_VERSION_TWEAK STREQUAL "" ) # check case where tweak is not defined + set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}) + else( ) + set(Java_VERSION ${Java_VERSION_MAJOR}.${Java_VERSION_MINOR}.${Java_VERSION_PATCH}.${Java_VERSION_TWEAK}) + endif( ) + # display info + #MESSAGE( STATUS "Java version ${Java_VERSION_STRING} configured successfully!" ) # keep me, used for debug + IF(NOT Java_FIND_QUIETLY) + MESSAGE( STATUS "Java version ${Java_VERSION} configured successfully!" ) + ENDIF(NOT Java_FIND_QUIETLY) + ENDIF() + + # check version if requested: + if( Java_FIND_VERSION ) + if("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}") + set(_java_version_acceptable FALSE) + endif("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}") + if( Java_FIND_VERSION_EXACT ) + if("${Java_VERSION}" VERSION_GREATER "${Java_FIND_VERSION}") + set(_java_version_acceptable FALSE) + endif("${Java_VERSION}" VERSION_GREATER "${Java_FIND_VERSION}") + endif( Java_FIND_VERSION_EXACT ) + endif( Java_FIND_VERSION ) +ENDIF(Java_JAVA_EXECUTABLE) + + +FIND_PROGRAM(Java_JAR_EXECUTABLE NAMES jar - PATHS ${JAVA_BIN_PATH} + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} ) -FIND_PROGRAM(JAVA_COMPILE +FIND_PROGRAM(Java_JAVAC_EXECUTABLE NAMES javac - PATHS ${JAVA_BIN_PATH} + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} ) -MARK_AS_ADVANCED( -JAVA_RUNTIME -JAVA_ARCHIVE -JAVA_COMPILE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Java DEFAULT_MSG + Java_JAVA_EXECUTABLE + Java_JAR_EXECUTABLE + Java_JAVAC_EXECUTABLE + _java_version_acceptable ) + +MARK_AS_ADVANCED( + Java_JAVA_EXECUTABLE + Java_JAR_EXECUTABLE + Java_JAVAC_EXECUTABLE + ) + +# LEGACY +SET(JAVA_RUNTIME ${Java_JAVA_EXECUTABLE}) +SET(JAVA_ARCHIVE ${Java_JAR_EXECUTABLE}) +SET(JAVA_COMPILE ${Java_JAVAC_EXECUTABLE}) + diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index fc4c23d3a..9139aad79 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -1,4 +1,4 @@ -# - Try to find LibXml2 +# - Try to find the LibXml2 xml processing library # Once done this will define # # LIBXML2_FOUND - System has LibXml2 @@ -21,20 +21,13 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) - # in cache already - SET(LibXml2_FIND_QUIETLY TRUE) -ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) +SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) -IF (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) - SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) -ENDIF (NOT WIN32) - -FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h +FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h HINTS ${PC_LIBXML_INCLUDEDIR} ${PC_LIBXML_INCLUDE_DIRS} diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 5c3953a5b..d16d1ffef 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -1,4 +1,4 @@ -# - Try to find LibXslt +# - Try to find the LibXslt library # Once done this will define # # LIBXSLT_FOUND - system has LibXslt @@ -20,26 +20,23 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) - # in cache already - SET(LibXslt_FIND_QUIETLY TRUE) -ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) - -IF (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - INCLUDE(UsePkgConfig) - PKGCONFIG(libxslt _LibXsltIncDir _LibXsltLinkDir _LibXsltLinkFlags _LibXsltCflags) - SET(LIBXSLT_DEFINITIONS ${_LibXsltCflags}) -ENDIF (NOT WIN32) - -FIND_PATH(LIBXSLT_INCLUDE_DIR libxslt/xslt.h - ${_LibXsltIncDir} +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_LIBXSLT libxslt) +SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER}) + + +FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h + HINTS + ${PC_LIBXSLT_INCLUDEDIR} + ${PC_LIBXSLT_INCLUDE_DIRS} ) FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt - PATHS - ${_LibXsltLinkDir} + HINTS + ${PC_LIBXSLT_LIBDIR} + ${PC_LIBXSLT_LIBRARY_DIRS} ) INCLUDE(FindPackageHandleStandardArgs) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index e945ec5de..481b0e994 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -72,7 +72,7 @@ # Microsoft HPC SDK is automatically added to the system path # Argonne National Labs MPICH2 sets a registry key that we can use. -set(MPI_PACKAGE_DIR +set(_MPI_PACKAGE_DIR mpi mpich openmpi @@ -83,15 +83,16 @@ set(MPI_PACKAGE_DIR "Microsoft Compute Cluster Pack" ) -set(MPI_PREFIX_PATH) +set(_MPI_PREFIX_PATH) if(WIN32) - list(APPEND MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..") + list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..") + list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]") endif() foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH}) - foreach(MpiPackageDir ${MPI_PREFIX_PATH}) + foreach(MpiPackageDir ${_MPI_PREFIX_PATH}) if(EXISTS ${SystemPrefixDir}/${MpiPackageDir}) - list(APPEND MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}") + list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}") endif() endforeach(MpiPackageDir) endforeach(SystemPrefixDir) @@ -99,21 +100,21 @@ endforeach(SystemPrefixDir) # Most mpi distros have some form of mpiexec which gives us something we can reliably look for. find_program(MPIEXEC NAMES mpiexec mpirun lamexec - PATHS ${MPI_PREFIX_PATH} + PATHS ${_MPI_PREFIX_PATH} PATH_SUFFIXES bin DOC "Executable for running MPI programs." ) # call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). # This gives us a fairly reliable base directory to search for /bin /lib and /include from. -get_filename_component(MPI_BASE_DIR "${MPIEXEC}" PATH) -get_filename_component(MPI_BASE_DIR "${MPI_BASE_DIR}" PATH) +get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH) +get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) # If there is an mpi compiler find it and interogate (farther below) it for the include -# and lib dirs otherwise we will continue to search from ${MPI_BASE_DIR}. +# and lib dirs otherwise we will continue to search from ${_MPI_BASE_DIR}. find_program(MPI_COMPILER NAMES mpic++ mpicxx mpiCC mpicc - HINTS "${MPI_BASE_DIR}" + HINTS "${_MPI_BASE_DIR}" PATH_SUFFIXES bin DOC "MPI compiler. Used only to detect MPI compilation flags.") mark_as_advanced(MPI_COMPILER) @@ -222,7 +223,7 @@ elseif (MPI_COMPILE_CMDLINE) # If all else fails, just search for mpi.h in the normal include # paths. find_path(MPI_INCLUDE_PATH mpi.h - HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH} + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} PATH_SUFFIXES include ) set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH}) @@ -304,7 +305,7 @@ elseif (MPI_COMPILE_CMDLINE) else (MPI_COMPILE_CMDLINE) # No MPI compiler to interogate so attempt to find everything with find functions. find_path(MPI_INCLUDE_PATH mpi.h - HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH} + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} PATH_SUFFIXES include ) @@ -317,13 +318,13 @@ else (MPI_COMPILE_CMDLINE) find_library(MPI_LIBRARY NAMES mpi mpich msmpi - HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH} + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR} ) find_library(MPI_EXTRA_LIBRARY NAMES mpi++ - HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH} + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} PATH_SUFFIXES lib DOC "Extra MPI libraries to link against.") @@ -358,6 +359,6 @@ mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY MPI_EXTRA_LIBRARY) # unset to cleanup namespace -unset(MPI_PACKAGE_DIR) -unset(MPI_PREFIX_PATH) -unset(MPI_BASE_DIR) +unset(_MPI_PACKAGE_DIR) +unset(_MPI_PREFIX_PATH) +unset(_MPI_BASE_DIR) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 95b23e1d2..b05602091 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -20,79 +20,86 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF(OPENSSL_LIBRARIES) - SET(OpenSSL_FIND_QUIETLY TRUE) -ENDIF(OPENSSL_LIBRARIES) - -IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - SET(LIB_FOUND 1) -ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - # http://www.slproweb.com/products/Win32OpenSSL.html FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/include" ) -IF(WIN32 AND MSVC) - # /MD and /MDd are the standard values - if somone wants to use - # others, the libnames have to change here too - # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b - - FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" - ) - FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" - ) - FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" - ) - FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32 - PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" - ) +IF(WIN32 AND NOT CYGWIN) + # MINGW should go here too + IF(MSVC) + # /MD and /MDd are the standard values - if someone wants to use + # others, the libnames have to change here too + # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b + # TODO: handle /MT and static lib + # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix: + # * MD for dynamic-release + # * MDd for dynamic-debug + # * MT for static-release + # * MTd for static-debug - IF(MSVC_IDE) - IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}) - ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - SET(OPENSSL_LIBRARIES NOTFOUND) - MESSAGE(STATUS "Could not find the debug and release version of openssl") - ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - ELSE(MSVC_IDE) - STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) - IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}) - ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE}) - ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - ENDIF(MSVC_IDE) - MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE) - MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) -ELSE(WIN32 AND MSVC) + # Implementation details: + # We are using the libraries located in the VC subdir instead of the parent directory eventhough : + # libeay32MD.lib is identical to ../libeay32.lib, and + # ssleay32MD.lib is identical to ../ssleay32.lib + FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssleay32 ssl + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssleay32 ssl + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + set( OPENSSL_LIBRARIES + optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} + debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG} + ) + else() + set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} ) + endif() + MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE) + MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) + ELSEIF(MINGW) + # same player, for MingW + FIND_LIBRARY(LIB_EAY NAMES libeay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/MinGW" + ) + FIND_LIBRARY(SSL_EAY NAMES ssleay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/MinGW" + ) + MARK_AS_ADVANCED(SSL_EAY LIB_EAY) + set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + ELSE(MSVC) + # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: + FIND_LIBRARY(LIB_EAY NAMES libeay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib" + ) + FIND_LIBRARY(SSL_EAY NAMES ssleay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib" + ) + MARK_AS_ADVANCED(SSL_EAY LIB_EAY) + set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) + ENDIF(MSVC) +ELSE(WIN32 AND NOT CYGWIN) - FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD) - FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto) - MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES) + FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD) + FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto) + MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES) - SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES}) + SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES}) -ENDIF(WIN32 AND MSVC) +ENDIF(WIN32 AND NOT CYGWIN) -IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - SET(OPENSSL_FOUND TRUE) -ELSE(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - SET(OPENSSL_FOUND FALSE) -ENDIF (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES) - -IF (OPENSSL_FOUND) - IF (NOT OpenSSL_FIND_QUIETLY) - MESSAGE(STATUS "Found OpenSSL: ${OPENSSL_LIBRARIES}") - ENDIF (NOT OpenSSL_FIND_QUIETLY) -ELSE (OPENSSL_FOUND) - IF (OpenSSL_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find OpenSSL") - ENDIF (OpenSSL_FIND_REQUIRED) -ENDIF (OPENSSL_FOUND) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenSSL DEFAULT_MSG + OPENSSL_LIBRARIES + OPENSSL_INCLUDE_DIR +) MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake old mode 100755 new mode 100644 diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 81d117981..5c99e3fb4 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -44,6 +44,14 @@ FOREACH(_CURRENT_VERSION 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) # Avoid finding the .dll in the PATH. We want the .lib. NO_SYSTEM_ENVIRONMENT_PATH ) + # Look for the static library in the Python config directory + FIND_LIBRARY(PYTHON_LIBRARY + NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION} + # Avoid finding the .dll in the PATH. We want the .lib. + NO_SYSTEM_ENVIRONMENT_PATH + # This is where the static library is usually located + PATH_SUFFIXES python${_CURRENT_VERSION}/config + ) # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if # PYTHON_INCLUDE_DIR is not set. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 411e3906d..76d7950c0 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -34,6 +34,7 @@ # QT_USE_QTDESIGNER # QT_USE_QTMOTIF # QT_USE_QTMAIN +# QT_USE_QTMULTIMEDIA # QT_USE_QTNETWORK # QT_USE_QTNSPLUGIN # QT_USE_QTOPENGL @@ -50,6 +51,19 @@ # QT_USE_QTXMLPATTERNS # QT_USE_PHONON # QT_USE_QTSCRIPTTOOLS +# QT_USE_QTDECLARATIVE +# +# QT_USE_IMPORTED_TARGETS +# If this variable is set to TRUE, FindQt4.cmake will create imported +# library targets for the various Qt libraries and set the +# library variables like QT_QTCORE_LIBRARY to point at these imported +# targets instead of the library file on disk. This provides much better +# handling of the release and debug versions of the Qt libraries and is +# also always backwards compatible, except for the case that dependencies +# of libraries are exported, these will then also list the names of the +# imported targets as dependency and not the file location on disk. This +# is much more flexible, but requires that FindQt4.cmake is executed before +# such an exported dependency file is processed. # # There are also some files that need processing by some Qt tools such as moc # and uic. Listed below are macros that may be used to process those files. @@ -151,27 +165,29 @@ # QT_QTGUI_FOUND True if QtGui was found. # QT_QT3SUPPORT_FOUND True if Qt3Support was found. # QT_QTASSISTANT_FOUND True if QtAssistant was found. -# QT_QAXCONTAINER_FOUND True if QAxContainer was found (Windows only). -# QT_QAXSERVER_FOUND True if QAxServer was found (Windows only). +# QT_QTASSISTANTCLIENT_FOUND True if QtAssistantClient was found. +# QT_QAXCONTAINER_FOUND True if QAxContainer was found (Windows only). +# QT_QAXSERVER_FOUND True if QAxServer was found (Windows only). # QT_QTDBUS_FOUND True if QtDBus was found. # QT_QTDESIGNER_FOUND True if QtDesigner was found. # QT_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found. +# QT_QTHELP_FOUND True if QtHelp was found. # QT_QTMOTIF_FOUND True if QtMotif was found. +# QT_QTMULTIMEDIA_FOUND True if QtMultimedia was found (since Qt 4.6.0). # QT_QTNETWORK_FOUND True if QtNetwork was found. # QT_QTNSPLUGIN_FOUND True if QtNsPlugin was found. # QT_QTOPENGL_FOUND True if QtOpenGL was found. # QT_QTSQL_FOUND True if QtSql was found. -# QT_QTXML_FOUND True if QtXml was found. # QT_QTSVG_FOUND True if QtSvg was found. # QT_QTSCRIPT_FOUND True if QtScript was found. +# QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found. # QT_QTTEST_FOUND True if QtTest was found. # QT_QTUITOOLS_FOUND True if QtUiTools was found. -# QT_QTASSISTANTCLIENT_FOUND True if QtAssistantClient was found. -# QT_QTHELP_FOUND True if QtHelp was found. # QT_QTWEBKIT_FOUND True if QtWebKit was found. +# QT_QTXML_FOUND True if QtXml was found. # QT_QTXMLPATTERNS_FOUND True if QtXmlPatterns was found. # QT_PHONON_FOUND True if phonon was found. -# QT_QTSCRIPTTOOLS_FOUND True if QtScriptTools was found. +# QT_QTDECLARATIVE_FOUND True if QtDeclarative was found. # # QT_MAC_USE_COCOA For Mac OS X, its whether Cocoa or Carbon is used. # In general, this should not be used, but its useful @@ -198,15 +214,16 @@ # QT_QT3SUPPORT_INCLUDE_DIR Path to "include/Qt3Support" # QT_QTASSISTANT_INCLUDE_DIR Path to "include/QtAssistant" # QT_QTASSISTANTCLIENT_INCLUDE_DIR Path to "include/QtAssistant" -# QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) -# QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) +# QT_QAXCONTAINER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) +# QT_QAXSERVER_INCLUDE_DIR Path to "include/ActiveQt" (Windows only) # QT_QTCORE_INCLUDE_DIR Path to "include/QtCore" +# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" # QT_QTDESIGNER_INCLUDE_DIR Path to "include/QtDesigner" # QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR Path to "include/QtDesigner" -# QT_QTDBUS_INCLUDE_DIR Path to "include/QtDBus" # QT_QTGUI_INCLUDE_DIR Path to "include/QtGui" # QT_QTHELP_INCLUDE_DIR Path to "include/QtHelp" # QT_QTMOTIF_INCLUDE_DIR Path to "include/QtMotif" +# QT_QTMULTIMEDIA_INCLUDE_DIR Path to "include/QtMultimedia" # QT_QTNETWORK_INCLUDE_DIR Path to "include/QtNetwork" # QT_QTNSPLUGIN_INCLUDE_DIR Path to "include/QtNsPlugin" # QT_QTOPENGL_INCLUDE_DIR Path to "include/QtOpenGL" @@ -219,14 +236,15 @@ # QT_QTXMLPATTERNS_INCLUDE_DIR Path to "include/QtXmlPatterns" # QT_PHONON_INCLUDE_DIR Path to "include/phonon" # QT_QTSCRIPTTOOLS_INCLUDE_DIR Path to "include/QtScriptTools" -# +# QT_QTDECLARATIVE_INCLUDE_DIR Path to "include/QtDeclarative" +# # QT_BINARY_DIR Path to "bin" of Qt4 # QT_LIBRARY_DIR Path to "lib" of Qt4 # QT_PLUGINS_DIR Path to "plugins" for Qt4 # QT_TRANSLATIONS_DIR Path to "translations" of Qt4 # QT_DOC_DIR Path to "doc" of Qt4 # QT_MKSPECS_DIR Path to "mkspecs" of Qt4 -# +# # # The Qt toolkit may contain both debug and release libraries. # In that case, the following library variables will contain both. @@ -245,6 +263,7 @@ # QT_QTGUI_LIBRARY The QtGui library # QT_QTHELP_LIBRARY The QtHelp library # QT_QTMOTIF_LIBRARY The QtMotif library +# QT_QTMULTIMEDIA_LIBRARY The QtMultimedia library # QT_QTNETWORK_LIBRARY The QtNetwork library # QT_QTNSPLUGIN_LIBRARY The QtNsPLugin library # QT_QTOPENGL_LIBRARY The QtOpenGL library @@ -260,6 +279,8 @@ # QT_PHONON_LIBRARY The phonon library # QT_QTSCRIPTTOOLS_LIBRARY The QtScriptTools library # +# The QtDeclarative library: QT_QTDECLARATIVE_LIBRARY +# # also defined, but NOT for general use are # QT_MOC_EXECUTABLE Where to find the moc tool. # QT_UIC_EXECUTABLE Where to find the uic tool. @@ -270,6 +291,8 @@ # QT_LUPDATE_EXECUTABLE Where to find the lupdate tool. # QT_LRELEASE_EXECUTABLE Where to find the lrelease tool. # QT_QCOLLECTIONGENERATOR_EXECUTABLE Where to find the qcollectiongenerator tool. +# QT_DESIGNER_EXECUTABLE Where to find the Qt designer tool. +# QT_LINGUIST_EXECUTABLE Where to find the Qt linguist tool. # # # These are around for backwards compatibility @@ -367,7 +390,9 @@ ENDMACRO(QT_QUERY_QMAKE) GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) # check for qmake -FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 PATHS +# Debian uses qmake-qt4 +# macports' Qt uses qmake-mac +FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin" @@ -569,6 +594,47 @@ IF (QT4_QMAKE_FOUND) QT_PLUGINS_DIR QT_TRANSLATIONS_DIR) + ############################################# + # + # Find out what window system we're using + # + ############################################# + # Save required variable + SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) + # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES + SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_HEADERS_DIR}") + # On Mac OS X when Qt has framework support, also add the framework path + IF( QT_USE_FRAMEWORKS ) + SET(CMAKE_REQUIRED_FLAGS "-F${QT_LIBRARY_DIR} ") + ENDIF( QT_USE_FRAMEWORKS ) + # Check for Window system symbols (note: only one should end up being set) + CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) + CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) + CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS) + CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC) + IF(Q_WS_MAC) + IF(QT_QMAKE_CHANGED) + UNSET(QT_MAC_USE_COCOA CACHE) + ENDIF(QT_QMAKE_CHANGED) + CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA) + ENDIF(Q_WS_MAC) + + IF (QT_QTCOPY_REQUIRED) + CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY) + IF (NOT QT_IS_QTCOPY) + MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found") + ENDIF (NOT QT_IS_QTCOPY) + ENDIF (QT_QTCOPY_REQUIRED) + + # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) + # + ############################################# + + + ######################################## # # Setting the INCLUDE-Variables @@ -576,8 +642,13 @@ IF (QT4_QMAKE_FOUND) ######################################## SET(QT_MODULES QtCore QtGui Qt3Support QtSvg QtScript QtTest QtUiTools - QtHelp QtWebKit QtXmlPatterns phonon QtMotif QtNetwork - QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools) + QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia + QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools + QtDeclarative) + + IF(Q_WS_X11) + SET(QT_MODULES ${QT_MODULES} QtMotif) + ENDIF(Q_WS_X11) IF(QT_QMAKE_CHANGED) FOREACH(QT_MODULE ${QT_MODULES}) @@ -617,6 +688,16 @@ IF (QT4_QMAKE_FOUND) ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers NO_DEFAULT_PATH ) + # phonon doesn't seem consistent, let's try phonondefs.h for some + # installations + IF(${QT_MODULE} STREQUAL "phonon") + FIND_PATH(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h + PATHS + ${QT_HEADERS_DIR}/${QT_MODULE} + ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers + NO_DEFAULT_PATH + ) + ENDIF(${QT_MODULE} STREQUAL "phonon") ENDFOREACH(QT_MODULE) IF(WIN32) @@ -681,44 +762,6 @@ IF (QT4_QMAKE_FOUND) SET( QT_INCLUDES ${QT_MKSPECS_DIR}/default ${QT_INCLUDE_DIR} ) - ############################################# - # - # Find out what window system we're using - # - ############################################# - # Save required variable - SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES - SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") - # On Mac OS X when Qt has framework support, also add the framework path - IF( QT_USE_FRAMEWORKS ) - SET(CMAKE_REQUIRED_FLAGS "-F${QT_LIBRARY_DIR} ") - ENDIF( QT_USE_FRAMEWORKS ) - # Check for Window system symbols (note: only one should end up being set) - CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) - CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) - CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS) - CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC) - IF(Q_WS_MAC) - IF(QT_QMAKE_CHANGED) - UNSET(QT_MAC_USE_COCOA CACHE) - ENDIF(QT_QMAKE_CHANGED) - CHECK_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA) - ENDIF(Q_WS_MAC) - - IF (QT_QTCOPY_REQUIRED) - CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY) - IF (NOT QT_IS_QTCOPY) - MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found") - ENDIF (NOT QT_IS_QTCOPY) - ENDIF (QT_QTCOPY_REQUIRED) - - # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) - # - ############################################# @@ -811,41 +854,85 @@ IF (QT4_QMAKE_FOUND) # ############################################ - MACRO (_QT4_ADJUST_LIB_VARS basename) + # On OSX when Qt is found as framework, never use the imported targets for now, since + # in this case the handling of the framework directory currently does not work correctly. + IF(QT_USE_FRAMEWORKS) + SET(QT_USE_IMPORTED_TARGETS FALSE) + ENDIF(QT_USE_FRAMEWORKS) + + + MACRO (_QT4_ADJUST_LIB_VARS _camelCaseBasename) + + STRING(TOUPPER "${_camelCaseBasename}" basename) + + # The name of the imported targets, i.e. the prefix "Qt4::" must not change, + # since it is stored in EXPORT-files as name of a required library. If the name would change + # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore. IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) - # if only the release version was found, set the debug variable also to the release version - IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) - SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) - SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) - ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) - - # if only the debug version was found, set the release variable also to the debug version - IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) - SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) - SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) - - IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) - ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) - ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) - - SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) - - IF (QT_${basename}_LIBRARY) - SET(QT_${basename}_FOUND 1) - ENDIF (QT_${basename}_LIBRARY) + IF(NOT TARGET Qt4::${_camelCaseBasename}) + ADD_LIBRARY(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED ) + + IF (QT_${basename}_LIBRARY_RELEASE) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) + ENDIF (QT_${basename}_LIBRARY_RELEASE) + + IF (QT_${basename}_LIBRARY_DEBUG) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + SET_PROPERTY(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) + ENDIF (QT_${basename}_LIBRARY_DEBUG) + ENDIF(NOT TARGET Qt4::${_camelCaseBasename}) + + # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these + # imported targets. This works better in general, and is also in almost all cases fully + # backward compatible. The only issue is when a project A which had this enabled then exports its + # libraries via export or EXPORT_LIBRARY_DEPENDENCIES(). In this case the libraries from project + # A will depend on the imported Qt targets, and the names of these imported targets will be stored + # in the dependency files on disk. This means when a project B then uses project A, these imported + # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a + # library file on disk, and not as a target, and linking will fail: + IF(QT_USE_IMPORTED_TARGETS) + SET(QT_${basename}_LIBRARY Qt4::${_camelCaseBasename} ) + SET(QT_${basename}_LIBRARIES Qt4::${_camelCaseBasename} ) + ELSE(QT_USE_IMPORTED_TARGETS) + + # if the release- as well as the debug-version of the library have been found: + IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) + ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + + # if only the release version was found, set the debug variable also to the release version + IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE}) + SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE}) + ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + + # if only the debug version was found, set the release variable also to the debug version + IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) + SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG}) + ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + + # put the value in the cache: + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE) + + ENDIF(QT_USE_IMPORTED_TARGETS) + +# message(STATUS "QT_${basename}_LIBRARY: ${QT_${basename}_LIBRARY}") + + SET(QT_${basename}_FOUND 1) ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) @@ -861,41 +948,51 @@ IF (QT4_QMAKE_FOUND) # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES - _QT4_ADJUST_LIB_VARS(QTCORE) - _QT4_ADJUST_LIB_VARS(QTGUI) - _QT4_ADJUST_LIB_VARS(QT3SUPPORT) - _QT4_ADJUST_LIB_VARS(QTASSISTANT) - _QT4_ADJUST_LIB_VARS(QTDESIGNER) - _QT4_ADJUST_LIB_VARS(QTDESIGNERCOMPONENTS) - _QT4_ADJUST_LIB_VARS(QTNETWORK) - _QT4_ADJUST_LIB_VARS(QTNSPLUGIN) - _QT4_ADJUST_LIB_VARS(QTOPENGL) - _QT4_ADJUST_LIB_VARS(QTSQL) - _QT4_ADJUST_LIB_VARS(QTXML) - _QT4_ADJUST_LIB_VARS(QTSVG) - _QT4_ADJUST_LIB_VARS(QTSCRIPT) - _QT4_ADJUST_LIB_VARS(QTUITOOLS) - _QT4_ADJUST_LIB_VARS(QTTEST) - _QT4_ADJUST_LIB_VARS(QTDBUS) - _QT4_ADJUST_LIB_VARS(QTASSISTANTCLIENT) - _QT4_ADJUST_LIB_VARS(QTHELP) - _QT4_ADJUST_LIB_VARS(QTWEBKIT) - _QT4_ADJUST_LIB_VARS(QTXMLPATTERNS) - _QT4_ADJUST_LIB_VARS(PHONON) - _QT4_ADJUST_LIB_VARS(QTCLUCENE) - _QT4_ADJUST_LIB_VARS(QTSCRIPTTOOLS) - + _QT4_ADJUST_LIB_VARS(QtCore) + _QT4_ADJUST_LIB_VARS(QtGui) + _QT4_ADJUST_LIB_VARS(Qt3Support) + _QT4_ADJUST_LIB_VARS(QtAssistant) + _QT4_ADJUST_LIB_VARS(QtAssistantClient) + _QT4_ADJUST_LIB_VARS(QtCLucene) + _QT4_ADJUST_LIB_VARS(QtDBus) + _QT4_ADJUST_LIB_VARS(QtDeclarative) + _QT4_ADJUST_LIB_VARS(QtDesigner) + _QT4_ADJUST_LIB_VARS(QtDesignerComponents) + _QT4_ADJUST_LIB_VARS(QtHelp) + _QT4_ADJUST_LIB_VARS(QtMultimedia) + _QT4_ADJUST_LIB_VARS(QtNetwork) + _QT4_ADJUST_LIB_VARS(QtNsPlugin) + _QT4_ADJUST_LIB_VARS(QtOpenGL) + _QT4_ADJUST_LIB_VARS(QtScript) + _QT4_ADJUST_LIB_VARS(QtScriptTools) + _QT4_ADJUST_LIB_VARS(QtSql) + _QT4_ADJUST_LIB_VARS(QtSvg) + _QT4_ADJUST_LIB_VARS(QtTest) + _QT4_ADJUST_LIB_VARS(QtUiTools) + _QT4_ADJUST_LIB_VARS(QtWebKit) + _QT4_ADJUST_LIB_VARS(QtXml) + _QT4_ADJUST_LIB_VARS(QtXmlPatterns) + _QT4_ADJUST_LIB_VARS(phonon) # platform dependent libraries IF(Q_WS_X11) - _QT4_ADJUST_LIB_VARS(QTMOTIF) + _QT4_ADJUST_LIB_VARS(QtMotif) ENDIF(Q_WS_X11) IF(WIN32) - _QT4_ADJUST_LIB_VARS(QTMAIN) - _QT4_ADJUST_LIB_VARS(QAXSERVER) - _QT4_ADJUST_LIB_VARS(QAXCONTAINER) + _QT4_ADJUST_LIB_VARS(qtmain) + _QT4_ADJUST_LIB_VARS(QAxServer) + _QT4_ADJUST_LIB_VARS(QAxContainer) ENDIF(WIN32) - + + # If Qt is installed as a framework, we need to add QT_QTCORE_LIBRARY here (which + # is the framework directory in that case), since this will make the cmake include_directories() + # command recognize that we need the framework flag with the respective directory (-F) + IF(QT_USE_FRAMEWORKS) + SET(QT_INCLUDES ${QT_INCLUDES} ${QT_QTCORE_LIBRARY} ) + SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR} ${QT_QTCORE_LIBRARY} ) + ENDIF(QT_USE_FRAMEWORKS) + + ####################################### # @@ -915,6 +1012,8 @@ IF (QT4_QMAKE_FOUND) SET(QT_LUPDATE_EXECUTABLE NOTFOUND) SET(QT_LRELEASE_EXECUTABLE NOTFOUND) SET(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND) + SET(QT_DESIGNER_EXECUTABLE NOTFOUND) + SET(QT_LINGUIST_EXECUTABLE NOTFOUND) ENDIF(QT_QMAKE_CHANGED) FIND_PROGRAM(QT_MOC_EXECUTABLE @@ -971,6 +1070,18 @@ IF (QT4_QMAKE_FOUND) NO_DEFAULT_PATH ) + FIND_PROGRAM(QT_DESIGNER_EXECUTABLE + NAMES designer-qt4 designer + PATHS ${QT_BINARY_DIR} + NO_DEFAULT_PATH + ) + + FIND_PROGRAM(QT_LINGUIST_EXECUTABLE + NAMES linguist-qt4 linguist + PATHS ${QT_BINARY_DIR} + NO_DEFAULT_PATH + ) + IF (QT_MOC_EXECUTABLE) SET(QT_WRAP_CPP "YES") ENDIF (QT_MOC_EXECUTABLE) @@ -983,7 +1094,12 @@ IF (QT4_QMAKE_FOUND) MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE - QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE) + QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE + QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE) + + + # get the directory of the current file, used later on in the file + GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) ###################################### # @@ -991,378 +1107,7 @@ IF (QT4_QMAKE_FOUND) # ###################################### - MACRO (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options) - SET(${_qt4_files}) - SET(${_qt4_options}) - SET(_QT4_DOING_OPTIONS FALSE) - FOREACH(_currentArg ${ARGN}) - IF ("${_currentArg}" STREQUAL "OPTIONS") - SET(_QT4_DOING_OPTIONS TRUE) - ELSE ("${_currentArg}" STREQUAL "OPTIONS") - IF(_QT4_DOING_OPTIONS) - LIST(APPEND ${_qt4_options} "${_currentArg}") - ELSE(_QT4_DOING_OPTIONS) - LIST(APPEND ${_qt4_files} "${_currentArg}") - ENDIF(_QT4_DOING_OPTIONS) - ENDIF ("${_currentArg}" STREQUAL "OPTIONS") - ENDFOREACH(_currentArg) - ENDMACRO (QT4_EXTRACT_OPTIONS) - - # macro used to create the names of output files preserving relative dirs - MACRO (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile ) - STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) - STRING(LENGTH ${infile} _infileLength) - SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) - IF(_infileLength GREATER _binlength) - STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile) - IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile}) - ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) - ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") - ELSE(_infileLength GREATER _binlength) - FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) - ENDIF(_infileLength GREATER _binlength) - IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path - STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}") - ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:") - SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") - STRING(REPLACE ".." "__" _outfile ${_outfile}) - GET_FILENAME_COMPONENT(outpath ${_outfile} PATH) - GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE) - FILE(MAKE_DIRECTORY ${outpath}) - SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) - ENDMACRO (QT4_MAKE_OUTPUT_FILE ) - - MACRO (QT4_GET_MOC_FLAGS _moc_flags) - SET(${_moc_flags}) - GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) - - FOREACH(_current ${_inc_DIRS}) - IF("${_current}" MATCHES ".framework/?$") - STRING(REGEX REPLACE "/[^/]+.framework" "" framework_path "${_current}") - SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") - ELSE("${_current}" MATCHES ".framework/?$") - SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") - ENDIF("${_current}" MATCHES ".framework/?$") - ENDFOREACH(_current ${_inc_DIRS}) - - GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) - FOREACH(_current ${_defines}) - SET(${_moc_flags} ${${_moc_flags}} "-D${_current}") - ENDFOREACH(_current ${_defines}) - - IF(Q_WS_WIN) - SET(${_moc_flags} ${${_moc_flags}} -DWIN32) - ENDIF(Q_WS_WIN) - - ENDMACRO(QT4_GET_MOC_FLAGS) - - # helper macro to set up a moc rule - MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) - # For Windows, create a parameters file to work around command line length limit - IF (WIN32) - # Pass the parameters in a file. Set the working directory to - # be that containing the parameters file and reference it by - # just the file name. This is necessary because the moc tool on - # MinGW builds does not seem to handle spaces in the path to the - # file given with the @ syntax. - GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME) - GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH) - IF(_moc_outfile_dir) - SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) - ENDIF(_moc_outfile_dir) - SET (_moc_parameters_file ${outfile}_parameters) - SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") - FILE (REMOVE ${_moc_parameters_file}) - FOREACH(arg ${_moc_parameters}) - FILE (APPEND ${_moc_parameters_file} "${arg}\n") - ENDFOREACH(arg) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters - DEPENDS ${infile} - ${_moc_working_dir} - VERBATIM) - ELSE (WIN32) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} - DEPENDS ${infile}) - ENDIF (WIN32) - ENDMACRO (QT4_CREATE_MOC_COMMAND) - - - MACRO (QT4_GENERATE_MOC infile outfile ) - # get include dirs and flags - QT4_GET_MOC_FLAGS(moc_flags) - GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) - QT4_CREATE_MOC_COMMAND(${abs_infile} ${outfile} "${moc_flags}" "") - SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file - ENDMACRO (QT4_GENERATE_MOC) - - - # QT4_WRAP_CPP(outfiles inputfile ... ) - - MACRO (QT4_WRAP_CPP outfiles ) - # get include dirs - QT4_GET_MOC_FLAGS(moc_flags) - QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN}) - - FOREACH (it ${moc_files}) - GET_FILENAME_COMPONENT(it ${it} ABSOLUTE) - QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) - QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}") - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH(it) - - ENDMACRO (QT4_WRAP_CPP) - - - # QT4_WRAP_UI(outfiles inputfile ... ) - - MACRO (QT4_WRAP_UI outfiles ) - QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN}) - - FOREACH (it ${ui_files}) - GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) - GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_UIC_EXECUTABLE} - ARGS ${ui_options} -o ${outfile} ${infile} - MAIN_DEPENDENCY ${infile}) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH (it) - - ENDMACRO (QT4_WRAP_UI) - - - # QT4_ADD_RESOURCES(outfiles inputfile ... ) - - MACRO (QT4_ADD_RESOURCES outfiles ) - QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN}) - - FOREACH (it ${rcc_files}) - GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) - GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) - GET_FILENAME_COMPONENT(rc_path ${infile} PATH) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) - # parse file for dependencies - # all files are absolute paths or relative to the location of the qrc file - FILE(READ "${infile}" _RC_FILE_CONTENTS) - STRING(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") - STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}") - IF(NOT _ABS_PATH_INDICATOR) - SET(_RC_FILE "${rc_path}/${_RC_FILE}") - ENDIF(NOT _ABS_PATH_INDICATOR) - SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") - ENDFOREACH(_RC_FILE) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_RCC_EXECUTABLE} - ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} - MAIN_DEPENDENCY ${infile} - DEPENDS ${_RC_DEPENDS}) - SET(${outfiles} ${${outfiles}} ${outfile}) - ENDFOREACH (it) - - ENDMACRO (QT4_ADD_RESOURCES) - - MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) - GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE) - SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) - - # handling more arguments (as in FindQt4.cmake from KDE4) will come soon, then - # _params will be used for more than just -m - SET(_params -m) - - ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} - COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} - DEPENDS ${_infile}) - - SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) - - QT4_GENERATE_MOC(${_header} ${_moc}) - - SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) - MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) - - ENDMACRO(QT4_ADD_DBUS_INTERFACE) - - - MACRO(QT4_ADD_DBUS_INTERFACES _sources) - FOREACH (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE) - # get the part before the ".xml" suffix - STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE}) - STRING(TOLOWER ${_basename} _basename) - QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface) - ENDFOREACH (_current_FILE) - ENDMACRO(QT4_ADD_DBUS_INTERFACES) - - - MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) - QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN}) - - GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) - - IF (_customName) - SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) - ELSE (_customName) - SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) - ENDIF (_customName) - - ADD_CUSTOM_COMMAND(OUTPUT ${_target} - COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target} - DEPENDS ${_in_file} - ) - ENDMACRO(QT4_GENERATE_DBUS_INTERFACE) - - - MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) - GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE) - - SET(_optionalBasename "${ARGV4}") - IF (_optionalBasename) - SET(_basename ${_optionalBasename} ) - ELSE (_optionalBasename) - STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile}) - STRING(TOLOWER ${_basename} _basename) - ENDIF (_optionalBasename) - - SET(_optionalClassName "${ARGV5}") - SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) - SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) - - IF(_optionalClassName) - ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} - COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} - DEPENDS ${_infile} - ) - ELSE(_optionalClassName) - ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} - COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} - DEPENDS ${_infile} - ) - ENDIF(_optionalClassName) - - QT4_GENERATE_MOC(${_header} ${_moc}) - SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) - MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) - - SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) - ENDMACRO(QT4_ADD_DBUS_ADAPTOR) - - MACRO(QT4_AUTOMOC) - QT4_GET_MOC_FLAGS(_moc_INCS) - - SET(_matching_FILES ) - FOREACH (_current_FILE ${ARGN}) - - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) - # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. - # This is required to make uic work correctly: - # we need to add generated .cpp files to the sources (to compile them), - # but we cannot let automoc handle them, as the .cpp files don't exist yet when - # cmake is run for the very first time on them -> however the .cpp files might - # exist at a later run. at that time we need to skip them, so that we don't add two - # different rules for the same moc file - GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) - - IF ( NOT _skip AND EXISTS ${_abs_FILE} ) - - FILE(READ ${_abs_FILE} _contents) - - GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) - - STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") - IF(_match) - FOREACH (_current_MOC_INC ${_match}) - STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") - - GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) - IF(EXISTS ${_abs_PATH}/${_basename}.hpp) - SET(_header ${_abs_PATH}/${_basename}.hpp) - ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp) - SET(_header ${_abs_PATH}/${_basename}.h) - ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp) - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) - QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") - MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) - ENDFOREACH (_current_MOC_INC) - ENDIF(_match) - ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} ) - ENDFOREACH (_current_FILE) - ENDMACRO(QT4_AUTOMOC) - - MACRO(QT4_CREATE_TRANSLATION _qm_files) - QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN}) - SET(_my_sources) - SET(_my_dirs) - SET(_my_tsfiles) - SET(_ts_pro) - FOREACH (_file ${_lupdate_files}) - GET_FILENAME_COMPONENT(_ext ${_file} EXT) - GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE) - IF(_ext MATCHES "ts") - LIST(APPEND _my_tsfiles ${_abs_FILE}) - ELSE(_ext MATCHES "ts") - IF(NOT _ext) - LIST(APPEND _my_dirs ${_abs_FILE}) - ELSE(NOT _ext) - LIST(APPEND _my_sources ${_abs_FILE}) - ENDIF(NOT _ext) - ENDIF(_ext MATCHES "ts") - ENDFOREACH(_file) - FOREACH(_ts_file ${_my_tsfiles}) - IF(_my_sources) - # make a .pro file to call lupdate on, so we don't make our commands too - # long for some systems - GET_FILENAME_COMPONENT(_ts_name ${_ts_file} NAME_WE) - SET(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) - SET(_pro_srcs) - FOREACH(_pro_src ${_my_sources}) - SET(_pro_srcs "${_pro_srcs} \"${_pro_src}\"") - ENDFOREACH(_pro_src ${_my_sources}) - FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}") - ENDIF(_my_sources) - ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file} - COMMAND ${QT_LUPDATE_EXECUTABLE} - ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} - DEPENDS ${_my_sources} ${_ts_pro}) - ENDFOREACH(_ts_file) - QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) - ENDMACRO(QT4_CREATE_TRANSLATION) - - MACRO(QT4_ADD_TRANSLATION _qm_files) - FOREACH (_current_FILE ${ARGN}) - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(qm ${_abs_FILE} NAME_WE) - GET_SOURCE_FILE_PROPERTY(output_location ${_abs_FILE} OUTPUT_LOCATION) - IF(output_location) - FILE(MAKE_DIRECTORY "${output_location}") - SET(qm "${output_location}/${qm}.qm") - ELSE(output_location) - SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") - ENDIF(output_location) - - ADD_CUSTOM_COMMAND(OUTPUT ${qm} - COMMAND ${QT_LRELEASE_EXECUTABLE} - ARGS ${_abs_FILE} -qm ${qm} - DEPENDS ${_abs_FILE} - ) - SET(${_qm_files} ${${_qm_files}} ${qm}) - ENDFOREACH (_current_FILE) - ENDMACRO(QT4_ADD_TRANSLATION) - - - + INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake") ###################################### @@ -1396,303 +1141,9 @@ IF (QT4_QMAKE_FOUND) # configuration/system dependent settings # ############################################### - - # find dependencies for some Qt modules - # when doing builds against a static Qt, they are required - # when doing builds against a shared Qt, they are sometimes not required - # even some Linux distros do not require these dependencies - # if a user needs the dependencies, and they couldn't be found, they can set - # the variables themselves. - - SET(QT_QTGUI_LIB_DEPENDENCIES "") - SET(QT_QTCORE_LIB_DEPENDENCIES "") - SET(QT_QTNETWORK_LIB_DEPENDENCIES "") - SET(QT_QTOPENGL_LIB_DEPENDENCIES "") - SET(QT_QTDBUS_LIB_DEPENDENCIES "") - SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) - - # build using shared Qt needs -DQT_DLL - IF(NOT QT_CONFIG MATCHES "static") - # warning currently only qconfig.pri on Windows potentially contains "static" - # so QT_DLL might not get defined properly on other platforms. - SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) - ENDIF(NOT QT_CONFIG MATCHES "static") - - # QtOpenGL dependencies - QT_QUERY_QMAKE(QMAKE_LIBS_OPENGL "QMAKE_LIBS_OPENGL") - SET (QT_QTOPENGL_LIB_DEPENDENCIES ${QT_QTOPENGL_LIB_DEPENDENCIES} ${QMAKE_LIBS_OPENGL}) - - ## system png - IF(QT_QCONFIG MATCHES "system-png") - FIND_LIBRARY(QT_PNG_LIBRARY NAMES png) - MARK_AS_ADVANCED(QT_PNG_LIBRARY) - IF(QT_PNG_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) - ENDIF(QT_PNG_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "system-png") - - # for X11, get X11 library directory - IF(Q_WS_X11) - QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11") - ENDIF(Q_WS_X11) - - ## X11 SM - IF(QT_QCONFIG MATCHES "x11sm") - # ask qmake where the x11 libs are - FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) - FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_X11_SM_LIBRARY) - MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY) - IF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) - ENDIF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "x11sm") - - ## Xi - IF(QT_QCONFIG MATCHES "tablet") - FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XI_LIBRARY) - IF(QT_XI_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) - ENDIF(QT_XI_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "tablet") - - ## Xrender - IF(QT_QCONFIG MATCHES "xrender") - FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) - IF(QT_XRENDER_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) - ENDIF(QT_XRENDER_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "xrender") - - ## Xrandr - IF(QT_QCONFIG MATCHES "xrandr") - FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) - IF(QT_XRANDR_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) - ENDIF(QT_XRANDR_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "xrandr") - - ## Xcursor - IF(QT_QCONFIG MATCHES "xcursor") - FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) - IF(QT_XCURSOR_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) - ENDIF(QT_XCURSOR_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "xcursor") - - ## Xinerama - IF(QT_QCONFIG MATCHES "xinerama") - FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) - IF(QT_XINERAMA_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) - ENDIF(QT_XINERAMA_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "xinerama") - - ## Xfixes - IF(QT_QCONFIG MATCHES "xfixes") - FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XFIXES_LIBRARY) - IF(QT_XFIXES_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY}) - ENDIF(QT_XFIXES_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "xfixes") - - ## system-freetype - IF(QT_QCONFIG MATCHES "system-freetype") - FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype) - MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY) - IF(QT_FREETYPE_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) - ENDIF(QT_FREETYPE_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "system-freetype") - - ## fontconfig - IF(QT_QCONFIG MATCHES "fontconfig") - FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) - MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY) - IF(QT_FONTCONFIG_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) - ENDIF(QT_FONTCONFIG_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "fontconfig") - - ## system-zlib - IF(QT_QCONFIG MATCHES "system-zlib") - FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z) - MARK_AS_ADVANCED(QT_ZLIB_LIBRARY) - IF(QT_ZLIB_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) - ENDIF(QT_ZLIB_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "system-zlib") - - ## openssl - IF(NOT Q_WS_WIN) - SET(_QT_NEED_OPENSSL 0) - IF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") - SET(_QT_NEED_OPENSSL 1) - ENDIF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") - IF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") - SET(_QT_NEED_OPENSSL 1) - ENDIF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") - IF(_QT_NEED_OPENSSL) - FIND_PACKAGE(OpenSSL) - IF(OPENSSL_LIBRARIES) - SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_LIBRARIES) - ENDIF(_QT_NEED_OPENSSL) - ENDIF(NOT Q_WS_WIN) - - ## dbus - IF(QT_QCONFIG MATCHES "dbus") - - # if the dbus library isn't found, we'll assume its not required to build - # shared Qt on Linux doesn't require it - IF(NOT QT_DBUS_LIBRARY) - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1 - OUTPUT_VARIABLE _dbus_query_output - RESULT_VARIABLE _dbus_result - ERROR_VARIABLE _dbus_query_output ) - - IF(_dbus_result MATCHES 0) - STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}") - SEPARATE_ARGUMENTS(_dbus_query_output) - ELSE(_dbus_result MATCHES 0) - SET(_dbus_query_output) - ENDIF(_dbus_result MATCHES 0) - - FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} ) - - IF(QT_DBUS_LIBRARY) - SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) - ENDIF(QT_DBUS_LIBRARY) - - MARK_AS_ADVANCED(QT_DBUS_LIBRARY) - ENDIF(NOT QT_DBUS_LIBRARY) - - ENDIF(QT_QCONFIG MATCHES "dbus") - - ## glib - IF(QT_QCONFIG MATCHES "glib") - - # if the glib libraries aren't found, we'll assume its not required to build - # shared Qt on Linux doesn't require it - - # Qt 4.2.0+ uses glib-2.0 - IF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L glib-2.0 gthread-2.0 - OUTPUT_VARIABLE _glib_query_output - RESULT_VARIABLE _glib_result - ERROR_VARIABLE _glib_query_output ) - - IF(_glib_result MATCHES 0) - STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") - SEPARATE_ARGUMENTS(_glib_query_output) - ELSE(_glib_result MATCHES 0) - SET(_glib_query_output) - ENDIF(_glib_result MATCHES 0) - - FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} ) - FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} ) - - MARK_AS_ADVANCED(QT_GLIB_LIBRARY) - MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) - ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) - - IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} - ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) - ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) - - - # Qt 4.5+ also links to gobject-2.0 - IF(QT_VERSION_MINOR GREATER 4) - IF(NOT QT_GOBJECT_LIBRARY) - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L gobject-2.0 - OUTPUT_VARIABLE _glib_query_output - RESULT_VARIABLE _glib_result - ERROR_VARIABLE _glib_query_output ) - - IF(_glib_result MATCHES 0) - STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") - SEPARATE_ARGUMENTS(_glib_query_output) - ELSE(_glib_result MATCHES 0) - SET(_glib_query_output) - ENDIF(_glib_result MATCHES 0) - - FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) - - MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) - ENDIF(NOT QT_GOBJECT_LIBRARY) - - IF(QT_GOBJECT_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} - ${QT_GOBJECT_LIBRARY}) - ENDIF(QT_GOBJECT_LIBRARY) - ENDIF(QT_VERSION_MINOR GREATER 4) - - ENDIF(QT_QCONFIG MATCHES "glib") - - ## clock-monotonic, just see if we need to link with rt - IF(QT_QCONFIG MATCHES "clock-monotonic") - SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) - SET(CMAKE_REQUIRED_LIBRARIES rt) - CHECK_SYMBOL_EXISTS(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS) - SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) - IF(QT_POSIX_TIMERS) - FIND_LIBRARY(QT_RT_LIBRARY NAMES rt) - MARK_AS_ADVANCED(QT_RT_LIBRARY) - IF(QT_RT_LIBRARY) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) - ENDIF(QT_RT_LIBRARY) - ENDIF(QT_POSIX_TIMERS) - ENDIF(QT_QCONFIG MATCHES "clock-monotonic") - - IF(Q_WS_X11) - # X11 libraries Qt absolutely depends on - QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11") - SEPARATE_ARGUMENTS(QT_LIBS_X11) - FOREACH(QT_X11_LIB ${QT_LIBS_X11}) - STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") - SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") - FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(${QT_TMP_STR}) - IF(${QT_TMP_STR}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) - ENDIF(${QT_TMP_STR}) - ENDFOREACH(QT_X11_LIB) - - QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) - - QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD") - SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD}) - ENDIF(Q_WS_X11) - - IF(Q_WS_WIN) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm) - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32) - ENDIF(Q_WS_WIN) - - IF(Q_WS_MAC) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon") - - # Qt 4.0, 4.1, 4.2 use QuickTime - IF(QT_VERSION_MINOR LESS 3) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework QuickTime") - ENDIF(QT_VERSION_MINOR LESS 3) - - # Qt 4.2+ use AppKit - IF(QT_VERSION_MINOR GREATER 1) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework AppKit") - ENDIF(QT_VERSION_MINOR GREATER 1) + INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake") - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices") - ENDIF(Q_WS_MAC) ####################################### # diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake index e2efe77ae..aa4d5f6f1 100644 --- a/Modules/FindRTI.cmake +++ b/Modules/FindRTI.cmake @@ -99,4 +99,4 @@ INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG RTI_LIBRARY RTI_INCLUDE_DIR) -# $Id: FindRTI.cmake,v 1.4.2.1 2009-10-01 21:20:32 hoffman Exp $ +# $Id$ diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index cf7710e74..45e2da61a 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -152,6 +152,7 @@ ENDIF(NOT RUBY_VERSION_MAJOR) SET(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}") SET(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}") SET(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}") +SET(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}") # Now we know which version we found IF(Ruby_FIND_VERSION) @@ -180,7 +181,6 @@ SET(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} ) # if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir IF( ${Ruby_FIND_VERSION_SHORT_NODOT} GREATER 18 OR ${_RUBY_VERSION_SHORT_NODOT} GREATER 18 OR RUBY_HDR_DIR) - message(STATUS "lookign for config.h") FIND_PATH(RUBY_CONFIG_INCLUDE_DIR NAMES ruby/config.h config.h HINTS @@ -214,10 +214,10 @@ IF(WIN32) ENDIF( MSVC90 ) LIST(APPEND _RUBY_POSSIBLE_LIB_NAMES - "msvcr${_RUBY_MSVC_RUNTIME}-ruby${RUBY_NODOT_VERSION}" - "msvcr${_RUBY_MSVC_RUNTIME}-ruby${RUBY_NODOT_VERSION}-static" - "msvcrt-ruby${RUBY_NODOT_VERSION}" - "msvcrt-ruby${RUBY_NODOT_VERSION}-static" ) + "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}" + "msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static" + "msvcrt-ruby${_RUBY_NODOT_VERSION}" + "msvcrt-ruby${_RUBY_NODOT_VERSION}-static" ) ENDIF(WIN32) FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} ) diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index ff0d0a588..9b7529b8a 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -20,9 +20,9 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF(WIN32 AND UNIX) +IF(CYGWIN) FIND_PROGRAM(TCL_TCLSH NAMES cygtclsh83 cygtclsh80) -ENDIF(WIN32 AND UNIX) +ENDIF(CYGWIN) GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH) GET_FILENAME_COMPONENT(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 531c02663..c084df063 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -6,6 +6,7 @@ # # and also the following more fine grained variables: # Include paths: X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# X11_X11_INCLUDE_PATH, X11_X11_LIB # X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND # X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND # X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index 7a360de16..a7d557136 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -100,6 +100,10 @@ if(FortranCInterface_SOURCE_DIR) return() endif() +# Use CMake 2.8.0 behavior for this module regardless of including context. +cmake_policy(PUSH) +cmake_policy(VERSION 2.8.0) + #----------------------------------------------------------------------------- # Verify that C and Fortran are available. foreach(lang C Fortran) @@ -244,6 +248,9 @@ function(FortranCInterface_VERIFY) VerifyFortranC CMAKE_FLAGS -DVERIFY_CXX=${verify_cxx} -DCMAKE_VERBOSE_MAKEFILE=ON + "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}" + "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}" + "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" OUTPUT_VARIABLE _output) file(WRITE "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" "${_output}") @@ -273,3 +280,6 @@ function(FortranCInterface_VERIFY) "The output was:\n ${_output}") endif() endfunction() + +# Restore including context policies. +cmake_policy(POP) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index d014d9ac8..18014af5a 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -56,6 +56,7 @@ list(REMOVE_DUPLICATES module_symbols) # Note that some compiler manglings cannot be invoked from C: # MIPSpro uses "MY_SUB.in.MY_MODULE" # SunPro uses "my_module.my_sub_" +# PathScale uses "MY_SUB.in.MY_MODULE" # Add module symbols only with Fortran90. if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 70dbe2735..2ea43d132 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -39,6 +39,9 @@ try_compile(FortranCInterface_COMPILED ${FortranCInterface_BINARY_DIR} ${FortranCInterface_SOURCE_DIR} FortranCInterface + CMAKE_FLAGS + "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}" + "-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}" OUTPUT_VARIABLE FortranCInterface_OUTPUT) set(FortranCInterface_COMPILED ${FortranCInterface_COMPILED}) unset(FortranCInterface_COMPILED CACHE) diff --git a/Modules/FortranCInterface/my_module_.c b/Modules/FortranCInterface/my_module_.c index 0d7091f2b..364b21460 100644 --- a/Modules/FortranCInterface/my_module_.c +++ b/Modules/FortranCInterface/my_module_.c @@ -1,2 +1,8 @@ +#if defined(__PATHSCALE__) +/* PathScale Fortran wants my_module_ when calling any my_module symbol, + but module symbols use '.in.' so we cannot provide them anyway. */ +void pathscale_my_module_(void) {} +#else /* PGI Fortran wants my_module_ when calling any my_module symbol. */ void my_module_(void) {} +#endif diff --git a/Modules/FortranCInterface/mymodule_.c b/Modules/FortranCInterface/mymodule_.c index a7152afad..b5feda6ce 100644 --- a/Modules/FortranCInterface/mymodule_.c +++ b/Modules/FortranCInterface/mymodule_.c @@ -1,2 +1,8 @@ +#if defined(__PATHSCALE__) +/* PathScale Fortran wants mymodule_ when calling any mymodule symbol, + but module symbols use '.in.' so we cannot provide them anyway. */ +void pathscale_mymodule_(void) {} +#else /* PGI Fortran wants mymodule_ when calling any mymodule symbol. */ void mymodule_(void) {} +#endif diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 67d4a1416..123b4332b 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -389,7 +389,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) string(TOLOWER "$ENV{windir}" windir) string(REGEX REPLACE "\\\\" "/" windir "${windir}") - if(lower MATCHES "^(${sysroot}/system|${windir}/system|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() endif() diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 6f24cd6a3..97c6ccba2 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -1,11 +1,11 @@ # By including this file, all files in the CMAKE_INSTALL_DEBUG_LIBRARIES, # will be installed with INSTALL_PROGRAMS into /bin for WIN32 and /lib # for non-win32. If CMAKE_SKIP_INSTALL_RULES is set to TRUE before including -# this file, then the INSTALL command is not called. The use can use +# this file, then the INSTALL command is not called. The user can use # the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a custom install # command and install them into any directory they want. # If it is the MSVC compiler, then the microsoft run -# time libraries will be found add automatically added to the +# time libraries will be found and automatically added to the # CMAKE_INSTALL_DEBUG_LIBRARIES, and installed. # If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC # compiler, then the debug libraries are installed when available. @@ -114,6 +114,34 @@ IF(MSVC) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) ENDIF(MSVC90) + IF(MSVC10) + # Find the runtime library redistribution directory. + FIND_PATH(MSVC10_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/redist" + "${base_dir}/VC/redist" + ) + MARK_AS_ADVANCED(MSVC10_REDIST_DIR) + SET(MSVC10_CRT_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT") + + # Install the manifest that allows DLLs to be loaded from the + # directory containing the executable. + SET(__install__libs + "${MSVC10_CRT_DIR}/Microsoft.VC100.CRT.manifest" + "${MSVC10_CRT_DIR}/msvcp100.dll" + "${MSVC10_CRT_DIR}/msvcr100.dll" + ) + IF(CMAKE_INSTALL_DEBUG_LIBRARIES) + SET(MSVC10_CRT_DIR + "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT") + SET(__install__libs ${__install__libs} + "${MSVC10_CRT_DIR}/Microsoft.VC100.DebugCRT.manifest" + "${MSVC10_CRT_DIR}/msvcp100d.dll" + "${MSVC10_CRT_DIR}/msvcr100d.dll" + ) + ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + ENDIF(MSVC10) + IF(CMAKE_INSTALL_MFC_LIBRARIES) IF(MSVC70) SET(__install__libs ${__install__libs} @@ -207,6 +235,47 @@ IF(MSVC) ) ENDIF(MSVC90) + IF(MSVC10) + IF(CMAKE_INSTALL_DEBUG_LIBRARIES) + SET(MSVC10_MFC_DIR + "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC100.DebugMFC") + SET(__install__libs ${__install__libs} + "${MSVC10_MFC_DIR}/Microsoft.VC100.DebugMFC.manifest" + "${MSVC10_MFC_DIR}/mfc100d.dll" + "${MSVC10_MFC_DIR}/mfc100ud.dll" + "${MSVC10_MFC_DIR}/mfcm100d.dll" + "${MSVC10_MFC_DIR}/mfcm100ud.dll" + ) + ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + + SET(MSVC10_MFC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFC") + # Install the manifest that allows DLLs to be loaded from the + # directory containing the executable. + SET(__install__libs ${__install__libs} + "${MSVC10_MFC_DIR}/Microsoft.VC100.MFC.manifest" + "${MSVC10_MFC_DIR}/mfc100.dll" + "${MSVC10_MFC_DIR}/mfc100u.dll" + "${MSVC10_MFC_DIR}/mfcm100.dll" + "${MSVC10_MFC_DIR}/mfcm100u.dll" + ) + # include the language dll's for vs10 as well as the actuall dll's + SET(MSVC10_MFCLOC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFCLOC") + # Install the manifest that allows DLLs to be loaded from the + # directory containing the executable. + SET(__install__libs ${__install__libs} + "${MSVC10_MFCLOC_DIR}/Microsoft.VC100.MFCLOC.manifest" + "${MSVC10_MFCLOC_DIR}/mfc100chs.dll" + "${MSVC10_MFCLOC_DIR}/mfc100cht.dll" + "${MSVC10_MFCLOC_DIR}/mfc100enu.dll" + "${MSVC10_MFCLOC_DIR}/mfc100esp.dll" + "${MSVC10_MFCLOC_DIR}/mfc100deu.dll" + "${MSVC10_MFCLOC_DIR}/mfc100fra.dll" + "${MSVC10_MFCLOC_DIR}/mfc100ita.dll" + "${MSVC10_MFCLOC_DIR}/mfc100jpn.dll" + "${MSVC10_MFCLOC_DIR}/mfc100kor.dll" + ) + ENDIF(MSVC10) + ENDIF(CMAKE_INSTALL_MFC_LIBRARIES) FOREACH(lib diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake index f358cd7f6..0f2d4790a 100644 --- a/Modules/KDE3Macros.cmake +++ b/Modules/KDE3Macros.cmake @@ -322,7 +322,11 @@ MACRO(KDE3_INSTALL_LIBTOOL_FILE _target) FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n") FILE(APPEND ${_laname} "dlname='${_soname}'\n") FILE(APPEND ${_laname} "# Names of this library\n") - FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") + IF(CYGWIN) + FILE(APPEND ${_laname} "library_names='${_soname}'\n") + ELSE(CYGWIN) + FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") + ENDIF(CYGWIN) FILE(APPEND ${_laname} "# The name of the static archive\n") FILE(APPEND ${_laname} "old_library=''\n") FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n") diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index d90967d2e..776bc0718 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -74,7 +74,7 @@ Var AR_RegFlags ClearErrors ;Reading component status from registry - ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@\Components\${SecName}" "Installed" + ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed" IfErrors "default_${SecName}" ;Status will stay default if registry value not found ;(component was never installed) @@ -107,13 +107,13 @@ Var AR_RegFlags ;Section is not selected: ;Calling Section uninstall macro and writing zero installed flag !insertmacro "Remove_${${SecName}}" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@\Components\${SecName}" \ + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \ "Installed" 0 Goto "exit_${SecName}" "leave_${SecName}:" ;Section is selected: - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@\Components\${SecName}" \ + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \ "Installed" 1 "exit_${SecName}:" @@ -213,6 +213,15 @@ Function AddToPath IfFileExists "$0\*.*" "" AddToPath_done ReadEnvStr $1 PATH + ; if the path is too long for a NSIS variable NSIS will return a 0 + ; length string. If we find that, then warn and skip any path + ; modification as it will trash the existing path. + StrLen $2 $1 + IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done + CheckPathLength_ShowPathWarning: + Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" + Goto AddToPath_done + CheckPathLength_Done: Push "$1;" Push "$0;" Call StrStr @@ -484,7 +493,7 @@ Function ConditionalAddToRegisty Pop $0 Pop $1 StrCmp "$0" "" ConditionalAddToRegisty_EmptyString - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" \ + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \ "$1" "$0" ;MessageBox MB_OK "Set Registry: '$1' to '$0'" DetailPrint "Set install registry entry: '$1' to '$0'" @@ -794,17 +803,17 @@ FunctionEnd Section "Uninstall" ReadRegStr $START_MENU SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "StartMenu" + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu" ;MessageBox MB_OK "Start menu is in: $START_MENU" ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "DoNotAddToPath" + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath" ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "AddToPathAllUsers" + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers" ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "AddToPathCurrentUser" + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser" ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" ReadRegStr $INSTALL_DESKTOP SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "InstallToDesktop" + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop" ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " @CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ @@ -821,7 +830,7 @@ Section "Uninstall" ;Remove the uninstaller itself. Delete "$INSTDIR\Uninstall.exe" - DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" ;Remove the installation directory if it is empty. RMDir "$INSTDIR" diff --git a/Modules/Platform/AIX-GNU-C.cmake b/Modules/Platform/AIX-GNU-C.cmake new file mode 100644 index 000000000..f49d528b3 --- /dev/null +++ b/Modules/Platform/AIX-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(C) diff --git a/Modules/Platform/AIX-GNU-CXX.cmake b/Modules/Platform/AIX-GNU-CXX.cmake new file mode 100644 index 000000000..ec8e83fa1 --- /dev/null +++ b/Modules/Platform/AIX-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(CXX) diff --git a/Modules/Platform/AIX-GNU-Fortran.cmake b/Modules/Platform/AIX-GNU-Fortran.cmake new file mode 100644 index 000000000..07772a716 --- /dev/null +++ b/Modules/Platform/AIX-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(Fortran) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake new file mode 100644 index 000000000..fc3880eee --- /dev/null +++ b/Modules/Platform/AIX-GNU.cmake @@ -0,0 +1,23 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__AIX_COMPILER_GNU) + return() +endif() +set(__AIX_COMPILER_GNU 1) + +macro(__aix_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G") +endmacro() diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake index c8a33c32f..0ab0cce65 100644 --- a/Modules/Platform/AIX.cmake +++ b/Modules/Platform/AIX.cmake @@ -15,16 +15,6 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # Files named "libfoo.a" may actually be shared libraries. SET_PROPERTY(GLOBAL PROPERTY TARGET_ARCHIVES_MAY_BE_SHARED_LIBS 1) -# CXX Compiler -IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-G") # -shared -ENDIF(CMAKE_COMPILER_IS_GNUCXX) - -# C Compiler -IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-G") # -shared -ENDIF(CMAKE_COMPILER_IS_GNUCC) - # since .a can be a static or shared library on AIX, we can not do this. # at some point if we wanted it, we would have to figure out if a .a is # static or shared, then we could add this back: diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake index f4d84d738..41aa8f742 100644 --- a/Modules/Platform/BeOS.cmake +++ b/Modules/Platform/BeOS.cmake @@ -1,14 +1,10 @@ SET(BEOS 1) -# GCC is the default compiler on BeOS. -INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) - SET(CMAKE_DL_LIBS root be) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/CYGWIN-GNU-C.cmake b/Modules/Platform/CYGWIN-GNU-C.cmake new file mode 100644 index 000000000..9eb0ecf29 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(C) diff --git a/Modules/Platform/CYGWIN-GNU-CXX.cmake b/Modules/Platform/CYGWIN-GNU-CXX.cmake new file mode 100644 index 000000000..2603dcd49 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(CXX) diff --git a/Modules/Platform/CYGWIN-GNU-Fortran.cmake b/Modules/Platform/CYGWIN-GNU-Fortran.cmake new file mode 100644 index 000000000..d3b49b6f9 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/CYGWIN-GNU) +__cygwin_compiler_gnu(Fortran) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake new file mode 100644 index 000000000..6a80f62d4 --- /dev/null +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -0,0 +1,51 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__CYGWIN_COMPILER_GNU) + return() +endif() +set(__CYGWIN_COMPILER_GNU 1) + +# TODO: Is -Wl,--enable-auto-import now always default? +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import") +set(CMAKE_CREATE_WIN32_EXE "-mwindows") + +set(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,,--minor-image-version,") + +macro(__cygwin_compiler_gnu lang) + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on cygwin + + # Initialize C link type selection flags. These flags are used when + # building a shared library, shared module, or executable that links + # to other libraries to select whether to use the static or shared + # versions of the libraries. + FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) + SET(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + ENDFOREACH(type) + + # TODO: Is -Wl,--enable-auto-import now always default? + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") +endmacro() diff --git a/Modules/Platform/CYGWIN-g77.cmake b/Modules/Platform/CYGWIN-g77.cmake deleted file mode 100644 index 942319f90..000000000 --- a/Modules/Platform/CYGWIN-g77.cmake +++ /dev/null @@ -1,6 +0,0 @@ -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "") -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -INCLUDE(Platform/g77) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index dd179a4d7..b157f7215 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,55 +1,20 @@ SET(WIN32 1) SET(CYGWIN 1) -SET(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-auto-import") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -SET(CMAKE_DL_LIBS "-lgdi32" ) SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") SET(CMAKE_SHARED_MODULE_PREFIX "lib") SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") -# no pic for gcc on cygwin -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -SET(CMAKE_CREATE_WIN32_EXE "-mwindows") # Modules have a different default prefix that shared libs. SET(CMAKE_MODULE_EXISTS 1) -SET(CMAKE_FIND_LIBRARY_PREFIXES "cyg" "lib") -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a") - -SET(CMAKE_GNULD_IMAGE_VERSION - "-Wl,--major-image-version,,--minor-image-version,") - -SET(CMAKE_C_CREATE_SHARED_MODULE - " -o ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -o ${CMAKE_GNULD_IMAGE_VERSION} ") - -SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") - -SET(CMAKE_C_LINK_EXECUTABLE - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_LINK_EXECUTABLE - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") +SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") # Shared libraries on cygwin can be named with their version number. SET(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 1) -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") -ENDFOREACH(type) - INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake index 100e8b184..4e326c4ca 100644 --- a/Modules/Platform/Darwin-GNU-C.cmake +++ b/Modules/Platform/Darwin-GNU-C.cmake @@ -1,2 +1,4 @@ include(Platform/Darwin-GNU) +__darwin_compiler_gnu(C) cmake_gnu_has_isysroot(C) +cmake_gnu_set_osx_deployment_target_flag(C) diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake index a2c2e16bc..b39487e58 100644 --- a/Modules/Platform/Darwin-GNU-CXX.cmake +++ b/Modules/Platform/Darwin-GNU-CXX.cmake @@ -1,2 +1,4 @@ include(Platform/Darwin-GNU) +__darwin_compiler_gnu(CXX) cmake_gnu_has_isysroot(CXX) +cmake_gnu_set_osx_deployment_target_flag(CXX) diff --git a/Modules/Platform/Darwin-GNU-Fortran.cmake b/Modules/Platform/Darwin-GNU-Fortran.cmake new file mode 100644 index 000000000..8e8acc377 --- /dev/null +++ b/Modules/Platform/Darwin-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-GNU) +__darwin_compiler_gnu(Fortran) diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index 8bbad88a2..4c2194a4d 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -1,3 +1,29 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_GNU) + return() +endif() +set(__DARWIN_COMPILER_GNU 1) + +macro(__darwin_compiler_gnu lang) + # GNU does not have -shared on OS X + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -headerpad_max_install_names") +endmacro() + macro(cmake_gnu_has_isysroot lang) if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x") set(_doc "${lang} compiler has -isysroot") @@ -16,3 +42,23 @@ macro(cmake_gnu_has_isysroot lang) endif() endif() endmacro() + +macro(cmake_gnu_set_osx_deployment_target_flag lang) + if(NOT DEFINED CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG) + set(_doc "${lang} compiler supports OSX deployment target flag") + message(STATUS "Checking whether ${_doc}") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help" + OUTPUT_VARIABLE _gcc_help + ERROR_VARIABLE _gcc_help + ) + if("${_gcc_help}" MATCHES "macosx-version-min") + message(STATUS "Checking whether ${_doc} - yes") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + else() + message(STATUS "Checking whether ${_doc} - no") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") + endif() + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "SET(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")") + endif() +endmacro() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 825f21861..c8bcad1d0 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,10 +1,11 @@ SET(APPLE 1) # Darwin versions: -# 6.x == Mac OSX 10.2 -# 7.x == Mac OSX 10.3 -# 8.x == Mac OSX 10.4 -# 9.x == Mac OSX 10.5 +# 6.x == Mac OSX 10.2 (Jaguar) +# 7.x == Mac OSX 10.3 (Panther) +# 8.x == Mac OSX 10.4 (Tiger) +# 9.x == Mac OSX 10.5 (Leopard) +# 10.x == Mac OSX 10.6 (Snow Leopard) STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") @@ -72,68 +73,73 @@ IF(NOT _CMAKE_OSX_SDKS) ENDIF(CMAKE_XCODE_SELECT) ENDIF(NOT _CMAKE_OSX_SDKS) -# Set CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT to the current version of OS X -EXECUTE_PROCESS(COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION) -STRING(REGEX REPLACE "^.*(10)\\.([0-9]+)\\.*([0-9]+)*.*$" "\\1.\\2" - CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT ${CURRENT_OSX_VERSION}) +EXECUTE_PROCESS(COMMAND sw_vers -productVersion + OUTPUT_VARIABLE CURRENT_OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) -# Set CMAKE_OSX_SYSROOT_DEFAULT based on CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT. -# This next block assumes that Apple will start being consistent with -# its SDK names from here on out... -IF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT GREATER "10.4") - SET(CMAKE_OSX_SYSROOT_DEFAULT - "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT}.sdk") -ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT GREATER "10.4") +#---------------------------------------------------------------------------- +# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... +# +STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" + _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") + +#---------------------------------------------------------------------------- +# CMAKE_OSX_DEPLOYMENT_TARGET + +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +IF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING + "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") +ENDIF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + +#---------------------------------------------------------------------------- +# CMAKE_OSX_SYSROOT + +# Environment variable set by the user overrides our default. +# Use the same environment variable that Xcode uses. +SET(ENV_SDKROOT "$ENV{SDKROOT}") -IF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.4") +# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION, +# accounting for the known specially named SDKs. +SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${_CURRENT_OSX_VERSION}.sdk") + +IF(_CURRENT_OSX_VERSION STREQUAL "10.4") SET(CMAKE_OSX_SYSROOT_DEFAULT "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.4u.sdk") -ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.4") +ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.4") -IF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.3") +IF(_CURRENT_OSX_VERSION STREQUAL "10.3") SET(CMAKE_OSX_SYSROOT_DEFAULT "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.3.9.sdk") -ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.3") - -# Allow environment variables set by the user to override our defaults. -# Use the same environment variables that Xcode uses. -SET(ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") -SET(ENV_SDKROOT "$ENV{SDKROOT}") - -# See if we need to override the default SDK or Deployment target with the -# environment variables -IF(NOT ENV_MACOSX_DEPLOYMENT_TARGET STREQUAL "") - SET(CMAKE_OSX_DEPLOYMENT_TARGET_VALUE ${ENV_MACOSX_DEPLOYMENT_TARGET}) -ELSE(NOT ENV_MACOSX_DEPLOYMENT_TARGET STREQUAL "") - SET(CMAKE_OSX_DEPLOYMENT_TARGET_VALUE ${CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT}) -ENDIF(NOT ENV_MACOSX_DEPLOYMENT_TARGET STREQUAL "") +ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.3") +# Use environment or default as initial cache value: IF(NOT ENV_SDKROOT STREQUAL "") SET(CMAKE_OSX_SYSROOT_VALUE ${ENV_SDKROOT}) ELSE(NOT ENV_SDKROOT STREQUAL "") SET(CMAKE_OSX_SYSROOT_VALUE ${CMAKE_OSX_SYSROOT_DEFAULT}) ENDIF(NOT ENV_SDKROOT STREQUAL "") -# Set cache variables - end user may change these during ccmake or cmake-gui configure. -IF(CURRENT_OSX_VERSION GREATER 10.3) - SET(CMAKE_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET_VALUE} CACHE STRING - "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") -ENDIF(CURRENT_OSX_VERSION GREATER 10.3) - +# Set cache variable - end user may change this during ccmake or cmake-gui configure. SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_VALUE} CACHE PATH "The product will be built against the headers and libraries located inside the indicated SDK.") #---------------------------------------------------------------------------- function(SanityCheckSDKAndDeployTarget _sdk_path _deploy) - if (_deploy STREQUAL "") + if(_deploy STREQUAL "") return() endif() - string (REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK ${_sdk_path}) - if (_deploy GREATER SDK) - message (FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK}") - endif (_deploy GREATER SDK) -endfunction(SanityCheckSDKAndDeployTarget _sdk_path _deploy) + if(_sdk_path STREQUAL "") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET='${_deploy}' but CMAKE_OSX_SYSROOT is empty... - either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty") + endif() + + string(REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK "${_sdk_path}") + if(_deploy GREATER "${SDK}") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK} or lower") + endif() +endfunction(SanityCheckSDKAndDeployTarget) #---------------------------------------------------------------------------- # Make sure the combination of SDK and Deployment Target are allowed @@ -172,8 +178,6 @@ IF(NOT XCODE) # but the fact that the setting exists will cause the generators to support # soname computation. SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") ENDIF(NOT XCODE) # Xcode does not support -isystem yet. diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index e7b26ac65..033db0659 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -7,9 +7,7 @@ IF(EXISTS /usr/include/dlfcn.h) SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") - SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") ENDIF(EXISTS /usr/include/dlfcn.h) # Shared libraries with no builtin soname may not be linked safely by diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake index 26615e128..fe3d47b09 100644 --- a/Modules/Platform/GNU.cmake +++ b/Modules/Platform/GNU.cmake @@ -2,9 +2,7 @@ SET(CMAKE_DL_LIBS "dl") SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Generic-ADSP-ASM.cmake b/Modules/Platform/Generic-ADSP-ASM.cmake index 4f6ed7536..cec4c2f68 100644 --- a/Modules/Platform/Generic-ADSP-ASM.cmake +++ b/Modules/Platform/Generic-ADSP-ASM.cmake @@ -1,7 +1,7 @@ -INCLUDE(Platform/Generic-ADSP-Common) - -SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) -SET(CMAKE_ASM_OUTPUT_EXTENSION ".doj" ) -SET(CMAKE_ASM_COMPILE_OBJECT - " -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o ") - +INCLUDE(Platform/Generic-ADSP-Common) + +SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) +SET(CMAKE_ASM_OUTPUT_EXTENSION ".doj" ) +SET(CMAKE_ASM_COMPILE_OBJECT + " -proc ${ADSP_PROCESSOR} -si-revision ${ADSP_PROCESSOR_SILICIUM_REVISION} -o ") + diff --git a/Modules/Platform/HP-UX-GNU-C.cmake b/Modules/Platform/HP-UX-GNU-C.cmake new file mode 100644 index 000000000..5f9ac4200 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(C) diff --git a/Modules/Platform/HP-UX-GNU-CXX.cmake b/Modules/Platform/HP-UX-GNU-CXX.cmake new file mode 100644 index 000000000..689bed088 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(CXX) diff --git a/Modules/Platform/HP-UX-GNU-Fortran.cmake b/Modules/Platform/HP-UX-GNU-Fortran.cmake new file mode 100644 index 000000000..ee0181fe4 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/HP-UX-GNU) +__hpux_compiler_gnu(Fortran) diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake new file mode 100644 index 000000000..da9fe4835 --- /dev/null +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__HPUX_COMPILER_GNU) + return() +endif() +set(__HPUX_COMPILER_GNU 1) + +macro(__hpux_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") +endmacro() diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 9584cbdbe..f8893d8d3 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -15,13 +15,6 @@ SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) # fortran IF(CMAKE_COMPILER_IS_GNUG77) - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,+h") - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic ELSE(CMAKE_COMPILER_IS_GNUG77) # use ld directly to create shared libraries for hp cc SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY @@ -37,14 +30,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUG77) # C compiler IF(CMAKE_COMPILER_IS_GNUCC) - # gnu gcc - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,+h") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic ELSE(CMAKE_COMPILER_IS_GNUCC) # hp cc # use ld directly to create shared libraries for hp cc @@ -64,14 +49,6 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC) # CXX compiler IF(CMAKE_COMPILER_IS_GNUCXX) - # for gnu C++ - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared - SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,+h") ELSE(CMAKE_COMPILER_IS_GNUCXX) # for hp aCC SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "+Z") # -pic diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index 6676f24b7..8277a247c 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -1,15 +1,11 @@ SET(BEOS 1) -# GCC is the default compiler on Haiku. -INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) - SET(CMAKE_DL_LIBS root be) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") INCLUDE(Platform/UnixPaths) LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common) diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake index 58c103720..fac941f3b 100644 --- a/Modules/Platform/IRIX.cmake +++ b/Modules/Platform/IRIX.cmake @@ -1,6 +1,5 @@ SET(CMAKE_DL_LIBS "") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty IF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index d83ca604b..b60a7f297 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -1,10 +1,8 @@ SET(CMAKE_DL_LIBS "") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") IF(NOT CMAKE_COMPILER_IS_GNUCC) # Set default flags init. SET(CMAKE_C_FLAGS_INIT "") diff --git a/Modules/Platform/Linux-GNU-C.cmake b/Modules/Platform/Linux-GNU-C.cmake new file mode 100644 index 000000000..3ab142f13 --- /dev/null +++ b/Modules/Platform/Linux-GNU-C.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-GNU) +__linux_compiler_gnu(C) diff --git a/Modules/Platform/Linux-GNU-CXX.cmake b/Modules/Platform/Linux-GNU-CXX.cmake new file mode 100644 index 000000000..9e4f904f2 --- /dev/null +++ b/Modules/Platform/Linux-GNU-CXX.cmake @@ -0,0 +1,2 @@ +INCLUDE(Platform/Linux-GNU) +__linux_compiler_gnu(CXX) diff --git a/Modules/Platform/Linux-GNU-Fortran.cmake b/Modules/Platform/Linux-GNU-Fortran.cmake index 16d63fc2f..e364c872a 100644 --- a/Modules/Platform/Linux-GNU-Fortran.cmake +++ b/Modules/Platform/Linux-GNU-Fortran.cmake @@ -1,16 +1,2 @@ -SET(CMAKE_Fortran_MODDIR_FLAG -J) -SET (CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic -SET (CMAKE_Fortran_FLAGS_INIT "") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") - -IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_Fortran "-isystem ") -ENDIF(NOT APPLE) - -# These will require updates to CMake C++ code to support -# preprocessing rules for Fortran. -#SET (CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -#SET (CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +INCLUDE(Platform/Linux-GNU) +__linux_compiler_gnu(Fortran) diff --git a/Modules/Platform/Linux-GNU.cmake b/Modules/Platform/Linux-GNU.cmake new file mode 100644 index 000000000..d257f3413 --- /dev/null +++ b/Modules/Platform/Linux-GNU.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_GNU) + return() +endif() +set(__LINUX_COMPILER_GNU 1) + +macro(__linux_compiler_gnu lang) + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") +endmacro() diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake index 7be331ea8..c909e68fc 100644 --- a/Modules/Platform/Linux-Intel-C.cmake +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -1,8 +1,2 @@ INCLUDE(Platform/Linux-Intel) -IF(XIAR) - # INTERPROCEDURAL_OPTIMIZATION - SET(CMAKE_C_COMPILE_OPTIONS_IPO -ipo) - SET(CMAKE_C_CREATE_STATIC_LIBRARY_IPO - "${XIAR} cr " - "${XIAR} -s ") -ENDIF(XIAR) +__linux_compiler_intel(C) diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake index cedb19638..0b7daf475 100644 --- a/Modules/Platform/Linux-Intel-CXX.cmake +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -1,8 +1,2 @@ INCLUDE(Platform/Linux-Intel) -IF(XIAR) - # INTERPROCEDURAL_OPTIMIZATION - SET(CMAKE_CXX_COMPILE_OPTIONS_IPO -ipo) - SET(CMAKE_CXX_CREATE_STATIC_LIBRARY_IPO - "${XIAR} cr " - "${XIAR} -s ") -ENDIF(XIAR) +__linux_compiler_intel(CXX) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index da3b935c2..342b5c2fa 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,16 +1,4 @@ INCLUDE(Platform/Linux-Intel) -IF(XIAR) - # INTERPROCEDURAL_OPTIMIZATION - SET(CMAKE_Fortran_COMPILE_OPTIONS_IPO -ipo) - SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY_IPO - "${XIAR} cr " - "${XIAR} -s ") -ENDIF(XIAR) - -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -i_dynamic -nofor_main") -SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,") -SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,") -SET(CMAKE_DL_LIBS "dl") +__linux_compiler_intel(Fortran) +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -i_dynamic -nofor_main") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake index e7a67b6c4..dff90e984 100644 --- a/Modules/Platform/Linux-Intel.cmake +++ b/Modules/Platform/Linux-Intel.cmake @@ -1,3 +1,23 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_INTEL) + return() +endif() +set(__LINUX_COMPILER_INTEL 1) + if(NOT XIAR) set(_intel_xiar_hints) foreach(lang C CXX Fortran) @@ -9,3 +29,20 @@ if(NOT XIAR) find_program(XIAR NAMES xiar HINTS ${_intel_xiar_hints}) mark_as_advanced(XIAR) endif(NOT XIAR) + +macro(__linux_compiler_intel lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + + # We pass this for historical reasons. Projects may have + # executables that use dlopen but do not set ENABLE_EXPORTS. + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic") + + if(XIAR) + # INTERPROCEDURAL_OPTIMIZATION + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO -ipo) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY_IPO + "${XIAR} cr " + "${XIAR} -s ") + endif() +endmacro() diff --git a/Modules/Platform/Linux-PGI-C.cmake b/Modules/Platform/Linux-PGI-C.cmake index df3c38e1b..edf4f3f0e 100644 --- a/Modules/Platform/Linux-PGI-C.cmake +++ b/Modules/Platform/Linux-PGI-C.cmake @@ -1,5 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - -SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") - +include(Platform/Linux-PGI) +__linux_compiler_pgi(C) diff --git a/Modules/Platform/Linux-PGI-CXX.cmake b/Modules/Platform/Linux-PGI-CXX.cmake index 32a2a8e9b..d425f886e 100644 --- a/Modules/Platform/Linux-PGI-CXX.cmake +++ b/Modules/Platform/Linux-PGI-CXX.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - -SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +include(Platform/Linux-PGI) +__linux_compiler_pgi(CXX) diff --git a/Modules/Platform/Linux-PGI-Fortran.cmake b/Modules/Platform/Linux-PGI-Fortran.cmake index 7c99e793e..e8731a384 100644 --- a/Modules/Platform/Linux-PGI-Fortran.cmake +++ b/Modules/Platform/Linux-PGI-Fortran.cmake @@ -1,9 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") - -SET(CMAKE_Fortran_MODDIR_FLAG "-module ") -SET(CMAKE_Fortran_FLAGS_INIT "-Mpreprocess -Kieee -fpic") -SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g -O0 -Mbounds") -SET(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O2 -s") -SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-fast -O3 -Mipa=fast") -SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt") - +include(Platform/Linux-PGI) +__linux_compiler_pgi(Fortran) diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake new file mode 100644 index 000000000..868ee33b6 --- /dev/null +++ b/Modules/Platform/Linux-PGI.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_PGI) + return() +endif() +set(__LINUX_COMPILER_PGI 1) + +macro(__linux_compiler_pgi lang) + # Shared library compile and link flags. + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/Linux-PathScale-C.cmake b/Modules/Platform/Linux-PathScale-C.cmake new file mode 100644 index 000000000..009f398fe --- /dev/null +++ b/Modules/Platform/Linux-PathScale-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(C) diff --git a/Modules/Platform/Linux-PathScale-CXX.cmake b/Modules/Platform/Linux-PathScale-CXX.cmake new file mode 100644 index 000000000..b6a5771aa --- /dev/null +++ b/Modules/Platform/Linux-PathScale-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(CXX) diff --git a/Modules/Platform/Linux-PathScale-Fortran.cmake b/Modules/Platform/Linux-PathScale-Fortran.cmake new file mode 100644 index 000000000..5662d3d88 --- /dev/null +++ b/Modules/Platform/Linux-PathScale-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Linux-PathScale) +__linux_compiler_pathscale(Fortran) diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake new file mode 100644 index 000000000..8537e4c0f --- /dev/null +++ b/Modules/Platform/Linux-PathScale.cmake @@ -0,0 +1,25 @@ + +#============================================================================= +# Copyright 2002-2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_PATHSCALE) + return() +endif() +set(__LINUX_COMPILER_PATHSCALE 1) + +macro(__linux_compiler_pathscale lang) + # Shared library compile and link flags. + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/Linux-SunPro-C.cmake b/Modules/Platform/Linux-SunPro-C.cmake deleted file mode 100644 index 74aedd0fc..000000000 --- a/Modules/Platform/Linux-SunPro-C.cmake +++ /dev/null @@ -1,3 +0,0 @@ -# Linux sun studio c options -SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake index 6d9d8a572..54904733d 100644 --- a/Modules/Platform/Linux-SunPro-CXX.cmake +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -1,4 +1,2 @@ -# Linux sun studio c++ options -SET(CMAKE_DL_LIBS "dl") SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") diff --git a/Modules/Platform/Linux-SunPro-Fortran.cmake b/Modules/Platform/Linux-SunPro-Fortran.cmake deleted file mode 100644 index 2355aad73..000000000 --- a/Modules/Platform/Linux-SunPro-Fortran.cmake +++ /dev/null @@ -1,2 +0,0 @@ -# Linux sun studio fortran options -SET(CMAKE_DL_LIBS "dl") diff --git a/Modules/Platform/Linux-XL-C.cmake b/Modules/Platform/Linux-XL-C.cmake index efcdf87a1..b1b07f617 100644 --- a/Modules/Platform/Linux-XL-C.cmake +++ b/Modules/Platform/Linux-XL-C.cmake @@ -1,3 +1 @@ -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-XL-CXX.cmake b/Modules/Platform/Linux-XL-CXX.cmake index b1b6d8599..071a975ed 100644 --- a/Modules/Platform/Linux-XL-CXX.cmake +++ b/Modules/Platform/Linux-XL-CXX.cmake @@ -1,5 +1 @@ -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-XL-Fortran.cmake b/Modules/Platform/Linux-XL-Fortran.cmake index 3ebb89d87..5da574e2e 100644 --- a/Modules/Platform/Linux-XL-Fortran.cmake +++ b/Modules/Platform/Linux-XL-Fortran.cmake @@ -1,3 +1 @@ -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-qmkshrobj") diff --git a/Modules/Platform/Linux-como.cmake b/Modules/Platform/Linux-como.cmake index 6c259f3b3..7ea732082 100644 --- a/Modules/Platform/Linux-como.cmake +++ b/Modules/Platform/Linux-como.cmake @@ -15,4 +15,3 @@ SET(CMAKE_CXX_LINK_EXECUTABLE SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index 4e4c2cbaf..6490dd1e5 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -1,16 +1,9 @@ -# GCC is the default compiler on Linux. SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. @@ -59,5 +52,3 @@ INCLUDE(Platform/UnixPaths) IF(EXISTS "/etc/debian_version") SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE) ENDIF(EXISTS "/etc/debian_version") -# always include the gcc compiler information -INCLUDE(Platform/gcc) diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index abf0a61b7..0fb863619 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -7,9 +7,7 @@ IF(EXISTS /usr/include/dlfcn.h) SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") - SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") ENDIF(EXISTS /usr/include/dlfcn.h) INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake index 27af3b14e..652bed4ba 100644 --- a/Modules/Platform/OSF1.cmake +++ b/Modules/Platform/OSF1.cmake @@ -12,7 +12,6 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*") IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") ELSE(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index b48383a96..8cdbe02c1 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,8 +1,5 @@ SET(QNXNTO 1) -# GCC is the default compiler on QNX 6.3. -INCLUDE(Platform/gcc) - # The QNX GCC does not seem to have -isystem so remove the flag. SET(CMAKE_INCLUDE_SYSTEM_FLAG_C) SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX) @@ -15,9 +12,7 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. diff --git a/Modules/Platform/SunOS-GNU-C.cmake b/Modules/Platform/SunOS-GNU-C.cmake new file mode 100644 index 000000000..6a96c00ee --- /dev/null +++ b/Modules/Platform/SunOS-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(C) diff --git a/Modules/Platform/SunOS-GNU-CXX.cmake b/Modules/Platform/SunOS-GNU-CXX.cmake new file mode 100644 index 000000000..6b9f6fa86 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(CXX) diff --git a/Modules/Platform/SunOS-GNU-Fortran.cmake b/Modules/Platform/SunOS-GNU-Fortran.cmake new file mode 100644 index 000000000..c6b188836 --- /dev/null +++ b/Modules/Platform/SunOS-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/SunOS-GNU) +__sunos_compiler_gnu(Fortran) diff --git a/Modules/Platform/SunOS-GNU.cmake b/Modules/Platform/SunOS-GNU.cmake new file mode 100644 index 000000000..613ea6bbf --- /dev/null +++ b/Modules/Platform/SunOS-GNU.cmake @@ -0,0 +1,34 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__SUNOS_COMPILER_GNU) + return() +endif() +set(__SUNOS_COMPILER_GNU 1) + +macro(__sunos_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-R") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,-h") + + # Initialize C link type selection flags. These flags are used when + # building a shared library, shared module, or executable that links + # to other libraries to select whether to use the static or shared + # versions of the libraries. + foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + endforeach() +endmacro() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 7d25577ca..9f2ee2e38 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -5,23 +5,6 @@ IF(CMAKE_SYSTEM MATCHES "SunOS-4.*") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*") -IF(CMAKE_SYSTEM MATCHES "SunOS-5.*") - IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-h") - ENDIF(CMAKE_COMPILER_IS_GNUCC) - IF(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-R") - SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-h") - ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5.*") - IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_CXX_CREATE_SHARED_LIBRARY @@ -38,23 +21,6 @@ IF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) ENDIF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -IF(CMAKE_COMPILER_IS_GNUCC) - FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") - ENDFOREACH(type) -ENDIF(CMAKE_COMPILER_IS_GNUCC) -IF(CMAKE_COMPILER_IS_GNUCXX) - FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bdynamic") - ENDFOREACH(type) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) - # The Sun linker needs to find transitive shared library dependencies # in the -L path. SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index ea64b781d..025ae5102 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -33,7 +33,7 @@ GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH) # search types. LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH # Standard - /usr/local / /usr + /usr/local /usr / # CMake install location "${_CMAKE_INSTALL_DIR}" diff --git a/Modules/Platform/Windows-GNU-C.cmake b/Modules/Platform/Windows-GNU-C.cmake new file mode 100644 index 000000000..ecf89dc1b --- /dev/null +++ b/Modules/Platform/Windows-GNU-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(C) diff --git a/Modules/Platform/Windows-GNU-CXX.cmake b/Modules/Platform/Windows-GNU-CXX.cmake new file mode 100644 index 000000000..23e655229 --- /dev/null +++ b/Modules/Platform/Windows-GNU-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(CXX) diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake new file mode 100644 index 000000000..c66feedbb --- /dev/null +++ b/Modules/Platform/Windows-GNU-Fortran.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-GNU) +__windows_compiler_gnu(Fortran) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake new file mode 100644 index 000000000..6d8494073 --- /dev/null +++ b/Modules/Platform/Windows-GNU.cmake @@ -0,0 +1,79 @@ + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_GNU) + return() +endif() +set(__WINDOWS_GNU 1) + +set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_MODULE_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") + +set(CMAKE_EXECUTABLE_SUFFIX ".exe") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") +set(CMAKE_SHARED_MODULE_SUFFIX ".dll") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +if(MSYS OR MINGW) + set(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib +endif() + +if(MINGW) + set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") + set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") +endif() + +set(CMAKE_DL_LIBS "") +set(CMAKE_LIBRARY_PATH_FLAG "-L") +set(CMAKE_LINK_LIBRARY_FLAG "-l") +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_CREATE_WIN32_EXE "-mwindows") + +set(CMAKE_GNULD_IMAGE_VERSION + "-Wl,--major-image-version,,--minor-image-version,") + +macro(__windows_compiler_gnu lang) + + if(MSYS OR MINGW) + # Create archiving rules to support large object file lists for static libraries. + set(CMAKE_${lang}_ARCHIVE_CREATE " cr ") + set(CMAKE_${lang}_ARCHIVE_APPEND " r ") + set(CMAKE_${lang}_ARCHIVE_FINISH " ") + + # Initialize C link type selection flags. These flags are used when + # building a shared library, shared module, or executable that links + # to other libraries to select whether to use the static or shared + # versions of the libraries. + foreach(type SHARED_LIBRARY SHARED_MODULE EXE) + set(CMAKE_${type}_LINK_STATIC_${lang}_FLAGS "-Wl,-Bstatic") + set(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") + endforeach(type) + endif() + + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows + + # Binary link rules. + set(CMAKE_${lang}_CREATE_SHARED_MODULE + " -o ${CMAKE_GNULD_IMAGE_VERSION} ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") + set(CMAKE_${lang}_LINK_EXECUTABLE + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") +endmacro() diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake old mode 100755 new mode 100644 diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 303ef3472..e369ac159 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -141,32 +141,14 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") SET(CMAKE_USING_VC_FREE_TOOLS 0) ENDIF(CMAKE_COMPILER_RETURN) MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") - MESSAGE(STATUS "Check CL platform") - EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3 - ARGS /nologo - \"${testForFreeVCFile}\" - /link /machine:i386 - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT - RETURN_VALUE CMAKE_COMPILER_RETURN - ) - # if there was an error assume it is a 64bit system - IF(CMAKE_COMPILER_RETURN) - FILE(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if this is a 64 bit system passed:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - MESSAGE(STATUS "Check CL platform - 64 bit") - SET(CMAKE_CL_64 1) - ELSE(CMAKE_COMPILER_RETURN) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if this is a 32 bit system passed:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - MESSAGE(STATUS "Check CL platform - 32 bit") - SET(CMAKE_CL_64 0) - ENDIF(CMAKE_COMPILER_RETURN) ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") +IF(MSVC_C_ARCHITECTURE_ID MATCHES 64) + SET(CMAKE_CL_64 1) +ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64) + SET(CMAKE_CL_64 0) +ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64) IF(CMAKE_FORCE_WIN64) SET(CMAKE_CL_64 1) ENDIF(CMAKE_FORCE_WIN64) @@ -235,13 +217,12 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") # set the stack size and the machine type -IF(CMAKE_CL_64) - SET (CMAKE_EXE_LINKER_FLAGS_INIT - "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:x64") -ELSE(CMAKE_CL_64) - SET (CMAKE_EXE_LINKER_FLAGS_INIT - "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:I386") -ENDIF(CMAKE_CL_64) +SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) +IF(NOT _MACHINE_ARCH_FLAG) + SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) +ENDIF(NOT _MACHINE_ARCH_FLAG) +SET (CMAKE_EXE_LINKER_FLAGS_INIT + "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp # on versions that support it diff --git a/Modules/Platform/Windows-g77.cmake b/Modules/Platform/Windows-g77.cmake deleted file mode 100644 index ed3a07332..000000000 --- a/Modules/Platform/Windows-g77.cmake +++ /dev/null @@ -1,24 +0,0 @@ -SET(CMAKE_LINK_LIBRARY_SUFFIX "") -SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -SET(CMAKE_SHARED_MODULE_PREFIX "lib") # lib -SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") # .so -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty -SET(CMAKE_LIBRARY_PATH_FLAG "-L") -SET(CMAKE_LINK_LIBRARY_FLAG "-l") -SET (CMAKE_Fortran_FLAGS_INIT "") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O1") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O2") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-02 -g") - -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") diff --git a/Modules/Platform/Windows-gcc.cmake b/Modules/Platform/Windows-gcc.cmake deleted file mode 100644 index 73c10c135..000000000 --- a/Modules/Platform/Windows-gcc.cmake +++ /dev/null @@ -1,74 +0,0 @@ -SET(CMAKE_LINK_LIBRARY_SUFFIX "") -SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") -SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") -SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib -SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so -SET(CMAKE_SHARED_MODULE_PREFIX "lib") # lib -SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") # .so -SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") -SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") -SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe -SET(CMAKE_DL_LIBS "") -SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty - -SET(CMAKE_SHARED_MODULE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") # -pic -SET(CMAKE_SHARED_MODULE_CXX_FLAGS - "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") # -pic -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS - "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}") # -shared -SET(CMAKE_LIBRARY_PATH_FLAG "-L") -SET(CMAKE_LINK_LIBRARY_FLAG "-l") -SET(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib -SET(CMAKE_CREATE_WIN32_EXE "-mwindows") - -IF(MINGW) - SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") - SET (CMAKE_C_STANDARD_LIBRARIES_INIT "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32") - SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") -ENDIF(MINGW) - -SET(CMAKE_GNULD_IMAGE_VERSION - "-Wl,--major-image-version,,--minor-image-version,") - -SET(CMAKE_C_CREATE_SHARED_MODULE - " -o ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -o ${CMAKE_GNULD_IMAGE_VERSION} ") - -SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") - -SET(CMAKE_C_LINK_EXECUTABLE - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") -SET(CMAKE_CXX_LINK_EXECUTABLE - " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") - -# Initialize C link type selection flags. These flags are used when -# building a shared library, shared module, or executable that links -# to other libraries to select whether to use the static or shared -# versions of the libraries. -IF(MSYS OR MINGW) - FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) - SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") - SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") - ENDFOREACH(type) -ENDIF(MSYS OR MINGW) - -# Create archiving rules to support large object file lists for static -# libraries. -IF(MSYS OR MINGW) - SET(CMAKE_C_ARCHIVE_CREATE " cr ") - SET(CMAKE_C_ARCHIVE_APPEND " r ") - SET(CMAKE_C_ARCHIVE_FINISH " ") - SET(CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE}) - SET(CMAKE_CXX_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND}) - SET(CMAKE_CXX_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH}) -ENDIF(MSYS OR MINGW) diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake index 2f1ef2913..c717c7c1c 100644 --- a/Modules/Platform/Windows-icl.cmake +++ b/Modules/Platform/Windows-icl.cmake @@ -71,7 +71,11 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") # executable linker flags SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES") +SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) +IF(NOT _MACHINE_ARCH_FLAG) + SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) +ENDIF(NOT _MACHINE_ARCH_FLAG) +SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}") SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") @@ -82,6 +86,7 @@ SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + INCLUDE(Platform/Windows-Intel) IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 87a61d56e..b260489d6 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -27,11 +27,11 @@ SET (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib l SET (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") SET(CMAKE_C_CREATE_IMPORT_LIBRARY - "wlib -q -n -b +") + "wlib -q -n -b +''") SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) SET(CMAKE_C_LINK_EXECUTABLE - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name option caseexact file {} ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) @@ -52,7 +52,7 @@ SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_MODULE - "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name option caseexact file {} ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_MODULE} ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) @@ -64,7 +64,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b ") +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '' ") # create a C static library SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) diff --git a/Modules/Platform/g77.cmake b/Modules/Platform/g77.cmake deleted file mode 100644 index 8f7d448ce..000000000 --- a/Modules/Platform/g77.cmake +++ /dev/null @@ -1,7 +0,0 @@ -IF(CMAKE_COMPILER_IS_GNUG77) - SET (CMAKE_Fortran_FLAGS_INIT "") - SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") -ENDIF(CMAKE_COMPILER_IS_GNUG77) diff --git a/Modules/Platform/gcc.cmake b/Modules/Platform/gcc.cmake deleted file mode 100644 index 8c385cee7..000000000 --- a/Modules/Platform/gcc.cmake +++ /dev/null @@ -1,27 +0,0 @@ -IF(CMAKE_COMPILER_IS_GNUCC) - SET (CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic - SET (CMAKE_C_FLAGS_INIT "") - SET (CMAKE_C_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") - SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") - IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") - ENDIF(NOT APPLE) -ENDIF(CMAKE_COMPILER_IS_GNUCC) - -IF(CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic - SET (CMAKE_CXX_FLAGS_INIT "") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") - SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") - IF(NOT APPLE) - SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") - ENDIF(NOT APPLE) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake index 2bcaf8cd5..3ce42f6a6 100644 --- a/Modules/Platform/syllable.cmake +++ b/Modules/Platform/syllable.cmake @@ -14,9 +14,7 @@ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") #SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -#SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake new file mode 100644 index 000000000..1c5293d1a --- /dev/null +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -0,0 +1,373 @@ +# This file is included by FindQt4.cmake, don't include it directly. + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + + +############################################### +# +# configuration/system dependent settings +# +############################################### + +# find dependencies for some Qt modules +# when doing builds against a static Qt, they are required +# when doing builds against a shared Qt, they are not required +# if a user needs the dependencies, and they couldn't be found, they can set +# the variables themselves. + +SET(QT_QTGUI_LIB_DEPENDENCIES "") +SET(QT_QTCORE_LIB_DEPENDENCIES "") +SET(QT_QTNETWORK_LIB_DEPENDENCIES "") +SET(QT_QTOPENGL_LIB_DEPENDENCIES "") +SET(QT_QTDBUS_LIB_DEPENDENCIES "") +SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) + + +IF(WIN32) + # On Windows, qconfig.pri has "static" for static library builds + IF(QT_CONFIG MATCHES "static") + SET(QT_IS_STATIC 1) + ENDIF(QT_CONFIG MATCHES "static") +ELSE(WIN32) + # On other platforms, check file extension to know if its static + IF(QT_QTCORE_LIBRARY_RELEASE) + GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT) + IF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") + SET(QT_IS_STATIC 1) + ENDIF("${qtcore_lib_ext}" STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}") + ENDIF(QT_QTCORE_LIBRARY_RELEASE) + IF(QT_QTCORE_LIBRARY_DEBUG) + GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_DEBUG}" EXT) + IF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) + SET(QT_IS_STATIC 1) + ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) + ENDIF(QT_QTCORE_LIBRARY_DEBUG) +ENDIF(WIN32) + +# build using shared Qt needs -DQT_DLL on Windows +IF(WIN32 AND NOT QT_IS_STATIC) + SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) +ENDIF(WIN32 AND NOT QT_IS_STATIC) + + +# QtOpenGL dependencies +QT_QUERY_QMAKE(QMAKE_LIBS_OPENGL "QMAKE_LIBS_OPENGL") +IF(Q_WS_MAC) +# On the Mac OpenGL is probably frameworks and QMAKE_LIBS_OPENGL can be +# e.g. "-framework OpenGL -framework AGL". The separate_arguments() call in +# the other branch makes "-framework;-OpenGL;-framework;-lAGL" appear in the +# linker command. So we need to protect the "-framework foo" as +# non-separatable strings. We do this by replacing the space after +# "-framework" with an underscore, then calling separate_arguments(), and +# then we replace the underscores again with spaces. So we get proper linker +# commands. Alex + STRING(REGEX REPLACE "-framework +" "-framework_" QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}") + SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL) + STRING(REGEX REPLACE "-framework_" "-framework " QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}") +ELSE(Q_WS_MAC) + SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL) +ENDIF(Q_WS_MAC) +SET (QT_QTOPENGL_LIB_DEPENDENCIES ${QT_QTOPENGL_LIB_DEPENDENCIES} ${QMAKE_LIBS_OPENGL}) + + +## system png +IF(QT_QCONFIG MATCHES "system-png") + FIND_LIBRARY(QT_PNG_LIBRARY NAMES png) + MARK_AS_ADVANCED(QT_PNG_LIBRARY) + IF(QT_PNG_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY}) + ENDIF(QT_PNG_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "system-png") + + +# for X11, get X11 library directory +IF(Q_WS_X11) + QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11") +ENDIF(Q_WS_X11) + + +## X11 SM +IF(QT_QCONFIG MATCHES "x11sm") + # ask qmake where the x11 libs are + FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) + FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_X11_SM_LIBRARY) + MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY) + IF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) + ENDIF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "x11sm") + + +## Xi +IF(QT_QCONFIG MATCHES "tablet") + FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_XI_LIBRARY) + IF(QT_XI_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) + ENDIF(QT_XI_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "tablet") + + +## Xrender +IF(QT_QCONFIG MATCHES "xrender") + FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) + IF(QT_XRENDER_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) + ENDIF(QT_XRENDER_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "xrender") + + +## Xrandr +IF(QT_QCONFIG MATCHES "xrandr") + FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) + IF(QT_XRANDR_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) + ENDIF(QT_XRANDR_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "xrandr") + + +## Xcursor +IF(QT_QCONFIG MATCHES "xcursor") + FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) + IF(QT_XCURSOR_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) + ENDIF(QT_XCURSOR_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "xcursor") + + +## Xinerama +IF(QT_QCONFIG MATCHES "xinerama") + FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) + IF(QT_XINERAMA_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) + ENDIF(QT_XINERAMA_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "xinerama") + + +## Xfixes +IF(QT_QCONFIG MATCHES "xfixes") + FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(QT_XFIXES_LIBRARY) + IF(QT_XFIXES_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY}) + ENDIF(QT_XFIXES_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "xfixes") + + +## system-freetype +IF(QT_QCONFIG MATCHES "system-freetype") + FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype) + MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY) + IF(QT_FREETYPE_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY}) + ENDIF(QT_FREETYPE_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "system-freetype") + + +## fontconfig +IF(QT_QCONFIG MATCHES "fontconfig") + FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig) + MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY) + IF(QT_FONTCONFIG_LIBRARY) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY}) + ENDIF(QT_FONTCONFIG_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "fontconfig") + + +## system-zlib +IF(QT_QCONFIG MATCHES "system-zlib") + FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z) + MARK_AS_ADVANCED(QT_ZLIB_LIBRARY) + IF(QT_ZLIB_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY}) + ENDIF(QT_ZLIB_LIBRARY) +ENDIF(QT_QCONFIG MATCHES "system-zlib") + + +## openssl +IF(NOT Q_WS_WIN) + SET(_QT_NEED_OPENSSL 0) + IF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") + SET(_QT_NEED_OPENSSL 1) + ENDIF(QT_VERSION_MINOR LESS 4 AND QT_QCONFIG MATCHES "openssl") + IF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") + SET(_QT_NEED_OPENSSL 1) + ENDIF(QT_VERSION_MINOR GREATER 3 AND QT_QCONFIG MATCHES "openssl-linked") + IF(_QT_NEED_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_LIBRARIES) + SET(QT_QTNETWORK_LIB_DEPENDENCIES ${QT_QTNETWORK_LIB_DEPENDENCIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_LIBRARIES) + ENDIF(_QT_NEED_OPENSSL) +ENDIF(NOT Q_WS_WIN) + + +## dbus +IF(QT_QCONFIG MATCHES "dbus") + + # if the dbus library isn't found, we'll assume its not required to build + # shared Qt on Linux doesn't require it + IF(NOT QT_DBUS_LIBRARY) + EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1 + OUTPUT_VARIABLE _dbus_query_output + RESULT_VARIABLE _dbus_result + ERROR_VARIABLE _dbus_query_output ) + + IF(_dbus_result MATCHES 0) + STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}") + SEPARATE_ARGUMENTS(_dbus_query_output) + ELSE(_dbus_result MATCHES 0) + SET(_dbus_query_output) + ENDIF(_dbus_result MATCHES 0) + + FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} ) + + IF(QT_DBUS_LIBRARY) + SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) + ENDIF(QT_DBUS_LIBRARY) + + MARK_AS_ADVANCED(QT_DBUS_LIBRARY) + ENDIF(NOT QT_DBUS_LIBRARY) + +ENDIF(QT_QCONFIG MATCHES "dbus") + + +## glib +IF(QT_QCONFIG MATCHES "glib") + + # if the glib libraries aren't found, we'll assume its not required to build + # shared Qt on Linux doesn't require it + + # Qt 4.2.0+ uses glib-2.0 + IF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) + EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L glib-2.0 gthread-2.0 + OUTPUT_VARIABLE _glib_query_output + RESULT_VARIABLE _glib_result + ERROR_VARIABLE _glib_query_output ) + + IF(_glib_result MATCHES 0) + STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") + SEPARATE_ARGUMENTS(_glib_query_output) + ELSE(_glib_result MATCHES 0) + SET(_glib_query_output) + ENDIF(_glib_result MATCHES 0) + + FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} ) + FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} ) + + MARK_AS_ADVANCED(QT_GLIB_LIBRARY) + MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) + ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) + + IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} + ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) + ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + + + # Qt 4.5+ also links to gobject-2.0 + IF(QT_VERSION_MINOR GREATER 4) + IF(NOT QT_GOBJECT_LIBRARY) + EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L gobject-2.0 + OUTPUT_VARIABLE _glib_query_output + RESULT_VARIABLE _glib_result + ERROR_VARIABLE _glib_query_output ) + + IF(_glib_result MATCHES 0) + STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") + SEPARATE_ARGUMENTS(_glib_query_output) + ELSE(_glib_result MATCHES 0) + SET(_glib_query_output) + ENDIF(_glib_result MATCHES 0) + + FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) + + MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) + ENDIF(NOT QT_GOBJECT_LIBRARY) + + IF(QT_GOBJECT_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} + ${QT_GOBJECT_LIBRARY}) + ENDIF(QT_GOBJECT_LIBRARY) + ENDIF(QT_VERSION_MINOR GREATER 4) + +ENDIF(QT_QCONFIG MATCHES "glib") + + +## clock-monotonic, just see if we need to link with rt +IF(QT_QCONFIG MATCHES "clock-monotonic") + SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + SET(CMAKE_REQUIRED_LIBRARIES rt) + CHECK_SYMBOL_EXISTS(_POSIX_TIMERS "unistd.h;time.h" QT_POSIX_TIMERS) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + IF(QT_POSIX_TIMERS) + FIND_LIBRARY(QT_RT_LIBRARY NAMES rt) + MARK_AS_ADVANCED(QT_RT_LIBRARY) + IF(QT_RT_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY}) + ENDIF(QT_RT_LIBRARY) + ENDIF(QT_POSIX_TIMERS) +ENDIF(QT_QCONFIG MATCHES "clock-monotonic") + + +IF(Q_WS_X11) + # X11 libraries Qt absolutely depends on + QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11") + SEPARATE_ARGUMENTS(QT_LIBS_X11) + FOREACH(QT_X11_LIB ${QT_LIBS_X11}) + STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") + SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") + FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) + MARK_AS_ADVANCED(${QT_TMP_STR}) + IF(${QT_TMP_STR}) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) + ENDIF(${QT_TMP_STR}) + ENDFOREACH(QT_X11_LIB) + + QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) + + QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD") + SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD}) + +ENDIF(Q_WS_X11) + + +IF(Q_WS_WIN) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32) +ENDIF(Q_WS_WIN) + + +IF(Q_WS_MAC) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon") + + # Qt 4.0, 4.1, 4.2 use QuickTime + IF(QT_VERSION_MINOR LESS 3) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework QuickTime") + ENDIF(QT_VERSION_MINOR LESS 3) + + # Qt 4.2+ use AppKit + IF(QT_VERSION_MINOR GREATER 1) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework AppKit") + ENDIF(QT_VERSION_MINOR GREATER 1) + + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices") +ENDIF(Q_WS_MAC) + diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake new file mode 100644 index 000000000..bd72c8f64 --- /dev/null +++ b/Modules/Qt4Macros.cmake @@ -0,0 +1,399 @@ +# This file is included by FindQt4.cmake, don't include it directly. + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + + +###################################### +# +# Macros for building Qt files +# +###################################### + + +MACRO (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options) + SET(${_qt4_files}) + SET(${_qt4_options}) + SET(_QT4_DOING_OPTIONS FALSE) + FOREACH(_currentArg ${ARGN}) + IF ("${_currentArg}" STREQUAL "OPTIONS") + SET(_QT4_DOING_OPTIONS TRUE) + ELSE ("${_currentArg}" STREQUAL "OPTIONS") + IF(_QT4_DOING_OPTIONS) + LIST(APPEND ${_qt4_options} "${_currentArg}") + ELSE(_QT4_DOING_OPTIONS) + LIST(APPEND ${_qt4_files} "${_currentArg}") + ENDIF(_QT4_DOING_OPTIONS) + ENDIF ("${_currentArg}" STREQUAL "OPTIONS") + ENDFOREACH(_currentArg) +ENDMACRO (QT4_EXTRACT_OPTIONS) + + +# macro used to create the names of output files preserving relative dirs +MACRO (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile ) + STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) + STRING(LENGTH ${infile} _infileLength) + SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) + IF(_infileLength GREATER _binlength) + STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile) + IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile}) + ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) + ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + ELSE(_infileLength GREATER _binlength) + FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) + ENDIF(_infileLength GREATER _binlength) + IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path + STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}") + ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:") + SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") + STRING(REPLACE ".." "__" _outfile ${_outfile}) + GET_FILENAME_COMPONENT(outpath ${_outfile} PATH) + GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE) + FILE(MAKE_DIRECTORY ${outpath}) + SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext}) +ENDMACRO (QT4_MAKE_OUTPUT_FILE ) + + +MACRO (QT4_GET_MOC_FLAGS _moc_flags) + SET(${_moc_flags}) + GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) + + FOREACH(_current ${_inc_DIRS}) + IF("${_current}" MATCHES ".framework/?$") + STRING(REGEX REPLACE "/[^/]+.framework" "" framework_path "${_current}") + SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") + ELSE("${_current}" MATCHES ".framework/?$") + SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") + ENDIF("${_current}" MATCHES ".framework/?$") + ENDFOREACH(_current ${_inc_DIRS}) + + GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) + FOREACH(_current ${_defines}) + SET(${_moc_flags} ${${_moc_flags}} "-D${_current}") + ENDFOREACH(_current ${_defines}) + + IF(Q_WS_WIN) + SET(${_moc_flags} ${${_moc_flags}} -DWIN32) + ENDIF(Q_WS_WIN) + +ENDMACRO(QT4_GET_MOC_FLAGS) + + +# helper macro to set up a moc rule +MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) + # For Windows, create a parameters file to work around command line length limit + IF (WIN32) + # Pass the parameters in a file. Set the working directory to + # be that containing the parameters file and reference it by + # just the file name. This is necessary because the moc tool on + # MinGW builds does not seem to handle spaces in the path to the + # file given with the @ syntax. + GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME) + GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH) + IF(_moc_outfile_dir) + SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) + ENDIF(_moc_outfile_dir) + SET (_moc_parameters_file ${outfile}_parameters) + SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") + FILE (REMOVE ${_moc_parameters_file}) + FOREACH(arg ${_moc_parameters}) + FILE (APPEND ${_moc_parameters_file} "${arg}\n") + ENDFOREACH(arg) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters + DEPENDS ${infile} + ${_moc_working_dir} + VERBATIM) + ELSE (WIN32) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} + DEPENDS ${infile}) + ENDIF (WIN32) +ENDMACRO (QT4_CREATE_MOC_COMMAND) + + +MACRO (QT4_GENERATE_MOC infile outfile ) +# get include dirs and flags + QT4_GET_MOC_FLAGS(moc_flags) + GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE) + QT4_CREATE_MOC_COMMAND(${abs_infile} ${outfile} "${moc_flags}" "") + SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file +ENDMACRO (QT4_GENERATE_MOC) + + +# QT4_WRAP_CPP(outfiles inputfile ... ) + +MACRO (QT4_WRAP_CPP outfiles ) + # get include dirs + QT4_GET_MOC_FLAGS(moc_flags) + QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN}) + + FOREACH (it ${moc_files}) + GET_FILENAME_COMPONENT(it ${it} ABSOLUTE) + QT4_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile) + QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}") + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH(it) + +ENDMACRO (QT4_WRAP_CPP) + + +# QT4_WRAP_UI(outfiles inputfile ... ) + +MACRO (QT4_WRAP_UI outfiles ) + QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN}) + + FOREACH (it ${ui_files}) + GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) + GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_UIC_EXECUTABLE} + ARGS ${ui_options} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH (it) + +ENDMACRO (QT4_WRAP_UI) + + +# QT4_ADD_RESOURCES(outfiles inputfile ... ) + +MACRO (QT4_ADD_RESOURCES outfiles ) + QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN}) + + FOREACH (it ${rcc_files}) + GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE) + GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) + GET_FILENAME_COMPONENT(rc_path ${infile} PATH) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) + # parse file for dependencies + # all files are absolute paths or relative to the location of the qrc file + FILE(READ "${infile}" _RC_FILE_CONTENTS) + STRING(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") + STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}") + IF(NOT _ABS_PATH_INDICATOR) + SET(_RC_FILE "${rc_path}/${_RC_FILE}") + ENDIF(NOT _ABS_PATH_INDICATOR) + SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") + ENDFOREACH(_RC_FILE) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_RCC_EXECUTABLE} + ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} + DEPENDS ${_RC_DEPENDS}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH (it) + +ENDMACRO (QT4_ADD_RESOURCES) + + +MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) + GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE) + SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + + # handling more arguments (as in FindQt4.cmake from KDE4) will come soon, then + # _params will be used for more than just -m + SET(_params -m) + + ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile} + DEPENDS ${_infile}) + + SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) + + QT4_GENERATE_MOC(${_header} ${_moc}) + + SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) + MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) + +ENDMACRO(QT4_ADD_DBUS_INTERFACE) + + +MACRO(QT4_ADD_DBUS_INTERFACES _sources) + FOREACH (_current_FILE ${ARGN}) + GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE) + # get the part before the ".xml" suffix + STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE}) + STRING(TOLOWER ${_basename} _basename) + QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface) + ENDFOREACH (_current_FILE) +ENDMACRO(QT4_ADD_DBUS_INTERFACES) + + +MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options ) + QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN}) + + GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE) + GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) + + IF (_customName) + SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + ELSE (_customName) + SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) + ENDIF (_customName) + + ADD_CUSTOM_COMMAND(OUTPUT ${_target} + COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} -o ${_target} + DEPENDS ${_in_file} + ) +ENDMACRO(QT4_GENERATE_DBUS_INTERFACE) + + +MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName) + GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE) + + SET(_optionalBasename "${ARGV4}") + IF (_optionalBasename) + SET(_basename ${_optionalBasename} ) + ELSE (_optionalBasename) + STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile}) + STRING(TOLOWER ${_basename} _basename) + ENDIF (_optionalBasename) + + SET(_optionalClassName "${ARGV5}") + SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + + IF(_optionalClassName) + ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} + DEPENDS ${_infile} + ) + ELSE(_optionalClassName) + ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} + DEPENDS ${_infile} + ) + ENDIF(_optionalClassName) + + QT4_GENERATE_MOC(${_header} ${_moc}) + SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) + MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) + + SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) +ENDMACRO(QT4_ADD_DBUS_ADAPTOR) + + +MACRO(QT4_AUTOMOC) + QT4_GET_MOC_FLAGS(_moc_INCS) + + SET(_matching_FILES ) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # This is required to make uic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) + + IF ( NOT _skip AND EXISTS ${_abs_FILE} ) + + FILE(READ ${_abs_FILE} _contents) + + GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) + + STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") + IF(_match) + FOREACH (_current_MOC_INC ${_match}) + STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + + GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) + IF(EXISTS ${_abs_PATH}/${_basename}.hpp) + SET(_header ${_abs_PATH}/${_basename}.hpp) + ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp) + SET(_header ${_abs_PATH}/${_basename}.h) + ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) + QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") + MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) + ENDFOREACH (_current_MOC_INC) + ENDIF(_match) + ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} ) + ENDFOREACH (_current_FILE) +ENDMACRO(QT4_AUTOMOC) + + +MACRO(QT4_CREATE_TRANSLATION _qm_files) + QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN}) + SET(_my_sources) + SET(_my_dirs) + SET(_my_tsfiles) + SET(_ts_pro) + FOREACH (_file ${_lupdate_files}) + GET_FILENAME_COMPONENT(_ext ${_file} EXT) + GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE) + IF(_ext MATCHES "ts") + LIST(APPEND _my_tsfiles ${_abs_FILE}) + ELSE(_ext MATCHES "ts") + IF(NOT _ext) + LIST(APPEND _my_dirs ${_abs_FILE}) + ELSE(NOT _ext) + LIST(APPEND _my_sources ${_abs_FILE}) + ENDIF(NOT _ext) + ENDIF(_ext MATCHES "ts") + ENDFOREACH(_file) + FOREACH(_ts_file ${_my_tsfiles}) + IF(_my_sources) + # make a .pro file to call lupdate on, so we don't make our commands too + # long for some systems + GET_FILENAME_COMPONENT(_ts_name ${_ts_file} NAME_WE) + SET(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) + SET(_pro_srcs) + FOREACH(_pro_src ${_my_sources}) + SET(_pro_srcs "${_pro_srcs} \"${_pro_src}\"") + ENDFOREACH(_pro_src ${_my_sources}) + FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}") + ENDIF(_my_sources) + ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file} + COMMAND ${QT_LUPDATE_EXECUTABLE} + ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file} + DEPENDS ${_my_sources} ${_ts_pro}) + ENDFOREACH(_ts_file) + QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles}) +ENDMACRO(QT4_CREATE_TRANSLATION) + + +MACRO(QT4_ADD_TRANSLATION _qm_files) + FOREACH (_current_FILE ${ARGN}) + GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + GET_FILENAME_COMPONENT(qm ${_abs_FILE} NAME_WE) + GET_SOURCE_FILE_PROPERTY(output_location ${_abs_FILE} OUTPUT_LOCATION) + IF(output_location) + FILE(MAKE_DIRECTORY "${output_location}") + SET(qm "${output_location}/${qm}.qm") + ELSE(output_location) + SET(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm") + ENDIF(output_location) + + ADD_CUSTOM_COMMAND(OUTPUT ${qm} + COMMAND ${QT_LRELEASE_EXECUTABLE} + ARGS ${_abs_FILE} -qm ${qm} + DEPENDS ${_abs_FILE} + ) + SET(${_qm_files} ${${_qm_files}} ${qm}) + ENDFOREACH (_current_FILE) +ENDMACRO(QT4_ADD_TRANSLATION) diff --git a/Modules/SquishRunTestCase.bat b/Modules/SquishRunTestCase.bat old mode 100644 new mode 100755 index 293e88f8f..5c5d388b0 --- a/Modules/SquishRunTestCase.bat +++ b/Modules/SquishRunTestCase.bat @@ -1,11 +1,11 @@ -echo 'Starting the squish server...' -start %1 - -echo 'Running the test case...' -%2 --testcase %3 --wrapper %4 --aut %5 -set result=%ERRORLEVEL% - -echo 'Stopping the squish server...' -%1 --stop - -exit \b %result% +echo 'Starting the squish server...' +start %1 + +echo 'Running the test case...' +%2 --testcase %3 --wrapper %4 --aut %5 +set result=%ERRORLEVEL% + +echo 'Stopping the squish server...' +%1 --stop + +exit \b %result% diff --git a/Modules/SystemInformation.in b/Modules/SystemInformation.in old mode 100755 new mode 100644 index 7722da0e0..f2aef5055 --- a/Modules/SystemInformation.in +++ b/Modules/SystemInformation.in @@ -34,8 +34,6 @@ CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_C_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_DYNAMI // C shared module flags CMAKE_SHARED_MODULE_C_FLAGS == "${CMAKE_SHARED_MODULE_C_FLAGS}" CMAKE_SHARED_MODULE_CREATE_C_FLAGS == "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}" -CMAKE_SHARED_MODULE_RUNTIME_FLAG == "${CMAKE_SHARED_MODULE_RUNTIME_FLAG}" -CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP == "${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP}" CMAKE_SHARED_MODULE_LINK_STATIC_C_FLAGS == "${CMAKE_SHARED_MODULE_LINK_STATIC_C_FLAGS}" CMAKE_SHARED_MODULE_LINK_DYNAMIC_C_FLAGS == "${CMAKE_SHARED_MODULE_LINK_DYNAMIC_C_FLAGS}" @@ -55,8 +53,6 @@ CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_SHARED_LIBRARY_LINK_DYNA // CXX shared module flags CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS == "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS}" CMAKE_SHARED_MODULE_CXX_FLAGS == "${CMAKE_SHARED_MODULE_CXX_FLAGS}" -CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG == "${CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG}" -CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP == "${CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP}" CMAKE_SHARED_MODULE_LINK_STATIC_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_STATIC_CXX_FLAGS}" CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS == "${CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS}" diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index f92500bd0..b7b6d59ad 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -23,9 +23,6 @@ SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_ SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR}) -IF(Q_WS_MAC AND QT_USE_FRAMEWORKS) - INCLUDE_DIRECTORIES(${QT_QTCORE_LIBRARY}) -ENDIF(Q_WS_MAC AND QT_USE_FRAMEWORKS) SET(QT_LIBRARIES "") @@ -66,10 +63,12 @@ SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE) SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE) SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE) SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE) +SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE) +SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTWEBKIT QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTXML QTOPENGL QTGUI QTNETWORK QTCORE) # Qt modules (in order of dependence) FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN - QAXSERVER QAXCONTAINER QTSCRIPT QTSVG QTUITOOLS QTHELP + QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP QTWEBKIT PHONON QTSCRIPTTOOLS QTGUI QTTEST QTDBUS QTXML QTSQL QTXMLPATTERNS QTNETWORK QTCORE) @@ -80,7 +79,10 @@ FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB) INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR}) ENDIF(QT_USE_${module}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY} ${QT_${module}_LIB_DEPENDENCIES}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) + IF(QT_IS_STATIC) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES}) + ENDIF(QT_IS_STATIC) FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS}) SET(QT_USE_${depend_module}_DEPENDS 1) ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS}) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 909969139..09713efb8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -18,6 +18,8 @@ ELSE(HAVE_ELF_H) SET(CMAKE_USE_ELF_PARSER) ENDIF(HAVE_ELF_H) +SET(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) + # configure the .h file CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" @@ -165,6 +167,8 @@ SET(SRCS cmExportFileGenerator.cxx cmExportInstallFileGenerator.h cmExportInstallFileGenerator.cxx + cmExtraCodeBlocksGenerator.cxx + cmExtraCodeBlocksGenerator.h cmExtraEclipseCDT4Generator.cxx cmExtraEclipseCDT4Generator.h cmFileTimeComparison.cxx @@ -244,6 +248,9 @@ SET(SRCS cmake.h cmakewizard.cxx cmakewizard.h + + cm_utf8.h + cm_utf8.c ) # Kdevelop only works on UNIX and not windows @@ -251,10 +258,6 @@ IF(UNIX) SET(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx) ENDIF(UNIX) -IF(NOT CYGWIN) - SET(SRCS ${SRCS} cmExtraCodeBlocksGenerator.cxx) -ENDIF(NOT CYGWIN) - # XCode only works on apple IF(APPLE) SET(SRCS ${SRCS} @@ -281,6 +284,8 @@ IF (WIN32) cmGlobalMinGWMakefileGenerator.cxx cmGlobalNMakeMakefileGenerator.cxx cmGlobalNMakeMakefileGenerator.h + cmGlobalJOMMakefileGenerator.cxx + cmGlobalJOMMakefileGenerator.h cmGlobalVisualStudio6Generator.cxx cmGlobalVisualStudio6Generator.h cmGlobalVisualStudio71Generator.cxx @@ -417,12 +422,12 @@ SET(CPACK_SRCS CPack/cmCPackZIPGenerator.cxx ) -IF(WIN32 AND UNIX) +IF(CYGWIN) SET(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackCygwinBinaryGenerator.cxx CPack/cmCPackCygwinSourceGenerator.cxx ) -ENDIF(WIN32 AND UNIX) +ENDIF(CYGWIN) IF(UNIX) SET(CPACK_SRCS ${CPACK_SRCS} @@ -456,8 +461,6 @@ ENDIF(APPLE) # Build CMake executable ADD_EXECUTABLE(cmake cmakemain.cxx) TARGET_LINK_LIBRARIES(cmake CMakeLib) -ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation) -TARGET_LINK_LIBRARIES(DumpDocumentation CMakeLib) # Build special executable for running programs on Windows 98 IF(WIN32) diff --git a/Source/CPack/cygwin.readme b/Source/CPack/cygwin.readme old mode 100755 new mode 100644 diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index d8ec9cdd5..55b8d5b75 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -276,12 +276,14 @@ private: && !this->CData.empty()) { this->CurChange.Path.assign(&this->CData[0], this->CData.size()); + cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "symlink") == 0 && !this->CData.empty()) { // symlinks have an arobase at the end in the log this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1); + cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "committer") == 0 && !this->CData.empty()) @@ -377,9 +379,10 @@ private: return true; } - void DoPath(char c0, char c1, char c2, std::string const& path) + void DoPath(char c0, char c1, char c2, std::string path) { if(path.empty()) return; + cmSystemTools::ConvertToUnixSlashes(path); const std::string dir = cmSystemTools::GetFilenamePath(path); const std::string name = cmSystemTools::GetFilenameName(path); @@ -488,9 +491,10 @@ private: return true; } - void DoPath(char c0, char c1, char c2, std::string const& path) + void DoPath(char c0, char c1, char c2, std::string path) { if(path.empty()) return; + cmSystemTools::ConvertToUnixSlashes(path); if ( c0=='C' ) { diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 3fe1c0002..b984e850f 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -23,7 +23,11 @@ cmCTestBuildCommand::cmCTestBuildCommand() { this->GlobalGenerator = 0; this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS"; - this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS"; + this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS"; + this->Arguments[ctb_TARGET] = "TARGET"; + this->Arguments[ctb_CONFIGURATION] = "CONFIGURATION"; + this->Arguments[ctb_FLAGS] = "FLAGS"; + this->Arguments[ctb_PROJECT_NAME] = "PROJECT_NAME"; this->Arguments[ctb_LAST] = 0; this->Last = ctb_LAST; } @@ -49,6 +53,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() return 0; } this->Handler = (cmCTestBuildHandler*)handler; + const char* ctestBuildCommand = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); if ( ctestBuildCommand && *ctestBuildCommand ) @@ -60,13 +65,33 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() const char* cmakeGeneratorName = this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR"); const char* cmakeProjectName - = this->Makefile->GetDefinition("CTEST_PROJECT_NAME"); - const char* cmakeBuildConfiguration + = (this->Values[ctb_PROJECT_NAME] && *this->Values[ctb_PROJECT_NAME]) + ? this->Values[ctb_PROJECT_NAME] + : this->Makefile->GetDefinition("CTEST_PROJECT_NAME"); + + // Build configuration is determined by: CONFIGURATION argument, + // or CTEST_BUILD_CONFIGURATION script variable, or + // CTEST_CONFIGURATION_TYPE script variable, or ctest -C command + // line argument... in that order. + // + const char* ctestBuildConfiguration = this->Makefile->GetDefinition("CTEST_BUILD_CONFIGURATION"); + const char* cmakeBuildConfiguration + = (this->Values[ctb_CONFIGURATION] && *this->Values[ctb_CONFIGURATION]) + ? this->Values[ctb_CONFIGURATION] + : ((ctestBuildConfiguration && *ctestBuildConfiguration) + ? ctestBuildConfiguration + : this->CTest->GetConfigType().c_str()); + const char* cmakeBuildAdditionalFlags - = this->Makefile->GetDefinition("CTEST_BUILD_FLAGS"); + = (this->Values[ctb_FLAGS] && *this->Values[ctb_FLAGS]) + ? this->Values[ctb_FLAGS] + : this->Makefile->GetDefinition("CTEST_BUILD_FLAGS"); const char* cmakeBuildTarget - = this->Makefile->GetDefinition("CTEST_BUILD_TARGET"); + = (this->Values[ctb_TARGET] && *this->Values[ctb_TARGET]) + ? this->Values[ctb_TARGET] + : this->Makefile->GetDefinition("CTEST_BUILD_TARGET"); + if ( cmakeGeneratorName && *cmakeGeneratorName && cmakeProjectName && *cmakeProjectName ) { @@ -104,7 +129,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() } cmakeBuildConfiguration = config; } - + std::string buildCommand = this->GlobalGenerator-> GenerateBuildCommand(cmakeMakeProgram, @@ -119,10 +144,17 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() else { cmOStringStream ostr; - ostr << "CTEST_BUILD_COMMAND or CTEST_CMAKE_GENERATOR not specified. " - "Please specify the CTEST_CMAKE_GENERATOR and CTEST_PROJECT_NAME if " - "this is a CMake project, or specify the CTEST_BUILD_COMMAND for " - "cmake or any other project."; + ostr << "has no project to build. If this is a " + "\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR " + "and CTEST_PROJECT_NAME are set." + "\n" + "CTEST_PROJECT_NAME is usually set in CTestConfig.cmake. Verify " + "that CTestConfig.cmake exists, or CTEST_PROJECT_NAME " + "is set in the script, or PROJECT_NAME is passed as an argument " + "to ctest_build." + "\n" + "Alternatively, set CTEST_BUILD_COMMAND to build the project " + "with a custom command line."; this->SetError(ostr.str().c_str()); return 0; } diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 8122eeedf..228067e44 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -82,6 +82,10 @@ protected: ctb_BUILD = ct_LAST, ctb_NUMBER_ERRORS, ctb_NUMBER_WARNINGS, + ctb_TARGET, + ctb_CONFIGURATION, + ctb_FLAGS, + ctb_PROJECT_NAME, ctb_LAST }; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 0095bbccb..a125459a0 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -264,6 +264,32 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf) } } +//---------------------------------------------------------------------- +std::string cmCTestBuildHandler::GetMakeCommand() +{ + std::string makeCommand + = this->CTest->GetCTestConfiguration("MakeCommand"); + cmCTestLog(this->CTest, + HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << + "\n"); + + std::string configType = this->CTest->GetConfigType(); + if (configType == "") + { + configType + = this->CTest->GetCTestConfiguration("DefaultCTestConfigurationType"); + } + if (configType == "") + { + configType = "Release"; + } + + cmSystemTools::ReplaceString(makeCommand, + "${CTEST_CONFIGURATION_TYPE}", configType.c_str()); + + return makeCommand; +} + //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller //functions and commented... @@ -300,11 +326,7 @@ int cmCTestBuildHandler::ProcessHandler() } // Determine build command and build directory - const std::string &makeCommand - = this->CTest->GetCTestConfiguration("MakeCommand"); - cmCTestLog(this->CTest, - HANDLER_VERBOSE_OUTPUT, "MakeCommand:" << makeCommand << - "\n"); + std::string makeCommand = this->GetMakeCommand(); if ( makeCommand.size() == 0 ) { cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -312,6 +334,7 @@ int cmCTestBuildHandler::ProcessHandler() << std::endl); return -1; } + const std::string &buildDirectory = this->CTest->GetCTestConfiguration("BuildDirectory"); if ( buildDirectory.size() == 0 ) @@ -519,8 +542,7 @@ void cmCTestBuildHandler::GenerateXMLHeader(std::ostream& os) static_cast(this->StartBuildTime) << "\n" << "" - << cmXMLSafe( - this->CTest->GetCTestConfiguration("MakeCommand")) + << cmXMLSafe(this->GetMakeCommand()) << "" << std::endl; } diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index 7ee50be0b..439efd604 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -46,7 +46,10 @@ public: int GetTotalErrors() { return this->TotalErrors;} int GetTotalWarnings() { return this->TotalWarnings;} + private: + std::string GetMakeCommand(); + //! Run command specialized for make and configure. Returns process status // and retVal is return value or exception. int RunMakeCommand(const char* command, diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 00d9ec564..9a668bce1 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmCTestConfigureCommand.h" +#include "cmGlobalGenerator.h" #include "cmCTest.h" #include "cmCTestGenericHandler.h" @@ -66,6 +67,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() const char* ctestConfigureCommand = this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND"); + if ( ctestConfigureCommand && *ctestConfigureCommand ) { this->CTest->SetCTestConfiguration("ConfigureCommand", @@ -86,6 +88,29 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() "variable"); return 0; } + + const std::string cmakelists_file = source_dir + "/CMakeLists.txt"; + if ( !cmSystemTools::FileExists(cmakelists_file.c_str()) ) + { + cmOStringStream e; + e << "CMakeLists.txt file does not exist [" + << cmakelists_file << "]"; + this->SetError(e.str().c_str()); + return 0; + } + + bool multiConfig = false; + bool cmakeBuildTypeInOptions = false; + + cmGlobalGenerator *gg = + this->Makefile->GetCMakeInstance()->CreateGlobalGenerator( + cmakeGeneratorName); + if(gg) + { + multiConfig = gg->IsMultiConfig(); + delete gg; + } + std::string cmakeConfigureCommand = "\""; cmakeConfigureCommand += this->CTest->GetCMakeExecutable(); cmakeConfigureCommand += "\""; @@ -95,9 +120,24 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() for (it= options.begin(); it!=options.end(); ++it) { option = *it; + cmakeConfigureCommand += " \""; cmakeConfigureCommand += option; cmakeConfigureCommand += "\""; + + if ((0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE=")) || + (0 != strstr(option.c_str(), "CMAKE_BUILD_TYPE:STRING="))) + { + cmakeBuildTypeInOptions = true; + } + } + + if (!multiConfig && !cmakeBuildTypeInOptions && + !this->CTest->GetConfigType().empty()) + { + cmakeConfigureCommand += " \"-DCMAKE_BUILD_TYPE:STRING="; + cmakeConfigureCommand += this->CTest->GetConfigType(); + cmakeConfigureCommand += "\""; } cmakeConfigureCommand += " \"-G"; @@ -113,9 +153,9 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() } else { - this->SetError("Configure command is not specified. If this is a CMake " - "project, specify CTEST_CMAKE_GENERATOR, or if this is not CMake " - "project, specify CTEST_CONFIGURE_COMMAND."); + this->SetError("Configure command is not specified. If this is a " + "\"built with CMake\" project, set CTEST_CMAKE_GENERATOR. If not, " + "set CTEST_CONFIGURE_COMMAND."); return 0; } } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 5b0e8ff3b..6d5bf659c 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -19,6 +19,8 @@ #include #include +#include +#include #include //---------------------------------------------------------------------------- @@ -336,16 +338,28 @@ private: Person author; this->ParsePerson(this->Line.c_str()+7, author); this->Rev.Author = author.Name; - char buf[1024]; + + // Convert the time to a human-readable format that is also easy + // to machine-parse: "CCYY-MM-DD hh:mm:ss". + time_t seconds = static_cast(author.Time); + struct tm* t = gmtime(&seconds); + char dt[1024]; + sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year+1900, t->tm_mon+1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + this->Rev.Date = dt; + + // Add the time-zone field "+zone" or "-zone". + char tz[32]; if(author.TimeZone >= 0) { - sprintf(buf, "%lu +%04ld", author.Time, author.TimeZone); + sprintf(tz, " +%04ld", author.TimeZone); } else { - sprintf(buf, "%lu -%04ld", author.Time, -author.TimeZone); + sprintf(tz, " -%04ld", -author.TimeZone); } - this->Rev.Date = buf; + this->Rev.Date += tz; } } @@ -395,10 +409,16 @@ void cmCTestGIT::LoadRevisions() //---------------------------------------------------------------------------- void cmCTestGIT::LoadModifications() { - // Use 'git diff-index' to get modified files. const char* git = this->CommandLineTool.c_str(); - const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0}; + // Use 'git update-index' to refresh the index w.r.t. the work tree. + const char* git_update_index[] = {git, "update-index", "--refresh", 0}; + OutputLogger ui_out(this->Log, "ui-out> "); + OutputLogger ui_err(this->Log, "ui-err> "); + this->RunChild(git_update_index, &ui_out, &ui_err); + + // Use 'git diff-index' to get modified files. + const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0}; DiffParser out(this, "di-out> "); OutputLogger err(this->Log, "di-err> "); this->RunChild(git_diff_index, &out, &err); diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index 73a36da89..8c51102e5 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -106,6 +106,19 @@ void cmCTestGlobalVC::WriteXMLDirectory(std::ostream& xml, xml << "\t\n"; } +//---------------------------------------------------------------------------- +void cmCTestGlobalVC::WriteXMLGlobal(std::ostream& xml) +{ + if(!this->NewRevision.empty()) + { + xml << "\t" << this->NewRevision << "\n"; + } + if(!this->OldRevision.empty() && this->OldRevision != this->NewRevision) + { + xml << "\t" << this->OldRevision << "\n"; + } +} + //---------------------------------------------------------------------------- bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml) { @@ -117,6 +130,8 @@ bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml) this->LoadModifications(); + this->WriteXMLGlobal(xml); + for(std::map::const_iterator di = this->Dirs.begin(); di != this->Dirs.end(); ++di) { diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index d88016b60..a648a5982 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -60,6 +60,7 @@ protected: virtual void LoadModifications() = 0; virtual void LoadRevisions() = 0; + virtual void WriteXMLGlobal(std::ostream& xml); void WriteXMLDirectory(std::ostream& xml, std::string const& path, Directory const& dir); }; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 1c9f08061..1957e04e3 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -59,6 +59,17 @@ bool cmCTestHandlerCommand } } + // Set the config type of this ctest to the current value of the + // CTEST_CONFIGURATION_TYPE script variable if it is defined. + // The current script value trumps the -C argument on the command + // line. + const char* ctestConfigType = + this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE"); + if (ctestConfigType) + { + this->CTest->SetConfigType(ctestConfigType); + } + cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); cmCTestGenericHandler* handler = this->InitializeHandler(); if ( !handler ) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 336303ae0..b6226a3b7 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -43,8 +43,11 @@ cmCTestMultiProcessHandler::SetTests(TestMap& tests, this->TestRunningMap[i->first] = false; this->TestFinishMap[i->first] = false; } - this->ReadCostData(); - this->CreateTestCostList(); + if(!this->CTest->GetShowOnly()) + { + this->ReadCostData(); + this->CreateTestCostList(); + } } // Set the max number of tests that can be run at the same time. @@ -102,6 +105,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->RunningCount -= GetProcessorsUsed(test); testRun->EndTest(this->Completed, this->Total, false); this->Failed->push_back(this->Properties[test]->Name); + delete testRun; } cmSystemTools::ChangeDirectory(current_dir.c_str()); } @@ -321,7 +325,7 @@ void cmCTestMultiProcessHandler::WriteCostData(int index, float cost) std::string fname = this->CTest->GetBinaryDir() + "/Testing/Temporary/CTestCostData.txt"; std::fstream fout; - fout.open(fname.c_str(), std::ios::app); + fout.open(fname.c_str(), std::ios::out | std::ios::app); fout << index << " " << cost << "\n"; fout.close(); } @@ -412,12 +416,9 @@ void cmCTestMultiProcessHandler::CheckResume() fin.close(); } } - else + else if(cmSystemTools::FileExists(fname.c_str(), true)) { - if(cmSystemTools::FileExists(fname.c_str(), true)) - { - cmSystemTools::RemoveFile(fname.c_str()); - } + cmSystemTools::RemoveFile(fname.c_str()); } } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 3e4757b28..24d1d9f48 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -15,6 +15,9 @@ #include "cmCTest.h" #include "cmSystemTools.h" +#include +#include + cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) { this->CTest = handler->CTest; @@ -23,9 +26,12 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->TestProcess = 0; this->TestResult.ExecutionTime =0; this->TestResult.ReturnValue = 0; - this->TestResult.Status = 0; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; this->TestResult.TestCount = 0; this->TestResult.Properties = 0; + this->ProcessOutput = ""; + this->CompressedOutput = ""; + this->CompressionRatio = 2; } cmCTestRunTest::~cmCTestRunTest() @@ -52,7 +58,7 @@ bool cmCTestRunTest::CheckOutput() { // Store this line of output. cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - this->GetIndex() << ": " << line << std::endl); + this->GetIndex() << ": " << line << std::endl); this->ProcessOutput += line; this->ProcessOutput += "\n"; } @@ -64,9 +70,74 @@ bool cmCTestRunTest::CheckOutput() return true; } +//--------------------------------------------------------- +// Streamed compression of test output. The compressed data +// is appended to this->CompressedOutput +void cmCTestRunTest::CompressOutput() +{ + int ret; + z_stream strm; + + unsigned char* in = + reinterpret_cast( + const_cast(this->ProcessOutput.c_str())); + //zlib makes the guarantee that this is the maximum output size + int outSize = static_cast(this->ProcessOutput.size() * 1.001 + 13); + unsigned char* out = new unsigned char[outSize]; + + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + ret = deflateInit(&strm, -1); //default compression level + if (ret != Z_OK) + { + return; + } + + strm.avail_in = static_cast(this->ProcessOutput.size()); + strm.next_in = in; + strm.avail_out = outSize; + strm.next_out = out; + ret = deflate(&strm, Z_FINISH); + + if(ret == Z_STREAM_ERROR || ret != Z_STREAM_END) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error during output " + "compression. Sending uncompressed output." << std::endl); + return; + } + + (void)deflateEnd(&strm); + + unsigned char *encoded_buffer + = new unsigned char[static_cast(outSize * 1.5)]; + + unsigned long rlen + = cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1); + + for(unsigned long i = 0; i < rlen; i++) + { + this->CompressedOutput += encoded_buffer[i]; + } + + if(strm.total_in) + { + this->CompressionRatio = static_cast(strm.total_out) / + static_cast(strm.total_in); + } + + delete [] encoded_buffer; + delete [] out; +} + //--------------------------------------------------------- bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) { + if (this->CTest->ShouldCompressTestOutput()) + { + this->CompressOutput(); + } + //restore the old environment if (this->ModifyEnv) { @@ -146,7 +217,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } else if ( res == cmsysProcess_State_Expired ) { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout"); + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Timeout "); this->TestResult.Status = cmCTestTestHandler::TIMEOUT; outputTestErrorsToConsole = this->CTest->OutputTestOutputOnTestFailure; } @@ -177,10 +248,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT; } } - else // if ( res == cmsysProcess_State_Error ) + else //cmsysProcess_State_Error { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res ); - this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND; + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Not Run "); } passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED; @@ -202,18 +272,11 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) // Output since that is what is parsed by cmCTestMemCheckHandler if(!this->TestHandler->MemCheck && started) { - if (this->TestResult.Status == cmCTestTestHandler::COMPLETED) - { this->TestHandler->CleanTestOutput(this->ProcessOutput, static_cast - (this->TestHandler->CustomMaximumPassedTestOutputSize)); - } - else - { - this->TestHandler->CleanTestOutput(this->ProcessOutput, - static_cast - (this->TestHandler->CustomMaximumFailedTestOutputSize)); - } + (this->TestResult.Status == cmCTestTestHandler::COMPLETED ? + this->TestHandler->CustomMaximumPassedTestOutputSize : + this->TestHandler->CustomMaximumFailedTestOutputSize)); } this->TestResult.Reason = reason; if (this->TestHandler->LogFile) @@ -258,16 +321,23 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) << "----------------------------------------------------------" << std::endl << std::endl; } + // if the test actually started and ran + // record the results in TestResult if(started) { - this->TestResult.Output = this->ProcessOutput; + bool compress = this->CompressionRatio < 1 && + this->CTest->ShouldCompressTestOutput(); + this->TestResult.Output = compress ? this->CompressedOutput + : this->ProcessOutput; + this->TestResult.CompressOutput = compress; this->TestResult.ReturnValue = this->TestProcess->GetExitValue(); this->TestResult.CompletionStatus = "Completed"; this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime(); - this->TestHandler->TestResults.push_back(this->TestResult); - this->MemCheckPostProcess(); } + // Always push the current TestResult onto the + // TestHandler vector + this->TestHandler->TestResults.push_back(this->TestResult); delete this->TestProcess; return passed; } @@ -308,16 +378,41 @@ bool cmCTestRunTest::StartTest(size_t total) std::vector& args = this->TestProperties->Args; this->TestResult.Properties = this->TestProperties; this->TestResult.ExecutionTime = 0; + this->TestResult.CompressOutput = false; this->TestResult.ReturnValue = -1; - this->TestResult.CompletionStatus = "Not Run"; - this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + this->TestResult.CompletionStatus = "Failed to start"; + this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND; this->TestResult.TestCount = this->TestProperties->Index; this->TestResult.Name = this->TestProperties->Name; this->TestResult.Path = this->TestProperties->Directory.c_str(); + // Check if all required files exist + for(std::vector::iterator i = + this->TestProperties->RequiredFiles.begin(); + i != this->TestProperties->RequiredFiles.end(); ++i) + { + std::string file = *i; + + if(!cmSystemTools::FileExists(file.c_str())) + { + //Required file was not found + this->TestProcess = new cmProcess; + *this->TestHandler->LogFile << "Unable to find required file: " + << file.c_str() << std::endl; + cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find required file: " + << file.c_str() << std::endl); + this->TestResult.Output = "Unable to find required file: " + file; + this->TestResult.FullCommandLine = ""; + this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + return false; + } + } // log and return if we did not find the executable if (this->ActualCommand == "") { + // if the command was not found create a TestResult object + // that has that information this->TestProcess = new cmProcess; *this->TestHandler->LogFile << "Unable to find executable: " << args[1].c_str() << std::endl; @@ -325,7 +420,8 @@ bool cmCTestRunTest::StartTest(size_t total) << args[1].c_str() << std::endl); this->TestResult.Output = "Unable to find executable: " + args[1]; this->TestResult.FullCommandLine = ""; - this->TestHandler->TestResults.push_back(this->TestResult); + this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } this->StartTime = this->CTest->CurrentTime(); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index bfeda209a..108464356 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -45,6 +45,9 @@ public: // Read and store output. Returns true if it must be called again. bool CheckOutput(); + // Compresses the output, writing to CompressedOutput + void CompressOutput(); + //launch the test process, return whether it started correctly bool StartTest(size_t total); //capture and report the test results @@ -53,6 +56,7 @@ public: void ComputeArguments(); private: void DartProcessing(); + void ExeNotFound(std::string exe); bool CreateProcess(double testTimeOut, std::vector* environment); void WriteLogOutputTop(size_t completed, size_t total); @@ -71,9 +75,15 @@ private: //flag for whether the env was modified for this run bool ModifyEnv; + + bool UsePrefixCommand; + std::string PrefixCommand; + //stores the original environment if we are modifying it std::vector OrigEnv; std::string ProcessOutput; + std::string CompressedOutput; + double CompressionRatio; //The test results cmCTestTestHandler::cmCTestTestResult TestResult; int Index; @@ -96,5 +106,6 @@ inline int getNumWidth(size_t n) } return numWidth; } + #endif diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 82e5845f9..fab9a8cba 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -440,3 +440,11 @@ void cmCTestSVN::LoadModifications() OutputLogger err(this->Log, "status-err> "); this->RunChild(svn_status, &out, &err); } + +//---------------------------------------------------------------------------- +void cmCTestSVN::WriteXMLGlobal(std::ostream& xml) +{ + this->cmCTestGlobalVC::WriteXMLGlobal(xml); + + xml << "\t" << this->Base << "\n"; +} diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index ff9ff0f65..f72c58fb0 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -52,6 +52,8 @@ private: void DoRevision(Revision const& revision, std::vector const& changes); + void WriteXMLGlobal(std::ostream& xml); + // Parsing helper classes. class InfoParser; class LogParser; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 5983e688b..fdf17e0e0 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -583,6 +583,10 @@ void cmCTestScriptHandler::SleepInSeconds(unsigned int secondsToWait) int cmCTestScriptHandler::RunConfigurationScript (const std::string& total_script_arg, bool pscope) { +#ifdef CMAKE_BUILD_WITH_CMAKE + cmSystemTools::SaveRestoreEnvironment sre; +#endif + int result; this->ScriptStartTime = diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 779a38c55..228a17300 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -14,6 +14,13 @@ #include "cmCTest.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" +#include "cmCTestVC.h" +#include "cmGeneratedFileStream.h" + +cmCTestStartCommand::cmCTestStartCommand() +{ + this->CreateNewTag = true; +} bool cmCTestStartCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) @@ -42,6 +49,15 @@ bool cmCTestStartCommand } } + if (cnt < args.size()) + { + if (args[cnt] == "APPEND") + { + cnt ++; + this->CreateNewTag = false; + } + } + if ( cnt < args.size() ) { src_dir = args[cnt].c_str(); @@ -76,10 +92,11 @@ bool cmCTestStartCommand cmSystemTools::AddKeepPath(bld_dir); this->CTest->EmptyCTestConfiguration(); - this->CTest->SetCTestConfiguration("SourceDirectory", - cmSystemTools::CollapseFullPath(src_dir).c_str()); - this->CTest->SetCTestConfiguration("BuildDirectory", - cmSystemTools::CollapseFullPath(bld_dir).c_str()); + + std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir); + std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir); + this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str()); + this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " << smodel << std::endl @@ -92,13 +109,62 @@ bool cmCTestStartCommand " Track: " << track << std::endl); } + // Log startup actions. + std::string startLogFile = binaryDir + "/Testing/Temporary/LastStart.log"; + cmGeneratedFileStream ofs(startLogFile.c_str()); + if(!ofs) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Cannot create log file: LastStart.log" << std::endl); + return false; + } + + // Make sure the source directory exists. + if(!this->InitialCheckout(ofs, sourceDir)) + { + return false; + } + if(!cmSystemTools::FileIsDirectory(sourceDir.c_str())) + { + cmOStringStream e; + e << "given source path\n" + << " " << sourceDir << "\n" + << "which is not an existing directory. " + << "Set CTEST_CHECKOUT_COMMAND to a command line to create it."; + this->SetError(e.str().c_str()); + return false; + } + this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF"); this->CTest->SetSuppressUpdatingCTestConfiguration(true); int model = this->CTest->GetTestModelFromString(smodel); this->CTest->SetTestModel(model); this->CTest->SetProduceXML(true); - return this->CTest->InitializeFromCommand(this, true); + return this->CTest->InitializeFromCommand(this); } - +//---------------------------------------------------------------------------- +bool cmCTestStartCommand::InitialCheckout( + std::ostream& ofs, std::string const& sourceDir) +{ + // Use the user-provided command to create the source tree. + const char* initialCheckoutCommand + = this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND"); + if(!initialCheckoutCommand) + { + initialCheckoutCommand = + this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT"); + } + if(initialCheckoutCommand) + { + // Use a generic VC object to run and log the command. + cmCTestVC vc(this->CTest, ofs); + vc.SetSourceDirectory(sourceDir.c_str()); + if(!vc.InitialCheckout(initialCheckoutCommand)) + { + return false; + } + } + return true; +} diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 84f763152..afbc77b4a 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -23,7 +23,7 @@ class cmCTestStartCommand : public cmCTestCommand { public: - cmCTestStartCommand() {} + cmCTestStartCommand(); /** * This is a virtual constructor for the command. @@ -33,6 +33,7 @@ public: cmCTestStartCommand* ni = new cmCTestStartCommand; ni->CTest = this->CTest; ni->CTestScriptHandler = this->CTestScriptHandler; + ni->CreateNewTag = this->CreateNewTag; return ni; } @@ -43,6 +44,14 @@ public: virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); + /** + * Will this invocation of ctest_start create a new TAG file? + */ + bool ShouldCreateNewTag() + { + return this->CreateNewTag; + } + /** * The name of the command as specified in CMakeList.txt. */ @@ -62,16 +71,21 @@ public: virtual const char* GetFullDocumentation() { return - " ctest_start(Model [TRACK ] [source [binary]])\n" + " ctest_start(Model [TRACK ] [APPEND] [source [binary]])\n" "Starts the testing for a given model. The command should be called " "after the binary directory is initialized. If the 'source' and " "'binary' directory are not specified, it reads the " "CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY. If the track is " - "specified, the submissions will go to the specified track."; + "specified, the submissions will go to the specified track. " + "If APPEND is used, the existing TAG is used rather than " + "creating a new one based on the current time stamp."; } cmTypeMacro(cmCTestStartCommand, cmCTestCommand); +private: + bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir); + bool CreateNewTag; }; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index cbef1f17b..7b4f38b2c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -72,6 +72,8 @@ void cmCTestSubmitHandler::Initialize() this->SubmitPart[p] = true; } this->CDash = false; + this->HasWarnings = false; + this->HasErrors = false; this->Superclass::Initialize(); this->HTTPProxy = ""; this->HTTPProxyType = 0; @@ -309,7 +311,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, } } } - + if(this->CTest->ShouldUseHTTP10()) + { + curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + } + // enable HTTP ERROR parsing + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); /* enable uploading */ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); @@ -409,6 +416,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, cmCTestLog(this->CTest, DEBUG, "CURL output: [" << cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "]" << std::endl); + this->ParseResponse(chunk); } if ( chunkDebug.size() > 0 ) { @@ -454,6 +462,36 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, return true; } +//---------------------------------------------------------------------------- +void cmCTestSubmitHandler +::ParseResponse(cmCTestSubmitHandlerVectorOfChar chunk) +{ + std::string output = ""; + + for(cmCTestSubmitHandlerVectorOfChar::iterator i = chunk.begin(); + i != chunk.end(); ++i) + { + output += *i; + } + output = cmSystemTools::UpperCase(output); + + if(output.find("WARNING") != std::string::npos) + { + this->HasWarnings = true; + } + if(output.find("ERROR") != std::string::npos) + { + this->HasErrors = true; + } + + if(this->HasWarnings || this->HasErrors) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Server Response:\n" << + cmCTestLogWrite(&*chunk.begin(), chunk.size()) << "\n"); + } + +} + //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::TriggerUsingHTTP( const std::set& files, @@ -1149,9 +1187,20 @@ int cmCTestSubmitHandler::ProcessHandler() return -1; } } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" - << std::endl); - ofs << " Submission successful" << std::endl; + if(this->HasErrors) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Errors occurred during " + "submission." << std::endl); + ofs << " Errors occurred during submission. " << std::endl; + } + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << + (this->HasWarnings ? ", with warnings." : "") << std::endl); + ofs << " Submission successful" << + (this->HasWarnings ? ", with warnings." : "") << std::endl; + } + return 0; } else if ( dropMethod == "xmlrpc" ) diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index d93f94dfa..8b011ea19 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -75,6 +75,8 @@ private: const cmStdString& remoteprefix, const cmStdString& url); + void ParseResponse(std::vector); + std::string GetSubmitResultsPrefix(); cmStdString HTTPProxy; @@ -85,6 +87,8 @@ private: std::ostream* LogFile; bool SubmitPart[cmCTest::PartCount]; bool CDash; + bool HasWarnings; + bool HasErrors; cmCTest::SetOfStrings Files; }; diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index a719b0902..b0adf224f 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -24,6 +24,7 @@ cmCTestTestCommand::cmCTestTestCommand() this->Arguments[ctt_EXCLUDE_LABEL] = "EXCLUDE_LABEL"; this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL"; this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL"; + this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM"; this->Arguments[ctt_LAST] = 0; this->Last = ctt_LAST; } @@ -32,6 +33,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() { const char* ctestTimeout = this->Makefile->GetDefinition("CTEST_TEST_TIMEOUT"); + double timeout = this->CTest->GetTimeOut(); if ( ctestTimeout ) { @@ -91,6 +93,11 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() handler->SetOption("ParallelLevel", this->Values[ctt_PARALLEL_LEVEL]); } + if(this->Values[ctt_SCHEDULE_RANDOM]) + { + handler->SetOption("ScheduleRandom", + this->Values[ctt_SCHEDULE_RANDOM]); + } return handler; } @@ -98,4 +105,3 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler() { return this->CTest->GetInitializedHandler("test"); } - diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 73ce91329..12314dfe6 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -61,7 +61,8 @@ public: " [INCLUDE include regex] [RETURN_VALUE res] \n" " [EXCLUDE_LABEL exclude regex] \n" " [INCLUDE_LABEL label regex] \n" - " [PARALLEL_LEVEL level]) \n" + " [PARALLEL_LEVEL level] \n" + " [SCHEDULE_RANDOM on]) \n" "Tests the given build directory and stores results in Test.xml. The " "second argument is a variable that will hold value. Optionally, " "you can specify the starting test number START, the ending test number " @@ -70,7 +71,9 @@ public: "to not run EXCLUDE. EXCLUDE_LABEL and INCLUDE_LABEL are regular " "expression for test to be included or excluded by the test " "property LABEL. PARALLEL_LEVEL should be set to a positive number " - "representing the number of tests to be run in parallel." + "representing the number of tests to be run in parallel. " + "SCHEDULE_RANDOM will launch tests in a random order, and is " + "typically used to detect implicit test dependencies." "\n" CTEST_COMMAND_APPEND_OPTION_DOCS; } @@ -92,6 +95,7 @@ protected: ctt_EXCLUDE_LABEL, ctt_INCLUDE_LABEL, ctt_PARALLEL_LEVEL, + ctt_SCHEDULE_RANDOM, ctt_LAST }; }; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2491d1958..78f2c30ac 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -500,11 +500,16 @@ int cmCTestTestHandler::ProcessHandler() { // Update internal data structure from generic one this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation")); - this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion"))); + this->SetUseUnion(cmSystemTools::IsOn(this->GetOption("UseUnion"))); + if(cmSystemTools::IsOn(this->GetOption("ScheduleRandom"))) + { + this->CTest->SetScheduleType("Random"); + } if(this->GetOption("ParallelLevel")) { this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel"))); } + const char* val; val = this->GetOption("LabelRegularExpression"); if ( val ) @@ -684,13 +689,12 @@ void cmCTestTestHandler::PrintLabelSummary() } } } - it = this->TestList.begin(); ri = this->TestResults.begin(); // fill maps - for(; it != this->TestList.end(); ++it, ++ri) + for(; ri != this->TestResults.end(); ++ri) { - cmCTestTestProperties& p = *it; - cmCTestTestResult &result = *ri; + cmCTestTestResult &result = *ri; + cmCTestTestProperties& p = *result.Properties; if(p.Labels.size() != 0) { for(std::vector::iterator l = p.Labels.begin(); @@ -1030,12 +1034,28 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, cmCTestMultiProcessHandler::TestMap tests; cmCTestMultiProcessHandler::PropertiesMap properties; + bool randomSchedule = this->CTest->GetScheduleType() == "Random"; + if(randomSchedule) + { + srand((unsigned)time(0)); + } + for (ListOfTests::iterator it = this->TestList.begin(); it != this->TestList.end(); ++it) { cmCTestTestProperties& p = *it; cmCTestMultiProcessHandler::TestSet depends; + if(randomSchedule) + { + p.Cost = rand(); + } + + if(p.Timeout == 0 && this->CTest->GetGlobalTimeout() != 0) + { + p.Timeout = this->CTest->GetGlobalTimeout(); + } + if(p.Depends.size()) { for(std::vector::iterator i = p.Depends.begin(); @@ -1166,12 +1186,17 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) } os << "\t\t\t\n" - << "\t\t\t\t"; + << "\t\t\t\tCompressOutput ? + " encoding=\"base64\" compression=\"gzip\">" + : ">"); os << cmXMLSafe(result->Output); os << "\n" << "\t\t\t\n" << "\t\t\n"; + + this->AttachFiles(os, result); this->WriteTestResultFooter(os, result); } @@ -1233,6 +1258,73 @@ void cmCTestTestHandler::WriteTestResultFooter(std::ostream& os, << "\t" << std::endl; } +//---------------------------------------------------------------------- +void cmCTestTestHandler::AttachFiles(std::ostream& os, + cmCTestTestResult* result) +{ + if(result->Status != cmCTestTestHandler::COMPLETED + && result->Properties->AttachOnFail.size()) + { + result->Properties->AttachedFiles.insert( + result->Properties->AttachedFiles.end(), + result->Properties->AttachOnFail.begin(), + result->Properties->AttachOnFail.end()); + } + for(std::vector::const_iterator file = + result->Properties->AttachedFiles.begin(); + file != result->Properties->AttachedFiles.end(); ++file) + { + std::string base64 = this->EncodeFile(*file); + std::string fname = cmSystemTools::GetFilenameName(*file); + os << "\t\t" + "\n\t\t\t\n\t\t\t" + << base64 + << "\n\t\t\t\n\t\t\n"; + } +} + +//---------------------------------------------------------------------- +std::string cmCTestTestHandler::EncodeFile(std::string file) +{ + std::string tarFile = file + "_temp.tar.gz"; + std::vector files; + files.push_back(file); + + if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while " + "attaching file: " << file << std::endl); + return ""; + } + long len = cmSystemTools::FileLength(tarFile.c_str()); + std::ifstream ifs(tarFile.c_str(), std::ios::in +#ifdef _WIN32 + | std::ios::binary +#endif + ); + unsigned char *file_buffer = new unsigned char [ len + 1 ]; + ifs.read(reinterpret_cast(file_buffer), len); + ifs.close(); + cmSystemTools::RemoveFile(tarFile.c_str()); + + unsigned char *encoded_buffer + = new unsigned char [ static_cast(len * 1.5 + 5) ]; + + unsigned long rlen + = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1); + + std::string base64 = ""; + for(unsigned long i = 0; i < rlen; i++) + { + base64 += encoded_buffer[i]; + } + delete [] file_buffer; + delete [] encoded_buffer; + + return base64; +} + //---------------------------------------------------------------------- int cmCTestTestHandler::ExecuteCommands(std::vector& vec) { @@ -1274,7 +1366,7 @@ void cmCTestTestHandler std::vector &attemptedConfigs, std::string filepath, std::string &filename) -{ +{ std::string tempPath; if (filepath.size() && @@ -1985,6 +2077,28 @@ bool cmCTestTestHandler::SetTestsProperties( { rtit->WillFail = cmSystemTools::IsOn(val.c_str()); } + if ( key == "ATTACHED_FILES" ) + { + std::vector lval; + cmSystemTools::ExpandListArgument(val.c_str(), lval); + + for(std::vector::iterator f = lval.begin(); + f != lval.end(); ++f) + { + rtit->AttachedFiles.push_back(*f); + } + } + if ( key == "ATTACHED_FILES_ON_FAIL" ) + { + std::vector lval; + cmSystemTools::ExpandListArgument(val.c_str(), lval); + + for(std::vector::iterator f = lval.begin(); + f != lval.end(); ++f) + { + rtit->AttachOnFail.push_back(*f); + } + } if ( key == "TIMEOUT" ) { rtit->Timeout = atof(val.c_str()); @@ -1993,6 +2107,17 @@ bool cmCTestTestHandler::SetTestsProperties( { rtit->Cost = static_cast(atof(val.c_str())); } + if ( key == "REQUIRED_FILES" ) + { + std::vector lval; + cmSystemTools::ExpandListArgument(val.c_str(), lval); + + for(std::vector::iterator f = lval.begin(); + f != lval.end(); ++f) + { + rtit->RequiredFiles.push_back(*f); + } + } if ( key == "RUN_SERIAL" ) { rtit->RunSerial = cmSystemTools::IsOn(val.c_str()); @@ -2088,6 +2213,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) { const std::string& testname = args[0]; cmCTestLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl); + if (this->UseExcludeRegExpFlag && this->UseExcludeRegExpFirst && this->ExcludeTestsRegularExpression.find(testname.c_str())) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index ceb502084..1513410e9 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -84,7 +84,10 @@ public: cmStdString Name; cmStdString Directory; std::vector Args; + std::vector RequiredFiles; std::vector Depends; + std::vector AttachedFiles; + std::vector AttachOnFail; std::vector > ErrorRegularExpressions; std::vectorCTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS"); - const char* initialCheckoutCommand - = this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND"); - if ( !initialCheckoutCommand ) - { - initialCheckoutCommand = - this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT"); - } - cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("update"); if ( !handler ) @@ -78,24 +70,6 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() return 0; } handler->SetOption("SourceDirectory", source_dir.c_str()); - if ( initialCheckoutCommand ) - { - handler->SetOption("InitialCheckout", initialCheckoutCommand); - } - if ( (!cmSystemTools::FileExists(source_dir.c_str()) || - !cmSystemTools::FileIsDirectory(source_dir.c_str())) - && !initialCheckoutCommand ) - { - cmOStringStream str; - str << "cannot find source directory: " << source_dir.c_str() << "."; - if ( !cmSystemTools::FileExists(source_dir.c_str()) ) - { - str << " Looks like it is not checked out yet. Please specify " - "CTEST_CHECKOUT_COMMAND."; - } - this->SetError(str.str().c_str()); - return 0; - } return handler; } diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index cd2f6613f..f87b37c84 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -201,15 +201,6 @@ int cmCTestUpdateHandler::ProcessHandler() this->StartLogFile("Update", ofs); } - cmCTestLog(this->CTest, HANDLER_OUTPUT, - "Updating the repository" << std::endl); - - // Make sure the source directory exists. - if(!this->InitialCheckout(ofs)) - { - return -1; - } - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Updating the repository: " << sourceDirectory << std::endl); @@ -267,7 +258,8 @@ int cmCTestUpdateHandler::ProcessHandler() << this->CTest->GetTestModelString() << "" << std::endl; os << "\t" << start_time << "\n" << "\t" << start_time_time << "\n" - << "\t" << cmXMLSafe(vc->GetUpdateCommandLine()) + << "\t" + << cmXMLSafe(vc->GetUpdateCommandLine()).Quotes(false) << "\n" << "\t" << cmXMLSafe( cmCTestUpdateHandlerUpdateToString(this->UpdateType)) @@ -322,32 +314,6 @@ int cmCTestUpdateHandler::ProcessHandler() return numUpdated; } -//---------------------------------------------------------------------- -bool cmCTestUpdateHandler::InitialCheckout(std::ostream& ofs) -{ - // Use the user-provided command to create the source tree. - if(const char* command = this->GetOption("InitialCheckout")) - { - // Use a generic VC object to run and log the command. - cmCTestVC vc(this->CTest, ofs); - vc.SetSourceDirectory(this->GetOption("SourceDirectory")); - if(!vc.InitialCheckout(command)) - { - return false; - } - - if(!this->CTest->InitializeFromCommand(this->Command)) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, - " Fatal Error in initialize: " - << std::endl); - cmSystemTools::SetFatalErrorOccured(); - return false; - } - } - return true; -} - //---------------------------------------------------------------------- int cmCTestUpdateHandler::DetectVCS(const char* dir) { diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 78426ea80..55ec974dc 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -65,7 +65,6 @@ private: std::string UpdateCommand; int UpdateType; - bool InitialCheckout(std::ostream& ofs); int DetectVCS(const char* dir); bool SelectVCS(); }; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 1895066a8..9aa40d6f9 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -61,7 +61,6 @@ bool cmProcess::StartProcess() cmsysProcess_SetWorkingDirectory(this->Process, this->WorkingDirectory.c_str()); } - cmsysProcess_SetOption(this->Process, cmsysProcess_Option_HideWindow, 1); cmsysProcess_SetTimeout(this->Process, this->Timeout); cmsysProcess_Execute(this->Process); return (cmsysProcess_GetState(this->Process) @@ -79,7 +78,10 @@ bool cmProcess::Buffer::GetLine(std::string& line) // Extract the range first..last as a line. const char* text = &*this->begin() + this->First; size_type length = this->Last - this->First; - length -= (length && text[length-1] == '\r')? 1:0; + while(length && text[length-1] == '\r') + { + length --; + } line.assign(text, length); // Start a new range for the next line. diff --git a/Source/CursesDialog/form/fld_arg.c b/Source/CursesDialog/form/fld_arg.c index 20f275db5..91ad79f1a 100644 --- a/Source/CursesDialog/form/fld_arg.c +++ b/Source/CursesDialog/form/fld_arg.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.1 2001-11-05 16:52:59 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_attr.c b/Source/CursesDialog/form/fld_attr.c index e0fc2a6b8..86195882b 100644 --- a/Source/CursesDialog/form/fld_attr.c +++ b/Source/CursesDialog/form/fld_attr.c @@ -36,7 +36,7 @@ #if defined(__hpux) #undef _XOPEN_SOURCE_EXTENDED #endif -MODULE_ID("$Id: fld_attr.c,v 1.2 2003-03-11 20:25:50 hoffman Exp $") +MODULE_ID("$Id$") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines diff --git a/Source/CursesDialog/form/fld_current.c b/Source/CursesDialog/form/fld_current.c index 5963ed6c8..d4b1254f7 100644 --- a/Source/CursesDialog/form/fld_current.c +++ b/Source/CursesDialog/form/fld_current.c @@ -31,7 +31,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_current.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_def.c b/Source/CursesDialog/form/fld_def.c index be77e0569..4a49a2558 100644 --- a/Source/CursesDialog/form/fld_def.c +++ b/Source/CursesDialog/form/fld_def.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.2 2002-01-25 14:06:38 king Exp $") +MODULE_ID("$Id$") /* this can't be readonly */ static FIELD default_field = { diff --git a/Source/CursesDialog/form/fld_dup.c b/Source/CursesDialog/form/fld_dup.c index 6f74981d2..1c5301d55 100644 --- a/Source/CursesDialog/form/fld_dup.c +++ b/Source/CursesDialog/form/fld_dup.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_ftchoice.c b/Source/CursesDialog/form/fld_ftchoice.c index 6fd54b731..bb37073fb 100644 --- a/Source/CursesDialog/form/fld_ftchoice.c +++ b/Source/CursesDialog/form/fld_ftchoice.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_ftchoice.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_ftlink.c b/Source/CursesDialog/form/fld_ftlink.c index 3f238f44b..1cb80d118 100644 --- a/Source/CursesDialog/form/fld_ftlink.c +++ b/Source/CursesDialog/form/fld_ftlink.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_ftlink.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_info.c b/Source/CursesDialog/form/fld_info.c index 2789657d9..7c50b1df0 100644 --- a/Source/CursesDialog/form/fld_info.c +++ b/Source/CursesDialog/form/fld_info.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_info.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_just.c b/Source/CursesDialog/form/fld_just.c index 962870530..701565450 100644 --- a/Source/CursesDialog/form/fld_just.c +++ b/Source/CursesDialog/form/fld_just.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_just.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_link.c b/Source/CursesDialog/form/fld_link.c index 427d574eb..164f51bc4 100644 --- a/Source/CursesDialog/form/fld_link.c +++ b/Source/CursesDialog/form/fld_link.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_link.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_max.c b/Source/CursesDialog/form/fld_max.c index 0aca9953c..cca8dc558 100644 --- a/Source/CursesDialog/form/fld_max.c +++ b/Source/CursesDialog/form/fld_max.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_move.c b/Source/CursesDialog/form/fld_move.c index baabfaf28..22934779c 100644 --- a/Source/CursesDialog/form/fld_move.c +++ b/Source/CursesDialog/form/fld_move.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_move.c,v 1.1 2001-11-05 16:53:00 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_newftyp.c b/Source/CursesDialog/form/fld_newftyp.c index 1f4ec2f87..b45ebd879 100644 --- a/Source/CursesDialog/form/fld_newftyp.c +++ b/Source/CursesDialog/form/fld_newftyp.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_newftyp.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") static FIELDTYPE const default_fieldtype = { 0, /* status */ diff --git a/Source/CursesDialog/form/fld_opts.c b/Source/CursesDialog/form/fld_opts.c index 4d89fe266..234634bc6 100644 --- a/Source/CursesDialog/form/fld_opts.c +++ b/Source/CursesDialog/form/fld_opts.c @@ -31,7 +31,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_opts.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") /*---------------------------------------------------------------------------- Field-Options manipulation routines diff --git a/Source/CursesDialog/form/fld_pad.c b/Source/CursesDialog/form/fld_pad.c index 07977b230..45983409d 100644 --- a/Source/CursesDialog/form/fld_pad.c +++ b/Source/CursesDialog/form/fld_pad.c @@ -31,7 +31,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: fld_pad.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_page.c b/Source/CursesDialog/form/fld_page.c index e4ff0541f..408e71201 100644 --- a/Source/CursesDialog/form/fld_page.c +++ b/Source/CursesDialog/form/fld_page.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_page.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_stat.c b/Source/CursesDialog/form/fld_stat.c index 15f50709f..ee6831bbe 100644 --- a/Source/CursesDialog/form/fld_stat.c +++ b/Source/CursesDialog/form/fld_stat.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_stat.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fld_type.c b/Source/CursesDialog/form/fld_type.c index 71150784c..6c9def2c9 100644 --- a/Source/CursesDialog/form/fld_type.c +++ b/Source/CursesDialog/form/fld_type.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_type.c,v 1.2 2001-11-06 13:40:07 hoffman Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- diff --git a/Source/CursesDialog/form/fld_user.c b/Source/CursesDialog/form/fld_user.c index bc7685f4b..7ffca9c0e 100644 --- a/Source/CursesDialog/form/fld_user.c +++ b/Source/CursesDialog/form/fld_user.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_user.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_cursor.c b/Source/CursesDialog/form/frm_cursor.c index 87dd915ab..6c311fe60 100644 --- a/Source/CursesDialog/form/frm_cursor.c +++ b/Source/CursesDialog/form/frm_cursor.c @@ -31,7 +31,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_cursor.c,v 1.1 2001-11-05 16:53:01 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_data.c b/Source/CursesDialog/form/frm_data.c index ea1901b42..fb62ab82a 100644 --- a/Source/CursesDialog/form/frm_data.c +++ b/Source/CursesDialog/form/frm_data.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.3 2002-06-18 20:30:00 king Exp $") +MODULE_ID("$Id$") extern int winnstr(WINDOW *, char *, int); diff --git a/Source/CursesDialog/form/frm_def.c b/Source/CursesDialog/form/frm_def.c index cab02ce0d..0b28f5f0e 100644 --- a/Source/CursesDialog/form/frm_def.c +++ b/Source/CursesDialog/form/frm_def.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_def.c,v 1.2 2002-01-25 14:06:39 king Exp $") +MODULE_ID("$Id$") /* this can't be readonly */ static FORM default_form = { diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c index ff7a24790..0b53b5a2f 100644 --- a/Source/CursesDialog/form/frm_driver.c +++ b/Source/CursesDialog/form/frm_driver.c @@ -41,7 +41,7 @@ #undef lines #undef columns -MODULE_ID("$Id: frm_driver.c,v 1.15 2002-10-23 20:43:34 king Exp $") +MODULE_ID("$Id$") /* These declarations are missing from curses.h on some platforms. */ extern int winnstr(WINDOW *, char *, int); diff --git a/Source/CursesDialog/form/frm_hook.c b/Source/CursesDialog/form/frm_hook.c index 1e236c1dd..eb654c4f3 100644 --- a/Source/CursesDialog/form/frm_hook.c +++ b/Source/CursesDialog/form/frm_hook.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_hook.c,v 1.1 2001-11-05 16:53:02 berk Exp $") +MODULE_ID("$Id$") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ diff --git a/Source/CursesDialog/form/frm_opts.c b/Source/CursesDialog/form/frm_opts.c index 5f49ab087..7bbeaa135 100644 --- a/Source/CursesDialog/form/frm_opts.c +++ b/Source/CursesDialog/form/frm_opts.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_opts.c,v 1.1 2001-11-05 16:53:02 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_page.c b/Source/CursesDialog/form/frm_page.c index e1ed8d7e2..842cbce7b 100644 --- a/Source/CursesDialog/form/frm_page.c +++ b/Source/CursesDialog/form/frm_page.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_page.c,v 1.1 2001-11-05 16:53:02 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_post.c b/Source/CursesDialog/form/frm_post.c index de0591916..5ead942f0 100644 --- a/Source/CursesDialog/form/frm_post.c +++ b/Source/CursesDialog/form/frm_post.c @@ -31,7 +31,7 @@ ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_post.c,v 1.1 2001-11-05 16:53:03 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_req_name.c b/Source/CursesDialog/form/frm_req_name.c index 1abb18e91..b108dabe4 100644 --- a/Source/CursesDialog/form/frm_req_name.c +++ b/Source/CursesDialog/form/frm_req_name.c @@ -43,7 +43,7 @@ #undef _XOPEN_SOURCE_EXTENDED #endif -MODULE_ID("$Id: frm_req_name.c,v 1.7 2002-06-18 21:19:38 king Exp $") +MODULE_ID("$Id$") static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { "NEXT_PAGE" , diff --git a/Source/CursesDialog/form/frm_scale.c b/Source/CursesDialog/form/frm_scale.c index 30d6c52d1..028e9e2e8 100644 --- a/Source/CursesDialog/form/frm_scale.c +++ b/Source/CursesDialog/form/frm_scale.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_scale.c,v 1.1 2001-11-05 16:53:03 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_sub.c b/Source/CursesDialog/form/frm_sub.c index e96ac09d2..62dc613b0 100644 --- a/Source/CursesDialog/form/frm_sub.c +++ b/Source/CursesDialog/form/frm_sub.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.1 2001-11-05 16:53:03 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_user.c b/Source/CursesDialog/form/frm_user.c index 48481801b..8f0edbcfe 100644 --- a/Source/CursesDialog/form/frm_user.c +++ b/Source/CursesDialog/form/frm_user.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_user.c,v 1.1 2001-11-05 16:53:03 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/frm_win.c b/Source/CursesDialog/form/frm_win.c index 423b3c7fa..82d716f7f 100644 --- a/Source/CursesDialog/form/frm_win.c +++ b/Source/CursesDialog/form/frm_win.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.1 2001-11-05 16:53:04 berk Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fty_alnum.c b/Source/CursesDialog/form/fty_alnum.c index 9b6b5eaa4..6f3cfd4fc 100644 --- a/Source/CursesDialog/form/fty_alnum.c +++ b/Source/CursesDialog/form/fty_alnum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alnum.c,v 1.2 2002-06-18 21:19:38 king Exp $") +MODULE_ID("$Id$") typedef struct { int width; diff --git a/Source/CursesDialog/form/fty_alpha.c b/Source/CursesDialog/form/fty_alpha.c index a6bc9b1ae..e4e9ceb1c 100644 --- a/Source/CursesDialog/form/fty_alpha.c +++ b/Source/CursesDialog/form/fty_alpha.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alpha.c,v 1.2 2002-06-19 12:57:14 king Exp $") +MODULE_ID("$Id$") typedef struct { int width; diff --git a/Source/CursesDialog/form/fty_enum.c b/Source/CursesDialog/form/fty_enum.c index 31b295242..8fc4cd7b6 100644 --- a/Source/CursesDialog/form/fty_enum.c +++ b/Source/CursesDialog/form/fty_enum.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.1 2001-11-05 16:53:04 berk Exp $") +MODULE_ID("$Id$") typedef struct { char **kwds; diff --git a/Source/CursesDialog/form/fty_int.c b/Source/CursesDialog/form/fty_int.c index 11b1ac547..7107fcc3f 100644 --- a/Source/CursesDialog/form/fty_int.c +++ b/Source/CursesDialog/form/fty_int.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.2 2002-06-18 21:19:38 king Exp $") +MODULE_ID("$Id$") typedef struct { int precision; diff --git a/Source/CursesDialog/form/fty_ipv4.c b/Source/CursesDialog/form/fty_ipv4.c index ddfc2b478..4ac8a50ec 100644 --- a/Source/CursesDialog/form/fty_ipv4.c +++ b/Source/CursesDialog/form/fty_ipv4.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_ipv4.c,v 1.2 2002-06-18 21:19:38 king Exp $") +MODULE_ID("$Id$") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/Source/CursesDialog/form/fty_num.c b/Source/CursesDialog/form/fty_num.c index 0112e3a46..78095995f 100644 --- a/Source/CursesDialog/form/fty_num.c +++ b/Source/CursesDialog/form/fty_num.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.3 2002-06-18 21:19:38 king Exp $") +MODULE_ID("$Id$") #if HAVE_LOCALE_H #include diff --git a/Source/CursesDialog/form/fty_regex.c b/Source/CursesDialog/form/fty_regex.c index 7d2143d70..0af1cef17 100644 --- a/Source/CursesDialog/form/fty_regex.c +++ b/Source/CursesDialog/form/fty_regex.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.2 2002-06-18 21:19:38 king Exp $") +MODULE_ID("$Id$") #if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ #include diff --git a/Source/CursesDialog/form/nc_alloc.h b/Source/CursesDialog/form/nc_alloc.h index 85130811e..f49ea93e8 100644 --- a/Source/CursesDialog/form/nc_alloc.h +++ b/Source/CursesDialog/form/nc_alloc.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996,1997 * ****************************************************************************/ -/* $Id: nc_alloc.h,v 1.2 2001-11-08 22:03:52 berk Exp $ */ +/* $Id$ */ #ifndef NC_ALLOC_included #define NC_ALLOC_included 1 diff --git a/Source/QtDialog/CMake.desktop b/Source/QtDialog/CMake.desktop index d1d4fb2f3..645eb76e9 100644 --- a/Source/QtDialog/CMake.desktop +++ b/Source/QtDialog/CMake.desktop @@ -3,7 +3,7 @@ Version=1.0 Name=CMake Comment=Cross-platform buildsystem Exec=cmake-gui %f -Icon=CMakeSetup.png +Icon=CMakeSetup32.png Terminal=false X-MultipleArgs=false Type=Application diff --git a/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake b/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake index 37e470142..9f5cf0010 100644 --- a/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake +++ b/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake @@ -210,7 +210,7 @@ macro(copy_library_into_bundle clib_bundle clib_libsrc clib_dstlibs clib_fixups) get_filename_component(fwdirname "${fw_srcdir}" NAME) string(REGEX REPLACE "^(.*)\\.framework$" "\\1" fwname "${fwdirname}") string(REGEX REPLACE "^.*/${fwname}\\.framework/(.*)$" "\\1" fwlibname "${clib_libsrc}") - set(fw_dstdir "${clib_bundle}/Contents/Frameworks/${fwdirname}") + set(fw_dstdir "${clib_bundle}/Contents/Frameworks") # message("") # message("fwdirname: '${fwdirname}'") @@ -240,17 +240,25 @@ macro(copy_library_into_bundle clib_bundle clib_libsrc clib_dstlibs clib_fixups) "${fw_src}" "${fw_dstdir}/${fwlibname}" ) + get_filename_component(fw_src_path "${fw_src}" PATH) + message("Checking ${fw_src_path}/Resources") + if(EXISTS "${fw_src_path}/Resources") + message("Copy: ${CMAKE_COMMAND} -E copy_directory \"${fw_src_path}/Resources/\" \"${fw_dstdir}/Resources/\"") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory + "${fw_src_path}/Resources/" "${fw_dstdir}/${fwdirname}/Resources/") + endif(EXISTS "${fw_src_path}/Resources") + execute_process(COMMAND install_name_tool - -id "@executable_path/../Frameworks/${fwdirname}/${fwlibname}" - "${clib_bundle}/Contents/Frameworks/${fwdirname}/${fwlibname}" + -id "@executable_path/../Frameworks/${fwlibname}" + "${clib_bundle}/Contents/Frameworks/${fwlibname}" ) set(${clib_dstlibs} ${${clib_dstlibs}} - "${clib_bundle}/Contents/Frameworks/${fwdirname}/${fwlibname}" + "${clib_bundle}/Contents/Frameworks/${fwlibname}" ) set(${clib_fixups} ${${clib_fixups}} "-change" "${clib_libsrc}" - "@executable_path/../Frameworks/${fwdirname}/${fwlibname}" + "@executable_path/../Frameworks/${fwlibname}" ) else("${clib_libsrc}" MATCHES ".framework/.*/.*/.*") if("${clib_libsrc}" MATCHES "/") diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 4e7e357e4..405c9522e 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -97,7 +97,7 @@ ELSE(NOT QT4_FOUND) # install a desktop file so CMake appears in the application start menu # with an icon INSTALL(FILES CMake.desktop DESTINATION share/applications ) - INSTALL(FILES CMakeSetup.png DESTINATION share/pixmaps ) + INSTALL(FILES CMakeSetup32.png DESTINATION share/pixmaps ) INSTALL(FILES cmakecache.xml DESTINATION share/mime/packages ) ENDIF(UNIX) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index f19a36dd8..e613a78bc 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -134,7 +134,10 @@ int main(int argc, char** argv) // app setup app.setApplicationName("CMakeSetup"); app.setOrganizationName("Kitware"); - app.setWindowIcon(QIcon(":/Icons/CMakeSetup.png")); + QIcon appIcon; + appIcon.addFile(":/Icons/CMakeSetup32.png"); + appIcon.addFile(":/Icons/CMakeSetup128.png"); + app.setWindowIcon(appIcon); CMakeSetupDialog dialog; dialog.show(); diff --git a/Source/QtDialog/CMakeSetup.qrc b/Source/QtDialog/CMakeSetup.qrc index 5ceb1df0c..eaac19223 100644 --- a/Source/QtDialog/CMakeSetup.qrc +++ b/Source/QtDialog/CMakeSetup.qrc @@ -1,6 +1,7 @@ - CMakeSetup.png + CMakeSetup128.png + CMakeSetup32.png Delete16.png Plus16.png diff --git a/Source/QtDialog/CMakeSetup128.png b/Source/QtDialog/CMakeSetup128.png new file mode 100644 index 000000000..12f1d9a9a Binary files /dev/null and b/Source/QtDialog/CMakeSetup128.png differ diff --git a/Source/QtDialog/CMakeSetup.png b/Source/QtDialog/CMakeSetup32.png similarity index 100% rename from Source/QtDialog/CMakeSetup.png rename to Source/QtDialog/CMakeSetup32.png diff --git a/Source/QtDialog/MacInstallDialog.ui b/Source/QtDialog/MacInstallDialog.ui old mode 100755 new mode 100644 diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx index fbeb10efb..3aa509d94 100644 --- a/Source/QtDialog/QMacInstallDialog.cxx +++ b/Source/QtDialog/QMacInstallDialog.cxx @@ -33,8 +33,8 @@ QMacInstallDialog::~QMacInstallDialog() void QMacInstallDialog::DoInstall() { QDir installDir(this->Internals->InstallPrefix->text()); - std::string installTo = installDir.path().toStdString(); - if(!cmSystemTools::FileExists(installTo.c_str())) + QString installTo = installDir.path(); + if(!cmSystemTools::FileExists(installTo.toAscii().data())) { QString message = tr("Build install does not exist, " "should I create it?") @@ -47,7 +47,7 @@ void QMacInstallDialog::DoInstall() QMessageBox::Yes | QMessageBox::No); if(btn == QMessageBox::Yes) { - cmSystemTools::MakeDirectory(installTo.c_str()); + cmSystemTools::MakeDirectory(installTo.toAscii().data()); } } QDir cmExecDir(QApplication::applicationDirPath()); @@ -56,24 +56,24 @@ void QMacInstallDialog::DoInstall() for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); - std::string filename = fileInfo.fileName().toStdString(); + QString filename = fileInfo.fileName(); if(filename.size() && filename[0] == '.') { continue; } - std::string file = fileInfo.absoluteFilePath().toStdString(); - std::string newName = installTo; + QString file = fileInfo.absoluteFilePath(); + QString newName = installTo; newName += "/"; newName += filename; // Remove the old files - if(cmSystemTools::FileExists(newName.c_str())) + if(cmSystemTools::FileExists(newName.toAscii().data())) { - std::cout << "rm [" << newName << "]\n"; - if(!cmSystemTools::RemoveFile(newName.c_str())) + std::cout << "rm [" << newName.toAscii().data() << "]\n"; + if(!cmSystemTools::RemoveFile(newName.toAscii().data())) { QString message = tr("Failed to remove file " "installation may be incomplete: "); - message += newName.c_str(); + message += newName.toAscii().data(); QString title = tr("Error Removing file"); QMessageBox::StandardButton btn = QMessageBox::critical(this, title, message, @@ -84,14 +84,14 @@ void QMacInstallDialog::DoInstall() } } } - std::cout << "ln -s [" << file << "] ["; - std::cout << newName << "]\n"; - if(!cmSystemTools::CreateSymlink(file.c_str(), - newName.c_str())) + std::cout << "ln -s [" << file.toAscii().data() << "] ["; + std::cout << newName.toAscii().data() << "]\n"; + if(!cmSystemTools::CreateSymlink(file.toAscii().data(), + newName.toAscii().data())) { QString message = tr("Failed create symlink " "installation may be incomplete: "); - message += newName.c_str(); + message += newName.toAscii().data(); QString title = tr("Error Creating Symlink"); QMessageBox::StandardButton btn = QMessageBox::critical(this, title, message, diff --git a/Source/QtDialog/postflight.sh.in b/Source/QtDialog/postflight.sh.in old mode 100644 new mode 100755 diff --git a/Source/QtDialog/postupgrade.sh.in b/Source/QtDialog/postupgrade.sh.in old mode 100644 new mode 100755 diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 2070fd3b5..79fb48150 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -56,7 +56,7 @@ public: virtual const char* GetFullDocumentation() { return - " add_test(testname Exename arg1 arg2 ...)\n" + " add_test(testname Exename arg1 arg2 ... )\n" "If the ENABLE_TESTING command has been run, this command adds a " "test target to the current directory. If ENABLE_TESTING has not " "been run, this command does nothing. " @@ -65,7 +65,7 @@ public: "built by this project or an arbitrary executable on the " "system (like tclsh). The test will be run with the current working " "directory set to the CMakeList.txt files corresponding directory " - "in the binary tree." + "in the binary tree.\n" "\n" " add_test(NAME [CONFIGURATIONS [Debug|Release|...]]\n" " COMMAND [arg1 [arg2 ...]])\n" diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index b9ce5612a..3722ab635 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -14,25 +14,135 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" -// cmBuildCommand +//---------------------------------------------------------------------- bool cmBuildCommand ::InitialPass(std::vector const& args, cmExecutionStatus &) +{ + // Support the legacy signature of the command: + // + if(2 == args.size()) + { + return this->TwoArgsSignature(args); + } + + return this->MainSignature(args); +} + +//---------------------------------------------------------------------- +bool cmBuildCommand +::MainSignature(std::vector const& args) +{ + if(args.size() < 1) + { + this->SetError("requires at least one argument naming a CMake variable"); + return false; + } + + // The cmake variable in which to store the result. + const char* variable = args[0].c_str(); + + // Parse remaining arguments. + const char* configuration = 0; + const char* project_name = 0; + const char* target = 0; + enum Doing { DoingNone, DoingConfiguration, DoingProjectName, DoingTarget }; + Doing doing = DoingNone; + for(unsigned int i=1; i < args.size(); ++i) + { + if(args[i] == "CONFIGURATION") + { + doing = DoingConfiguration; + } + else if(args[i] == "PROJECT_NAME") + { + doing = DoingProjectName; + } + else if(args[i] == "TARGET") + { + doing = DoingTarget; + } + else if(doing == DoingConfiguration) + { + doing = DoingNone; + configuration = args[i].c_str(); + } + else if(doing == DoingProjectName) + { + doing = DoingNone; + project_name = args[i].c_str(); + } + else if(doing == DoingTarget) + { + doing = DoingNone; + target = args[i].c_str(); + } + else + { + cmOStringStream e; + e << "unknown argument \"" << args[i] << "\""; + this->SetError(e.str().c_str()); + return false; + } + } + + const char* makeprogram + = this->Makefile->GetDefinition("CMAKE_MAKE_PROGRAM"); + + // If null/empty CONFIGURATION argument, GenerateBuildCommand uses 'Debug' + // in the currently implemented multi-configuration global generators... + // so we put this code here to end up with the same default configuration + // as the original 2-arg build_command signature: + // + if(!configuration || !*configuration) + { + configuration = getenv("CMAKE_CONFIG_TYPE"); + } + if(!configuration || !*configuration) + { + configuration = "Release"; + } + + // If null/empty PROJECT_NAME argument, use the Makefile's project name: + // + if(!project_name || !*project_name) + { + project_name = this->Makefile->GetProjectName(); + } + + // If null/empty TARGET argument, GenerateBuildCommand omits any mention + // of a target name on the build command line... + // + std::string makecommand = this->Makefile->GetLocalGenerator() + ->GetGlobalGenerator()->GenerateBuildCommand + (makeprogram, project_name, 0, target, configuration, true, false); + + this->Makefile->AddDefinition(variable, makecommand.c_str()); + + return true; +} + +//---------------------------------------------------------------------- +bool cmBuildCommand +::TwoArgsSignature(std::vector const& args) { if(args.size() < 2 ) { - this->SetError("called with incorrect number of arguments"); + this->SetError("called with less than two arguments"); return false; } + const char* define = args[0].c_str(); const char* cacheValue = this->Makefile->GetDefinition(define); std::string makeprogram = args[1]; + std::string configType = "Release"; const char* cfg = getenv("CMAKE_CONFIG_TYPE"); if ( cfg ) { configType = cfg; } + std::string makecommand = this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->GenerateBuildCommand (makeprogram.c_str(), this->Makefile->GetProjectName(), 0, @@ -49,4 +159,3 @@ bool cmBuildCommand cmCacheManager::STRING); return true; } - diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 9d494e7dc..703ff882c 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -37,36 +37,61 @@ public: virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); + /** + * The primary command signature with optional, KEYWORD-based args. + */ + virtual bool MainSignature(std::vector const& args); + + /** + * Legacy "exactly 2 args required" signature. + */ + virtual bool TwoArgsSignature(std::vector const& args); + /** * The name of the command as specified in CMakeList.txt. */ virtual const char* GetName() {return "build_command";} - + /** * Succinct documentation. */ virtual const char* GetTerseDocumentation() { - return "Get the command line that will build this project."; + return "Get the command line to build this project."; } - + /** * More documentation. */ virtual const char* GetFullDocumentation() { return - " build_command( )\n" - "Sets the given to a string containing the command that " - "will build this project from the root of the build tree using the " - "build tool given by . should be msdev, " - "nmake, make or one of the end user build tools. " - "This is useful for configuring testing systems."; + " build_command(\n" + " [CONFIGURATION ]\n" + " [PROJECT_NAME ]\n" + " [TARGET ])\n" + "Sets the given to a string containing the command line " + "for building one configuration of a target in a project using the " + "build tool appropriate for the current CMAKE_GENERATOR.\n" + "If CONFIGURATION is omitted, CMake chooses a reasonable default " + "value for multi-configuration generators. CONFIGURATION is " + "ignored for single-configuration generators.\n" + "If PROJECT_NAME is omitted, the resulting command line will build " + "the top level PROJECT in the current build tree.\n" + "If TARGET is omitted, the resulting command line will build " + "everything, effectively using build target 'all' or 'ALL_BUILD'.\n" + " build_command( )\n" + "This second signature is deprecated, but still available for " + "backwards compatibility. Use the first signature instead.\n" + "Sets the given to a string containing the command " + "to build this project from the root of the build tree using " + "the build tool given by . should be " + "the full path to msdev, devenv, nmake, make or one of the end " + "user build tools." + ; } - + cmTypeMacro(cmBuildCommand, cmCommand); }; - - #endif diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 6d21ab569..7b25f8e12 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -23,6 +23,7 @@ #include "cmXMLSafe.h" #include "cmVersionMacros.h" #include "cmCTestCommand.h" +#include "cmCTestStartCommand.h" #include "cmCTestBuildHandler.h" #include "cmCTestBuildAndTestHandler.h" @@ -153,6 +154,78 @@ std::string cmCTest::CurrentTime() return cmXMLSafe(cmCTest::CleanString(current_time)).str(); } +#ifdef CMAKE_BUILD_WITH_CMAKE +//---------------------------------------------------------------------------- +static size_t +HTTPResponseCallback(void *ptr, size_t size, size_t nmemb, void *data) +{ + register int realsize = (int)(size * nmemb); + + std::string *response + = static_cast(data); + const char* chPtr = static_cast(ptr); + *response += chPtr; + + return realsize; +} + +//---------------------------------------------------------------------------- +int cmCTest::HTTPRequest(std::string url, HTTPMethod method, + std::string& response, + std::string fields, + std::string putFile, int timeout) +{ + CURL* curl; + FILE* file; + ::curl_global_init(CURL_GLOBAL_ALL); + curl = ::curl_easy_init(); + + //set request options based on method + switch(method) + { + case cmCTest::HTTP_POST: + ::curl_easy_setopt(curl, CURLOPT_POST, 1); + ::curl_easy_setopt(curl, CURLOPT_POSTFIELDS, fields.c_str()); + break; + case cmCTest::HTTP_PUT: + if(!cmSystemTools::FileExists(putFile.c_str())) + { + response = "Error: File "; + response += putFile + " does not exist.\n"; + return -1; + } + ::curl_easy_setopt(curl, CURLOPT_PUT, 1); + file = ::fopen(putFile.c_str(), "rb"); + ::curl_easy_setopt(curl, CURLOPT_INFILE, file); + //fall through to append GET fields + case cmCTest::HTTP_GET: + if(fields.size()) + { + url += "?" + fields; + } + break; + default: + break; + } + + ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); + ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); + + //set response options + ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HTTPResponseCallback); + ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&response); + ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); + + CURLcode res = ::curl_easy_perform(curl); + + ::curl_easy_cleanup(curl); + ::curl_global_cleanup(); + + return static_cast(res); +} +#endif + //---------------------------------------------------------------------- std::string cmCTest::MakeURLSafe(const std::string& str) { @@ -219,12 +292,17 @@ cmCTest::cmCTest() this->ProduceXML = false; this->ShowOnly = false; this->RunConfigurationScript = false; + this->UseHTTP10 = false; + this->CompressTestOutput = true; + this->ComputedCompressOutput = false; this->TestModel = cmCTest::EXPERIMENTAL; this->MaxTestNameWidth = 30; this->InteractiveDebugMode = true; this->TimeOut = 0; + this->GlobalTimeout = 0; this->CompressXMLFiles = false; this->CTestConfigFile = ""; + this->ScheduleType = ""; this->OutputLogFile = 0; this->OutputLogFileLastTag = -1; this->SuppressUpdatingCTestConfiguration = false; @@ -294,6 +372,40 @@ void cmCTest::SetParallelLevel(int level) this->ParallelLevel = level < 1 ? 1 : level; } +//---------------------------------------------------------------------------- +bool cmCTest::ShouldCompressTestOutput() +{ + if(!this->ComputedCompressOutput) + { + std::string cdashVersion = this->GetCDashVersion(); + //version >= 1.6? + bool cdashSupportsGzip = cmSystemTools::VersionCompare( + cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.6") || + cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, + cdashVersion.c_str(), "1.6"); + this->CompressTestOutput &= cdashSupportsGzip; + this->ComputedCompressOutput = true; + } + return this->CompressTestOutput; +} + +//---------------------------------------------------------------------------- +std::string cmCTest::GetCDashVersion() +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + //First query the server. If that fails, fall back to the local setting + std::string response; + std::string url = "http://"; + url += this->GetCTestConfiguration("DropSite") + "/CDash/api/getversion.php"; + + int res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response, "", "", 3); + + return res ? this->GetCTestConfiguration("CDashVersion") : response; +#else + return this->GetCTestConfiguration("CDashVersion"); +#endif +} + //---------------------------------------------------------------------------- cmCTest::Part cmCTest::GetPartFromName(const char* name) { @@ -310,8 +422,7 @@ cmCTest::Part cmCTest::GetPartFromName(const char* name) } //---------------------------------------------------------------------- -int cmCTest::Initialize(const char* binary_dir, bool new_tag, - bool verbose_tag) +int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) { cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl); if(!this->InteractiveDebugMode) @@ -360,8 +471,14 @@ int cmCTest::Initialize(const char* binary_dir, bool new_tag, return 0; } + // call this so that the information is cached up front + // and not the first time EndTest is called. + this->ShouldCompressTestOutput(); + if ( this->ProduceXML ) { + // Verify "Testing" directory exists: + // std::string testingDir = this->BinaryDir + "/Testing"; if ( cmSystemTools::FileExists(testingDir.c_str()) ) { @@ -381,84 +498,114 @@ int cmCTest::Initialize(const char* binary_dir, bool new_tag, return 0; } } + + // Create new "TAG" file or read existing one: + // + bool createNewTag = true; + if (command) + { + createNewTag = command->ShouldCreateNewTag(); + } + std::string tagfile = testingDir + "/TAG"; std::ifstream tfin(tagfile.c_str()); std::string tag; - time_t tctime = time(0); - if ( this->TomorrowTag ) - { - tctime += ( 24 * 60 * 60 ); - } - struct tm *lctime = gmtime(&tctime); - if ( tfin && cmSystemTools::GetLineFromStream(tfin, tag) ) - { - int year = 0; - int mon = 0; - int day = 0; - int hour = 0; - int min = 0; - sscanf(tag.c_str(), "%04d%02d%02d-%02d%02d", - &year, &mon, &day, &hour, &min); - if ( year != lctime->tm_year + 1900 || - mon != lctime->tm_mon+1 || - day != lctime->tm_mday ) + + if (createNewTag) + { + time_t tctime = time(0); + if ( this->TomorrowTag ) + { + tctime += ( 24 * 60 * 60 ); + } + struct tm *lctime = gmtime(&tctime); + if ( tfin && cmSystemTools::GetLineFromStream(tfin, tag) ) { - tag = ""; + int year = 0; + int mon = 0; + int day = 0; + int hour = 0; + int min = 0; + sscanf(tag.c_str(), "%04d%02d%02d-%02d%02d", + &year, &mon, &day, &hour, &min); + if ( year != lctime->tm_year + 1900 || + mon != lctime->tm_mon+1 || + day != lctime->tm_mday ) + { + tag = ""; + } + std::string tagmode; + if ( cmSystemTools::GetLineFromStream(tfin, tagmode) ) + { + if (tagmode.size() > 4 && !this->Parts[PartStart]) + { + this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str()); + } + } + tfin.close(); } - std::string tagmode; - if ( cmSystemTools::GetLineFromStream(tfin, tagmode) ) + if (tag.size() == 0 || (0 != command) || this->Parts[PartStart]) { - if (tagmode.size() > 4 && !this->Parts[PartStart]) + cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString() + << std::endl); + cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl); + if ( this->TestModel == cmCTest::NIGHTLY ) + { + lctime = this->GetNightlyTime( + this->GetCTestConfiguration("NightlyStartTime"), + this->TomorrowTag); + } + char datestring[100]; + sprintf(datestring, "%04d%02d%02d-%02d%02d", + lctime->tm_year + 1900, + lctime->tm_mon+1, + lctime->tm_mday, + lctime->tm_hour, + lctime->tm_min); + tag = datestring; + std::ofstream ofs(tagfile.c_str()); + if ( ofs ) + { + ofs << tag << std::endl; + ofs << this->GetTestModelString() << std::endl; + } + ofs.close(); + if ( 0 == command ) { - this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str()); + cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - " + << this->GetTestModelString() << std::endl); } } - tfin.close(); } - if (tag.size() == 0 || new_tag || this->Parts[PartStart]) + else { - cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString() - << std::endl); - cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl); - if ( this->TestModel == cmCTest::NIGHTLY ) - { - lctime = this->GetNightlyTime( - this->GetCTestConfiguration("NightlyStartTime"), this->TomorrowTag); - } - char datestring[100]; - sprintf(datestring, "%04d%02d%02d-%02d%02d", - lctime->tm_year + 1900, - lctime->tm_mon+1, - lctime->tm_mday, - lctime->tm_hour, - lctime->tm_min); - tag = datestring; - std::ofstream ofs(tagfile.c_str()); - if ( ofs ) + if ( tfin ) { - ofs << tag << std::endl; - ofs << this->GetTestModelString() << std::endl; + cmSystemTools::GetLineFromStream(tfin, tag); + tfin.close(); } - ofs.close(); - if ( verbose_tag ) + + if ( tag.empty() ) { - cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - " - << this->GetTestModelString() << std::endl); + cmCTestLog(this, ERROR_MESSAGE, + "Cannot read existing TAG file in " << testingDir + << std::endl); + return 0; } + + cmCTestLog(this, OUTPUT, " Use existing tag: " << tag << " - " + << this->GetTestModelString() << std::endl); } + this->CurrentTag = tag; } + return 1; } //---------------------------------------------------------------------- -bool cmCTest::InitializeFromCommand(cmCTestCommand* command, bool first) +bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { - if ( !first && !this->CurrentTag.empty() ) - { - return true; - } - std::string src_dir = this->GetCTestConfiguration("SourceDirectory").c_str(); std::string bld_dir = this->GetCTestConfiguration("BuildDirectory").c_str(); @@ -486,17 +633,11 @@ bool cmCTest::InitializeFromCommand(cmCTestCommand* command, bool first) return false; } } - else if ( !first ) + else { cmCTestLog(this, WARNING, "Cannot locate CTest configuration: " << fname.c_str() << std::endl); } - else - { - cmCTestLog(this, HANDLER_OUTPUT, " Cannot locate CTest configuration: " - << fname.c_str() << std::endl - << " Delay the initialization of CTest" << std::endl); - } this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime", "CTEST_NIGHTLY_START_TIME"); @@ -516,12 +657,8 @@ bool cmCTest::InitializeFromCommand(cmCTestCommand* command, bool first) } } - if ( !this->Initialize(bld_dir.c_str(), true, false) ) + if ( !this->Initialize(bld_dir.c_str(), command) ) { - if ( this->GetCTestConfiguration("NightlyStartTime").empty() && first) - { - return true; - } return false; } cmCTestLog(this, OUTPUT, " Use " << this->GetTestModelString() @@ -1716,6 +1853,23 @@ void cmCTest::HandleCommandLineArguments(size_t &i, int plevel = atoi(arg.substr(2).c_str()); this->SetParallelLevel(plevel); } + + if(this->CheckArgument(arg, "--no-compress-output")) + { + this->CompressTestOutput = false; + } + + if(this->CheckArgument(arg, "--http1.0")) + { + this->UseHTTP10 = true; + } + + if(this->CheckArgument(arg, "--timeout") && i < args.size() - 1) + { + i++; + double timeout = (double)atof(args[i].c_str()); + this->GlobalTimeout = timeout; + } if(this->CheckArgument(arg, "-C", "--build-config") && i < args.size() - 1) @@ -2027,6 +2181,11 @@ int cmCTest::Run(std::vector &args, std::string* output) cmakeAndTest = true; } + if(this->CheckArgument(arg, "--schedule-random")) + { + this->ScheduleType = "Random"; + } + // pass the argument to all the handlers as well, but i may no longer be // set to what it was originally so I'm not sure this is working as // intended @@ -2107,8 +2266,8 @@ int cmCTest::Run(std::vector &args, std::string* output) it->second->SetVerbose(this->Verbose); it->second->SetSubmitIndex(this->SubmitIndex); } - if ( !this->Initialize( - cmSystemTools::GetCurrentWorkingDirectory().c_str()) ) + std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); + if(!this->Initialize(cwd.c_str(), 0)) { res = 12; cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." @@ -2769,4 +2928,3 @@ void cmCTest::OutputTestErrors(std::vector const &process_output) } cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush); } - diff --git a/Source/cmCTest.h b/Source/cmCTest.h index f401c5501..8621b10dc 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -23,6 +23,7 @@ class cmCTestGenericHandler; class cmGeneratedFileStream; class cmCTestCommand; class cmCTestScriptHandler; +class cmCTestStartCommand; #define cmCTestLog(ctSelf, logType, msg) \ do { \ @@ -79,6 +80,21 @@ public: bool Enabled; std::string Name; }; +#ifdef CMAKE_BUILD_WITH_CMAKE + enum HTTPMethod { + HTTP_GET, + HTTP_POST, + HTTP_PUT + }; + + /** + * Perform an HTTP request. + */ + static int HTTPRequest(std::string url, HTTPMethod method, + std::string& response, + std::string fields = "", + std::string putFile = "", int timeout = 0); +#endif /** Get a testing part id from its string name. Returns PartCount if the string does not name a valid part. */ @@ -93,9 +109,7 @@ public: /** * Initialize and finalize testing */ - int Initialize(const char* binary_dir, bool new_tag = false, - bool verbose_tag = true); - bool InitializeFromCommand(cmCTestCommand* command, bool first = false); + bool InitializeFromCommand(cmCTestStartCommand* command); void Finalize(); /** @@ -130,6 +144,9 @@ public: std::string const& GetConfigType(); double GetTimeOut() { return this->TimeOut; } void SetTimeOut(double t) { this->TimeOut = t; } + + double GetGlobalTimeout() { return this->GlobalTimeout; } + // how many test to run at the same time int GetParallelLevel() { return this->ParallelLevel; } void SetParallelLevel(int); @@ -191,6 +208,15 @@ public: ///! Should we only show what we would do? bool GetShowOnly(); + bool ShouldUseHTTP10() { return this->UseHTTP10; } + + bool ShouldCompressTestOutput(); + + std::string GetCDashVersion(); + + //Used for parallel ctest job scheduling + std::string GetScheduleType() { return this->ScheduleType; } + void SetScheduleType(std::string type) { this->ScheduleType = type; } ///! The max output width int GetMaxTestNameWidth() const; @@ -374,11 +400,12 @@ public: bool GetLabelSummary() { return this->LabelSummary;} private: std::string ConfigType; + std::string ScheduleType; bool Verbose; bool ExtraVerbose; bool ProduceXML; bool LabelSummary; - + bool UseHTTP10; bool Failover; bool BatchJobs; @@ -386,6 +413,9 @@ private: bool RunConfigurationScript; + //flag for lazy getter (optimization) + bool ComputedCompressOutput; + int GenerateNotesFile(const char* files); // these are helper classes @@ -416,6 +446,8 @@ private: double TimeOut; + double GlobalTimeout; + int MaxTestNameWidth; int ParallelLevel; @@ -436,12 +468,23 @@ private: bool CompressXMLFiles; + bool CompressTestOutput; + void InitStreams(); std::ostream* StreamOut; std::ostream* StreamErr; void BlockTestErrorDiagnostics(); + /** + * Initialize a dashboard run in the given build tree. The "command" + * argument is non-NULL when running from a command-driven (ctest_start) + * dashboard script, and NULL when running from the CTest command + * line. Note that a declarative dashboard script does not actually + * call this method because it sets CTEST_COMMAND to drive a build + * through the ctest command line. + */ + int Initialize(const char* binary_dir, cmCTestStartCommand* command); //! parse the option after -D and convert it into the appropriate steps bool AddTestsForDashboardType(std::string &targ); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index e1a107654..2aa623646 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -22,10 +22,6 @@ #include -#if defined(_WIN32) || defined(__CYGWIN__) -# include -#endif // _WIN32 - const char* cmCacheManagerTypes[] = { "BOOL", "PATH", diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 961d29164..9e4726cd6 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -442,9 +442,11 @@ cmDependsFortran for(std::set::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { - makeDepends << obj << ": " - << cmSystemTools::ConvertToOutputPath(i->c_str()).c_str() - << std::endl; + makeDepends << obj << ": " << + this->LocalGenerator->Convert(i->c_str(), + cmLocalGenerator::HOME_OUTPUT, + cmLocalGenerator::MAKEFILE) + << std::endl; internalDepends << " " << i->c_str() << std::endl; } makeDepends << std::endl; @@ -491,7 +493,7 @@ cmDependsFortran std::string stampFile = this->LocalGenerator->Convert(required->second.c_str(), cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::SHELL); + cmLocalGenerator::MAKEFILE); makeDepends << obj << ": " << stampFile << "\n"; } else @@ -504,7 +506,7 @@ cmDependsFortran module = this->LocalGenerator->Convert(module.c_str(), cmLocalGenerator::HOME_OUTPUT, - cmLocalGenerator::SHELL); + cmLocalGenerator::MAKEFILE); makeDepends << obj << ": " << module << "\n"; } } diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index b42f2a95c..c6f9ba5f7 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -200,6 +200,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "build files. (e.g. \"Unix Makefiles\", " "\"Visual Studio 6\", etc.)",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_EXTRA_GENERATOR", cmProperty::VARIABLE, + "The extra generator used to build the project.", + "When using the Eclipse, CodeBlocks or KDevelop generators, CMake " + "generates Makefiles (CMAKE_GENERATOR) and additionally project files " + "for the respective IDE. This IDE project file generator is stored in " + "CMAKE_EXTRA_GENERATOR (e.g. \"Eclipse CDT4\").",false, + "Variables that Provide Information"); cm->DefineProperty ("CMAKE_HOME_DIRECTORY", cmProperty::VARIABLE, "Path to top of source tree.", @@ -507,10 +515,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE_MODULE_PATH", cmProperty::VARIABLE, - "Path to look for cmake modules to load.", - "Specifies a path to override the default search path for " - "CMake modules. For example include commands will look " - "in this path first for modules to include.", + "List of directories to search for CMake modules.", + "Commands like include() and find_package() search for files in " + "directories listed by this variable before checking the default " + "modules that come with CMake.", false, "Variables That Change Behavior"); @@ -1372,10 +1380,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_SHARED_MODULE_SUFFIX_", cmProperty::VARIABLE,0,0); - cm->DefineProperty("CMAKE_SHARED_MODULE_RUNTIME__FLAG", - cmProperty::VARIABLE,0,0); - cm->DefineProperty("CMAKE_SHARED_MODULE_RUNTIME__FLAG_SEP", - cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_STATIC_LIBRARY_PREFIX_", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_STATIC_LIBRARY_SUFFIX_", diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 93eb1999e..fc2fb14f5 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -267,6 +267,8 @@ cmDocumentation::cmDocumentation() this->VariableSections.push_back("Variables That Describe the System"); this->VariableSections.push_back("Variables that Control the Build"); this->VariableSections.push_back("Variables for Languages"); + + this->ShowGenerators = true; } //---------------------------------------------------------------------------- @@ -1279,7 +1281,10 @@ bool cmDocumentation::PrintDocumentationUsage(std::ostream& os) this->ClearSections(); this->AddSectionToPrint("Usage"); this->AddSectionToPrint("Options"); - this->AddSectionToPrint("Generators"); + if(this->ShowGenerators) + { + this->AddSectionToPrint("Generators"); + } this->Print(os); return true; } diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 3a4a50635..34b83b1a4 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -57,6 +57,8 @@ public: /** Print help of the given type. */ bool PrintDocumentation(Type ht, std::ostream& os, const char* docname=0); + + void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; } /** Set the program name for standard document generation. */ void SetName(const char* name); @@ -159,6 +161,8 @@ private: const char* GetDefaultDocName(Type ht) const; bool IsOption(const char* arg) const; + bool ShowGenerators; + std::string NameString; std::string DocName; std::map AllSections; diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx deleted file mode 100644 index 877ed1315..000000000 --- a/Source/cmDumpDocumentation.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -// Program extracts documentation describing commands from -// the CMake system. -// -#include "cmake.h" - -#include "cmDocumentation.h" -#include "cmVersion.h" - -//---------------------------------------------------------------------------- -static const char *cmDocumentationName[][3] = -{ - {0, - " DumpDocumentation - Dump documentation for CMake.", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmDocumentationUsage[][3] = -{ - {0, - " DumpDocumentation [filename]", 0}, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmDocumentationDescription[][3] = -{ - {0, - "The \"DumpDocumentation\" executable is only available in the build " - "tree. It is used for testing, coverage, and documentation.", 0}, - CMAKE_STANDARD_INTRODUCTION, - {0,0,0} -}; - -//---------------------------------------------------------------------------- -static const char *cmDocumentationOptions[][3] = -{ - {"--all-for-coverage", - "Dump all documentation to stdout. For testing.", 0}, - {0,0,0} -}; - - -int DumpHTML(const char* outname) -{ - std::ofstream fout(outname); - if(!fout) - { - std::cerr << "failed to open output file: " << outname << "\n"; - cmSystemTools::ReportLastSystemError(""); - return -1; - } - - cmake cmi; - cmDocumentation doc; - std::vector commands; - cmi.GetCommandDocumentation(commands); - cmOStringStream str; - str << "Documentation for Commands of CMake " - << cmVersion::GetCMakeVersion(); - doc.SetSection(str.str().c_str(), commands); - doc.Print(cmDocumentation::HTMLForm, fout); - - return 0; -} - -int DumpForCoverageToStream(std::ostream& out) -{ - cmake cmi; - cmDocumentation doc; - std::vector commands; - std::vector generators; - cmi.GetCommandDocumentation(commands); - cmi.GetGeneratorDocumentation(generators); - doc.SetSection("Name",cmDocumentationName); - doc.SetSection("Usage",cmDocumentationUsage); - doc.SetSection("Description",cmDocumentationDescription); - doc.SetSection("options",cmDocumentationOptions); - doc.SetSection("Commands",commands); - doc.SetSection("Generators",generators); - doc.PrintDocumentation(cmDocumentation::Usage, out); - doc.PrintDocumentation(cmDocumentation::Full, out); - return 0; -} - -int DumpForCoverage(const char* outname) -{ - if(outname) - { - std::ofstream fout(outname); - if(!fout) - { - std::cerr << "failed to open output file: " << outname << "\n"; - cmSystemTools::ReportLastSystemError(""); - return -1; - } - return DumpForCoverageToStream(fout); - } - else - { - return DumpForCoverageToStream(std::cout); - } -} - -int main(int ac, char** av) -{ - cmSystemTools::EnableMSVCDebugHook(); - cmSystemTools::FindExecutableDirectory(av[0]); - const char* outname = "cmake.html"; - bool coverage = false; - if(ac > 1) - { - if(strcmp(av[1], "--all-for-coverage") == 0) - { - coverage = true; - if(ac > 2) - { - outname = av[2]; - } - else - { - outname = 0; - } - } - else - { - outname = av[1]; - } - } - - if(coverage) - { - return DumpForCoverage(outname); - } - else - { - return DumpHTML(outname); - } -} diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 4bedea357..5cbef8c37 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -545,7 +545,6 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, { std::string makefileName = makefile->GetStartOutputDirectory(); makefileName += "/Makefile"; - makefileName = cmSystemTools::ConvertToOutputPath(makefileName.c_str()); fout<<" \n"; if (target!=0) @@ -696,22 +695,27 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( std::string command = make; if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) { + std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += " /NOLOGO /f ""; - command += makefile; + command += makefileName; command += "" "; command += target; } else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) { - command += " -f "; - command += makefile; - command += " "; + // no escaping of spaces in this case, see + // http://public.kitware.com/Bug/view.php?id=10014 + std::string makefileName = makefile; + command += " -f ""; + command += makefileName; + command += "" "; command += target; } else { + std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += " -f ""; - command += makefile; + command += makefileName; command += "" "; command += target; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 0a5101ff9..fe914fd23 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -43,9 +43,9 @@ void cmExtraEclipseCDT4Generator entry.Name = this->GetName(); entry.Brief = "Generates Eclipse CDT 4.0 project files."; entry.Full = - "Project files for Eclipse will be created in the top directory " - "and will have a linked resource to every subdirectory which " - "features a CMakeLists.txt file containing a PROJECT() call." + "Project files for Eclipse will be created in the top directory. " + "In out of source builds, a linked resource to the top level source " + "directory will be created." "Additionally a hierarchy of makefiles is generated into the " "build tree. The appropriate make program can build the project through " "the default make target. A \"make install\" target is also provided."; @@ -124,10 +124,72 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const ; } + +//---------------------------------------------------------------------------- +void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, + const char* envVar, cmMakefile* mf) +{ + // get the variables from the environment and from the cache and then + // figure out which one to use: + + const char* envVarValue = getenv(envVar); + + std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; + cacheEntryName += envVar; + const char* cacheValue = mf->GetCacheManager()->GetCacheValue( + cacheEntryName.c_str()); + + // now we have both, decide which one to use + std::string valueToUse; + if (envVarValue==0 && cacheValue==0) + { + // nothing known, do nothing + valueToUse = ""; + } + else if (envVarValue!=0 && cacheValue==0) + { + // The variable is in the env, but not in the cache. Use it and put it + // in the cache + valueToUse = envVarValue; + mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(), + cacheEntryName.c_str(), cmCacheManager::STRING, + true); + mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); + } + else if (envVarValue==0 && cacheValue!=0) + { + // It is already in the cache, but not in the env, so use it from the cache + valueToUse = cacheValue; + } + else + { + // It is both in the cache and in the env. + // Use the version from the env. except if the value from the env is + // completely contained in the value from the cache (for the case that we + // now have a PATH without MSVC dirs in the env. but had the full PATH with + // all MSVC dirs during the cmake run which stored the var in the cache: + valueToUse = cacheValue; + if (valueToUse.find(envVarValue) == std::string::npos) + { + valueToUse = envVarValue; + mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(), + cacheEntryName.c_str(), cmCacheManager::STRING, + true); + mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); + } + } + + if (!valueToUse.empty()) + { + fout << envVar << "=" << valueToUse << "|"; + } +} + + //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::CreateProjectFile() { - const cmMakefile* mf + cmMakefile* mf = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); const std::string filename = this->HomeOutputDirectory + "/.project"; @@ -138,6 +200,12 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() return; } + std::string compilerId = mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"); + if (compilerId.empty()) // no C compiler, try the C++ compiler: + { + compilerId = mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"); + } + fout << "\n" "\n" @@ -214,29 +282,24 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() fout << "\t\t\t\t\n" "\t\t\t\t\torg.eclipse.cdt.make.core.environment\n" - "\t\t\t\t\tVERBOSE=1|\n" // enforce VERBOSE Makefile output - "\t\t\t\t\t" + "\t\t\t\t\tVERBOSE=1|CMAKE_NO_VERBOSE=1|" //verbose Makefile output ; // set vsvars32.bat environment available at CMake time, // but not necessarily when eclipse is open - if (make.find("nmake") != std::string::npos) + if (compilerId == "MSVC") { - if (getenv("PATH")) - { - fout << "PATH=" << getenv("PATH") << "|"; - } - if (getenv("INCLUDE")) - { - fout << "INCLUDE=" << getenv("INCLUDE") << "|"; - } - if (getenv("LIB")) - { - fout << "LIB=" << getenv("LIB") << "|"; - } - if (getenv("LIBPATH")) - { - fout << "LIBPATH=" << getenv("LIBPATH") << "|"; - } + AddEnvVar(fout, "PATH", mf); + AddEnvVar(fout, "INCLUDE", mf); + AddEnvVar(fout, "LIB", mf); + AddEnvVar(fout, "LIBPATH", mf); + AddEnvVar(fout, "INCLUDE", mf); + } + else if (compilerId == "Intel") + { + // if the env.var is set, use this one and put it in the cache + // if the env.var is not set, but the value is in the cache, + // use it from the cache: + AddEnvVar(fout, "INTEL_LICENSE_FILE", mf); } fout << "\n" @@ -285,10 +348,14 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() "\t\t\t\t\torg.eclipse.cdt.core.errorOutputParser\n" "\t\t\t\t\t" ; - if (this->GetToolChainType(*mf) == EclipseToolchainOther) + if (compilerId == "MSVC") { fout << "org.eclipse.cdt.core.VCErrorParser;"; } + else if (compilerId == "Intel") + { + fout << "org.eclipse.cdt.core.ICCErrorParser;"; + } fout << "org.eclipse.cdt.core.MakeErrorParser;" "org.eclipse.cdt.core.GCCErrorParser;" @@ -325,24 +392,24 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() if (this->IsOutOfSourceBuild) { fout << "\t\n"; - // for each sub project create a linked resource to the source dir - // - only if it is an out-of-source build - for (std::map >::const_iterator - it = this->GlobalGenerator->GetProjectMap().begin(); - it != this->GlobalGenerator->GetProjectMap().end(); - ++it) - { - std::string linkSourceDirectory = this->GetEclipsePath( - it->second[0]->GetMakefile()->GetStartDirectory()); - // .project dir can't be subdir of a linked resource dir - if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), + // create a linked resource to CMAKE_SOURCE_DIR + // (this is not done anymore for each project because of + // http://public.kitware.com/Bug/view.php?id=9978 and because I found it + // actually quite confusing in bigger projects with many directories and + // projects, Alex + + std::string sourceLinkedResourceName = "[Source directory]"; + std::string linkSourceDirectory = this->GetEclipsePath( + mf->GetStartDirectory()); + // .project dir can't be subdir of a linked resource dir + if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), linkSourceDirectory.c_str())) - { - this->AppendLinkedResource(fout, it->first, - this->GetEclipsePath(linkSourceDirectory)); - this->SrcLinkedResources.push_back(it->first); - } + { + this->AppendLinkedResource(fout, sourceLinkedResourceName, + this->GetEclipsePath(linkSourceDirectory)); + this->SrcLinkedResources.push_back(sourceLinkedResourceName); } + // for EXECUTABLE_OUTPUT_PATH when not in binary dir this->AppendOutLinkedResource(fout, mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"), @@ -418,20 +485,25 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const "\n" ; // TODO: refactor this out... - switch (this->GetToolChainType(*mf)) - { - case EclipseToolchainLinux : - fout << "\n" - ; - fout << "\n" - "\n" - "\n" - "\n" - ; - break; - case EclipseToolchainCygwin : + std::string executableFormat = mf->GetSafeDefinition( + "CMAKE_EXECUTABLE_FORMAT"); + if (executableFormat == "ELF") + { + fout << "\n" + ; + fout << "\n" + "\n" + "\n" + "\n" + ; + } + else + { + std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); + if (systemName == "CYGWIN") + { fout << "\n" "\n" @@ -440,36 +512,28 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const "\n" "\n" ; - break; - case EclipseToolchainMinGW : + } + else if (systemName == "Windows") + { fout << "\n" ; - break; - case EclipseToolchainSolaris : - fout << "\n" - ; - break; - case EclipseToolchainMacOSX : + } + else if (systemName == "Darwin") + { fout << "\n" "\n" "\n" ; - break; - case EclipseToolchainOther : - fout << "\n" - ; - fout << "\n" - ; - break; - default : + } + else + { // *** Should never get here *** fout << "\n"; - } + } + } + fout << "\n" "\n" ; @@ -828,40 +892,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } //---------------------------------------------------------------------------- -cmExtraEclipseCDT4Generator::EclipseToolchainType -cmExtraEclipseCDT4Generator::GetToolChainType(const cmMakefile& makefile) -{ - if (makefile.IsSet("UNIX")) - { - if (makefile.IsSet("CYGWIN")) - { - return EclipseToolchainCygwin; - } - if (makefile.IsSet("APPLE" )) - { - return EclipseToolchainMacOSX; - } - // *** how do I determine if it is Solaris ??? - return EclipseToolchainLinux; - } - else if (makefile.IsSet("WIN32")) - { - if (makefile.IsSet("MINGW")) - { - return EclipseToolchainMinGW; - } - if (makefile.IsSet("MSYS" )) - { - return EclipseToolchainMinGW; - } - return EclipseToolchainOther; - } - else - { - return EclipseToolchainOther; - } -} - std::string cmExtraEclipseCDT4Generator::GetEclipsePath(const std::string& path) { diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 08adc07a3..143b7fad9 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -56,18 +56,6 @@ private: // create .cproject file void CreateCProjectFile() const; - // Eclipse supported toolchain types - enum EclipseToolchainType - { - EclipseToolchainOther, - EclipseToolchainLinux, - EclipseToolchainCygwin, - EclipseToolchainMinGW, - EclipseToolchainSolaris, - EclipseToolchainMacOSX - }; - static EclipseToolchainType GetToolChainType(const cmMakefile& makefile); - // If built with cygwin cmake, convert posix to windows path. static std::string GetEclipsePath(const std::string& path); @@ -112,6 +100,9 @@ private: const std::vector& includeDirs, std::set& emittedDirs); + static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar, + cmMakefile* mf); + std::vector SrcLinkedResources; std::vector OutLinkedResources; std::string HomeDirectory; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index bce41376e..c2e90b672 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -189,9 +189,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, #elif defined( __BORLANDC__ ) S_IRUSR | S_IWUSR #else - S_IRUSR | S_IWUSR | - S_IRGRP | - S_IROTH + 0666 #endif ; @@ -202,7 +200,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, #if defined( _MSC_VER ) || defined( __MINGW32__ ) S_IREAD | S_IWRITE #else - S_IRUSR | S_IWUSR + 0666 #endif ); } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7dbbf6da0..bd58f566a 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -268,6 +268,7 @@ cmFindPackageCommand::cmFindPackageCommand() "2. Search paths specified in cmake-specific environment variables. " "These are intended to be set in the user's shell configuration. " "This can be skipped if NO_CMAKE_ENVIRONMENT_PATH is passed.\n" + " _DIR\n" " CMAKE_PREFIX_PATH\n" " CMAKE_FRAMEWORK_PATH\n" " CMAKE_APPBUNDLE_PATH\n" diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 31b833600..1a31d5428 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -101,7 +101,7 @@ bool cmGetFilenameComponentCommand if(args[2] == "REALPATH") { // Resolve symlinks if possible - result = cmSystemTools::GetRealPath(filename.c_str()); + result = cmSystemTools::GetRealPath(result.c_str()); } } else diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4734c5097..bd26b5fca 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1761,7 +1761,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) ostr.str().c_str(), &cpackCommandLines, depends, 0); } - std::string cmd; + std::string cmd = cmakeCommand; cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); singleLine.erase(singleLine.begin(), singleLine.end()); @@ -1782,18 +1782,9 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if(mf->GetDefinition("CMake_BINARY_DIR")) { // We are building CMake itself. We cannot use the original - // executable to install over itself. - cmd = mf->GetDefinition("EXECUTABLE_OUTPUT_PATH"); - if(cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.') - { - cmd += "/"; - cmd += cmakeCfgIntDir; - } - cmd += "/cmake"; - } - else - { - cmd = cmakeCommand; + // executable to install over itself. The generator will + // automatically convert this name to the build-time location. + cmd = "cmake"; } singleLine.push_back(cmd.c_str()); if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' ) @@ -2077,20 +2068,27 @@ void cmGlobalGenerator::CheckRuleHashes() std::string pfile = home; pfile += this->GetCMakeInstance()->GetCMakeFilesDirectory(); pfile += "/CMakeRuleHashes.txt"; + this->CheckRuleHashes(pfile, home); + this->WriteRuleHashes(pfile); +#endif +} +//---------------------------------------------------------------------------- +void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, + std::string const& home) +{ #if defined(_WIN32) || defined(__CYGWIN__) std::ifstream fin(pfile.c_str(), std::ios::in | std::ios::binary); #else std::ifstream fin(pfile.c_str(), std::ios::in); #endif - bool goodStream = true; if(!fin) { - goodStream = false; + return; } std::string line; std::string fname; - while(goodStream && cmSystemTools::GetLineFromStream(fin, line)) + while(cmSystemTools::GetLineFromStream(fin, line)) { // Line format is a 32-byte hex string followed by a space // followed by a file name (with no escaping). @@ -2136,7 +2134,11 @@ void cmGlobalGenerator::CheckRuleHashes() } } } +} +//---------------------------------------------------------------------------- +void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile) +{ // Now generate a new persistence file with the current hashes. if(this->RuleHashes.empty()) { @@ -2153,7 +2155,6 @@ void cmGlobalGenerator::CheckRuleHashes() fout << " " << rhi->first << "\n"; } } -#endif } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c9d07906b..878be1143 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -258,6 +258,10 @@ public: /** Supported systems creates a GUID for the given name */ virtual void CreateGUID(const char*) {} + /** Return true if the generated build tree may contain multiple builds. + i.e. "Can I build Debug and Release in the same tree?" */ + virtual bool IsMultiConfig() { return false; } + protected: typedef std::vector GeneratorVector; // for a project collect all its targets by following depend @@ -331,6 +335,8 @@ private: struct RuleHash { char Data[32]; }; std::map RuleHashes; void CheckRuleHashes(); + void CheckRuleHashes(std::string const& pfile, std::string const& home); + void WriteRuleHashes(std::string const& pfile); void WriteSummary(); void WriteSummary(cmTarget* target); diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx new file mode 100644 index 000000000..411e28bf1 --- /dev/null +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -0,0 +1,69 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalJOMMakefileGenerator.h" +#include "cmLocalUnixMakefileGenerator3.h" +#include "cmMakefile.h" + +cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() +{ + this->FindMakeProgramFile = "CMakeJOMFindMake.cmake"; + this->ForceUnixPaths = false; + this->ToolSupportsColor = true; + this->UseLinkScript = false; +} + +void cmGlobalJOMMakefileGenerator +::EnableLanguage(std::vectorconst& l, + cmMakefile *mf, + bool optional) +{ + // pick a default + mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); + mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); + if(!(cmSystemTools::GetEnv("INCLUDE") && + cmSystemTools::GetEnv("LIB")) + ) + { + std::string message = "To use the JOM generator, cmake must be run " + "from a shell that can use the compiler cl from the command line. " + "This environment does not contain INCLUDE, LIB, or LIBPATH, and " + "these must be set for the cl compiler to work. "; + mf->IssueMessage(cmake::WARNING, + message); + } + + this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalJOMMakefileGenerator::CreateLocalGenerator() +{ + cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + lg->SetDefineWindowsNULL(true); + lg->SetWindowsShell(true); + lg->SetMakeSilentFlag("/nologo"); + lg->SetGlobalGenerator(this); + lg->SetIgnoreLibPrefix(true); + lg->SetPassMakeflags(true); + lg->SetNMake(true); + lg->SetUnixCD(false); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalJOMMakefileGenerator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates JOM makefiles."; + entry.Full = ""; +} diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h new file mode 100644 index 000000000..08be4b4fc --- /dev/null +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -0,0 +1,49 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalJOMMakefileGenerator_h +#define cmGlobalJOMMakefileGenerator_h + +#include "cmGlobalUnixMakefileGenerator3.h" + +/** \class cmGlobalJOMMakefileGenerator + * \brief Write a JOM makefiles. + * + * cmGlobalJOMMakefileGenerator manages nmake build process for a tree + */ +class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3 +{ +public: + cmGlobalJOMMakefileGenerator(); + static cmGlobalGenerator* New() { + return new cmGlobalJOMMakefileGenerator; } + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalJOMMakefileGenerator::GetActualName();} + // use NMake Makefiles in the name so that scripts/tests that depend on the + // name NMake Makefiles will work + static const char* GetActualName() {return "NMake Makefiles JOM";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vectorconst& languages, + cmMakefile *, bool optional); +}; + +#endif diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 6ceec489e..56b9e9c54 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -475,6 +475,7 @@ void cmGlobalKdevelopGenerator " \n" " \n" " \n" + " \n" " \n" " \n" " \n"; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx old mode 100755 new mode 100644 index abe66a88f..691502f1a --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -25,6 +25,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) { mf->AddDefinition("MSVC10", "1"); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h old mode 100755 new mode 100644 index 9e4e474a0..219c36ef7 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -67,7 +67,7 @@ public: */ virtual std::string GetUserMacrosRegKeyBase(); virtual const char* GetCMakeCFGInitDirectory() - { return "$(ConfigurationName)";} + { return "$(Configuration)";} protected: virtual const char* GetIDEVersion() { return "10.0"; } }; diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx index 0e821c72a..1004fa98f 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx @@ -29,9 +29,11 @@ void cmGlobalVisualStudio10Win64Generator } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Win64Generator::EnableLanguage( - std::vector const& lang, cmMakefile *mf, bool optional) +void cmGlobalVisualStudio10Win64Generator +::AddPlatformDefinitions(cmMakefile* mf) { + this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - cmGlobalVisualStudio10Generator::EnableLanguage(lang, mf, optional); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h index 51b68c028..98ba03ceb 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.h +++ b/Source/cmGlobalVisualStudio10Win64Generator.h @@ -30,7 +30,7 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - virtual void EnableLanguage(std::vectorconst& languages, - cmMakefile *, bool optional); + virtual void AddPlatformDefinitions(cmMakefile* mf); + }; #endif diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 783db2194..d053ca2c3 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -44,6 +44,8 @@ void cmGlobalVisualStudio6Generator mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_Fortran", "ifort"); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC60", "1"); this->GenerateConfigurations(mf); this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index c7014aa29..d608aac3a 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -36,6 +36,7 @@ cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalVisualStudio71Generator::AddPlatformDefinitions(cmMakefile* mf) { + this->cmGlobalVisualStudio7Generator::AddPlatformDefinitions(mf); mf->AddDefinition("MSVC71", "1"); } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index ea9065ebf..9631e9a31 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -31,7 +31,6 @@ void cmGlobalVisualStudio7Generator mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort"); - this->AddPlatformDefinitions(mf); // Create list of configurations requested by user's cache, if any. @@ -59,6 +58,8 @@ void cmGlobalVisualStudio7Generator void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) { mf->AddDefinition("MSVC70", "1"); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); } std::string cmGlobalVisualStudio7Generator diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 8aec865b6..e42317426 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -55,6 +55,8 @@ void cmGlobalVisualStudio8Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) { + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC80", "1"); } diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx index aa756d8b6..d5558bb91 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx @@ -42,10 +42,12 @@ void cmGlobalVisualStudio8Win64Generator entry.Full = ""; } +//---------------------------------------------------------------------------- void cmGlobalVisualStudio8Win64Generator -::EnableLanguage(std::vectorconst & lang, - cmMakefile *mf, bool optional) +::AddPlatformDefinitions(cmMakefile* mf) { + this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h index 2d41a3615..44c237cd4 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.h +++ b/Source/cmGlobalVisualStudio8Win64Generator.h @@ -43,7 +43,6 @@ public: * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, - cmMakefile *, bool optional); + virtual void AddPlatformDefinitions(cmMakefile *); }; #endif diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 75fe90001..f6ae70599 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -25,6 +25,8 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() //---------------------------------------------------------------------------- void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf) { + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); mf->AddDefinition("MSVC90", "1"); } diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx index 288480fa4..c5b9babfd 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio9Win64Generator.cxx @@ -39,10 +39,12 @@ void cmGlobalVisualStudio9Win64Generator entry.Full = ""; } +//---------------------------------------------------------------------------- void cmGlobalVisualStudio9Win64Generator -::EnableLanguage(std::vectorconst & lang, - cmMakefile *mf, bool optional) +::AddPlatformDefinitions(cmMakefile* mf) { + cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - cmGlobalVisualStudio9Generator::EnableLanguage(lang, mf, optional); + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h index 698d20ef9..55abcfc56 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.h +++ b/Source/cmGlobalVisualStudio9Win64Generator.h @@ -43,7 +43,6 @@ public: * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. */ - virtual void EnableLanguage(std::vectorconst& languages, - cmMakefile *, bool optional); + virtual void AddPlatformDefinitions(cmMakefile *); }; #endif diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 0c7cf7fed..b0be0871d 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -65,6 +65,11 @@ public: /** Get the top-level registry key for this VS version. */ std::string GetRegistryBase(); + + /** Return true if the generated build tree may contain multiple builds. + i.e. "Can I build Debug and Release in the same tree?" */ + virtual bool IsMultiConfig() { return true; } + protected: void FixUtilityDepends(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e548230c8..0d6e389ec 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1532,6 +1532,34 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } } + // Set target-specific architectures. + std::vector archs; + target.GetAppleArchs(configName, archs); + if(!archs.empty()) + { + // Enable ARCHS attribute. + buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", + this->CreateString("NO")); + + // Store ARCHS value. + if(archs.size() == 1) + { + buildSettings->AddAttribute("ARCHS", + this->CreateString(archs[0].c_str())); + } + else + { + cmXCodeObject* archObjects = + this->CreateObject(cmXCodeObject::OBJECT_LIST); + for(std::vector::iterator i = archs.begin(); + i != archs.end(); i++) + { + archObjects->AddObject(this->CreateString((*i).c_str())); + } + buildSettings->AddAttribute("ARCHS", archObjects); + } + } + // Get the product name components. std::string pnprefix; std::string pnbase; @@ -1549,7 +1577,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, target.GetType() == cmTarget::MODULE_LIBRARY || target.GetType() == cmTarget::EXECUTABLE) { - pndir = target.GetDirectory(); + if(this->XcodeVersion >= 21) + { + std::string pncdir = target.GetDirectory(configName); + buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR", + this->CreateString(pncdir.c_str())); + } + else + { + buildSettings->AddAttribute("OBJROOT", + this->CreateString(pndir.c_str())); + pndir = target.GetDirectory(configName); + } buildSettings->AddAttribute("EXECUTABLE_PREFIX", this->CreateString(pnprefix.c_str())); buildSettings->AddAttribute("EXECUTABLE_SUFFIX", @@ -2719,6 +2758,22 @@ void cmGlobalXCodeGenerator this->CreateString(deploymentTarget)); } + // Put this last so it can override existing settings + // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. + { + std::vector vars = this->CurrentMakefile->GetDefinitions(); + for(std::vector::const_iterator i = vars.begin(); + i != vars.end(); ++i) + { + if(i->find("CMAKE_XCODE_ATTRIBUTE_") == 0) + { + buildSettings->AddAttribute(i->substr(22).c_str(), + this->CreateString( + this->CurrentMakefile->GetDefinition(i->c_str()))); + } + } + } + std::string symroot = root->GetMakefile()->GetCurrentOutputDirectory(); symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); @@ -2895,7 +2950,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( // then remove those exectuables as well if(this->Architectures.size() > 1) { - std::string universal = t->GetDirectory(); + std::string universal = + t->GetMakefile()->GetCurrentOutputDirectory(); universal += "/"; universal += this->CurrentProject; universal += ".build/"; @@ -3262,3 +3318,18 @@ cmGlobalXCodeGenerator::ComputeInfoPListLocation(cmTarget& target) plist += ".dir/Info.plist"; return plist; } + +//---------------------------------------------------------------------------- +// Return true if the generated build tree may contain multiple builds. +// i.e. "Can I build Debug and Release in the same tree?" +bool cmGlobalXCodeGenerator::IsMultiConfig() +{ + // Old Xcode 1.5 is single config: + if(this->XcodeVersion == 15) + { + return false; + } + + // Newer Xcode versions are multi config: + return true; +} diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 02ac1b523..b4de80538 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -80,6 +80,11 @@ public: std::vector& dirs); void SetCurrentLocalGenerator(cmLocalGenerator*); + + /** Return true if the generated build tree may contain multiple builds. + i.e. "Can I build Debug and Release in the same tree?" */ + virtual bool IsMultiConfig(); + private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 76bbd0c29..22ba28f93 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -525,6 +525,13 @@ namespace cmSystemTools::FileIsDirectory((argP1)->c_str()), reducible, arg, newArgs, argP1, argP2); } + // does a symlink with this name exist + if (*arg == "IS_SYMLINK" && argP1 != newArgs.end()) + { + HandlePredicate( + cmSystemTools::FileIsSymlink((argP1)->c_str()), + reducible, arg, newArgs, argP1, argP2); + } // is the given path an absolute path ? if (*arg == "IS_ABSOLUTE" && argP1 != newArgs.end()) { diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 74692b7d9..107a8923b 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -158,6 +158,9 @@ public: " if(IS_DIRECTORY directory-name)\n" "True if the given name is a directory. " "Behavior is well-defined only for full paths.\n" + " if(IS_SYMLINK file-name)\n" + "True if the given name is a symbolic link. " + "Behavior is well-defined only for full paths.\n" " if(IS_ABSOLUTE path)\n" "True if the given path is an absolute path.\n" " if(variable MATCHES regex)\n" diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index e4bd7a422..33ffbfb3c 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -75,19 +75,12 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary); fromDirConfig += "/"; } - - // Compute the full path to the main installed file for this target. - NameType nameType = this->ImportLibrary? NameImplib : NameNormal; - std::string toInstallPath = this->GetInstallDestination(); - toInstallPath += "/"; - toInstallPath += this->GetInstallFilename(this->Target, config, nameType); - - // Track whether post-install operations should be added to the - // script. - bool tweakInstalledFile = true; + std::string toDir = this->GetInstallDestination(); + toDir += "/"; // Compute the list of files to install for this target. - std::vector files; + std::vector filesFrom; + std::vector filesTo; std::string literal_args; cmTarget::TargetType type = this->Target->GetType(); if(type == cmTarget::EXECUTABLE) @@ -104,49 +97,45 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, config); if(this->ImportLibrary) { - std::string from1 = fromDirConfig; - from1 += targetNameImport; - files.push_back(from1); + std::string from1 = fromDirConfig + targetNameImport; + std::string to1 = toDir + targetNameImport; + filesFrom.push_back(from1); + filesTo.push_back(to1); // An import library looks like a static library. type = cmTarget::STATIC_LIBRARY; } else { - std::string from1 = fromDirConfig; - from1 += targetName; + std::string from1 = fromDirConfig + targetName; + std::string to1 = toDir + targetName; // Handle OSX Bundles. if(this->Target->IsAppBundleOnApple()) { - // Compute the source locations of the bundle executable and - // Info.plist file. - from1 += ".app"; - files.push_back(from1); + // Install the whole app bundle directory. type = cmTarget::INSTALL_DIRECTORY; - // Need to apply install_name_tool and stripping to binary - // inside bundle. - toInstallPath += ".app/Contents/MacOS/"; - toInstallPath += - this->GetInstallFilename(this->Target, config, nameType); literal_args += " USE_SOURCE_PERMISSIONS"; + from1 += ".app"; + + // Tweaks apply to the binary inside the bundle. + to1 += ".app/Contents/MacOS/"; + to1 += targetName; } else { - // Operations done at install time on the installed file should - // be done on the real file and not any of the symlinks. - toInstallPath = this->GetInstallDestination(); - toInstallPath += "/"; - toInstallPath += targetNameReal; - - files.push_back(from1); + // Tweaks apply to the real file, so list it first. if(targetNameReal != targetName) { - std::string from2 = fromDirConfig; - from2 += targetNameReal; - files.push_back(from2); + std::string from2 = fromDirConfig + targetNameReal; + std::string to2 = toDir += targetNameReal; + filesFrom.push_back(from2); + filesTo.push_back(to2); } } + + filesFrom.push_back(from1); + filesTo.push_back(to1); } } else @@ -164,9 +153,10 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); - std::string from1 = fromDirConfig; - from1 += targetNameImport; - files.push_back(from1); + std::string from1 = fromDirConfig + targetNameImport; + std::string to1 = toDir + targetNameImport; + filesFrom.push_back(from1); + filesTo.push_back(to1); // An import library looks like a static library. type = cmTarget::STATIC_LIBRARY; @@ -176,51 +166,48 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); - // Compute the build tree location of the framework directory - std::string from1 = fromDirConfig; - from1 += targetName; - from1 += ".framework"; - files.push_back(from1); - + // Install the whole framework directory. type = cmTarget::INSTALL_DIRECTORY; + literal_args += " USE_SOURCE_PERMISSIONS"; + std::string from1 = fromDirConfig + targetName + ".framework"; - // Need to apply install_name_tool and stripping to binary - // inside framework. - toInstallPath += ".framework/Versions/"; - toInstallPath += this->Target->GetFrameworkVersion(); - toInstallPath += "/"; - toInstallPath += this->GetInstallFilename(this->Target, config, - NameNormal); + // Tweaks apply to the binary inside the bundle. + std::string to1 = toDir + targetName; + to1 += ".framework/Versions/"; + to1 += this->Target->GetFrameworkVersion(); + to1 += "/"; + to1 += targetName; - literal_args += " USE_SOURCE_PERMISSIONS"; + filesFrom.push_back(from1); + filesTo.push_back(to1); } else { - // Operations done at install time on the installed file should - // be done on the real file and not any of the symlinks. - toInstallPath = this->GetInstallDestination(); - toInstallPath += "/"; - toInstallPath += targetNameReal; - - // Construct the list of file names to install for this library. bool haveNamelink = false; - std::string fromName; + + // Library link name. + std::string fromName = fromDirConfig + targetName; + std::string toName = toDir + targetName; + + // Library interface name. std::string fromSOName; - std::string fromRealName; - fromName = fromDirConfig; - fromName += targetName; + std::string toSOName; if(targetNameSO != targetName) { haveNamelink = true; - fromSOName = fromDirConfig; - fromSOName += targetNameSO; + fromSOName = fromDirConfig + targetNameSO; + toSOName = toDir + targetNameSO; } + + // Library implementation name. + std::string fromRealName; + std::string toRealName; if(targetNameReal != targetName && targetNameReal != targetNameSO) { haveNamelink = true; - fromRealName = fromDirConfig; - fromRealName += targetNameReal; + fromRealName = fromDirConfig + targetNameReal; + toRealName = toDir + targetNameReal; } // Add the names based on the current namelink mode. @@ -230,27 +217,30 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, if(this->NamelinkMode == NamelinkModeOnly) { // Install the namelink only. - files.push_back(fromName); - tweakInstalledFile = false; + filesFrom.push_back(fromName); + filesTo.push_back(toName); } else { // Install the real file if it has its own name. if(!fromRealName.empty()) { - files.push_back(fromRealName); + filesFrom.push_back(fromRealName); + filesTo.push_back(toRealName); } // Install the soname link if it has its own name. if(!fromSOName.empty()) { - files.push_back(fromSOName); + filesFrom.push_back(fromSOName); + filesTo.push_back(toSOName); } // Install the namelink if it is not to be skipped. if(this->NamelinkMode != NamelinkModeSkip) { - files.push_back(fromName); + filesFrom.push_back(fromName); + filesTo.push_back(toName); } } } @@ -260,73 +250,39 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, // if this is not a namelink-only rule. if(this->NamelinkMode != NamelinkModeOnly) { - files.push_back(fromName); + filesFrom.push_back(fromName); + filesTo.push_back(toName); } } } } + // If this fails the above code is buggy. + assert(filesFrom.size() == filesTo.size()); + // Skip this rule if no files are to be installed for the target. - if(files.empty()) + if(filesFrom.empty()) { return; } - // Construct the path of the file on disk after installation on - // which tweaks may be performed. - std::string toDestDirPath = "$ENV{DESTDIR}"; - if(toInstallPath[0] != '/' && toInstallPath[0] != '$') - { - toDestDirPath += "/"; - } - toDestDirPath += toInstallPath; - // Add pre-installation tweaks. - if(tweakInstalledFile) - { - // Collect tweaking rules. - cmOStringStream tw; - this->AddRPathCheckRule(tw, indent.Next(), config, toDestDirPath); - std::string tws = tw.str(); - - // Add the rules, if any. - if(!tws.empty()) - { - os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n"; - os << tws; - os << indent << "ENDIF(EXISTS \"" << toDestDirPath << "\")\n"; - } - } + this->AddTweak(os, indent, config, filesTo, + &cmInstallTargetGenerator::PreReplacementTweaks); // Write code to install the target file. const char* no_dir_permissions = 0; const char* no_rename = 0; bool optional = this->Optional || this->ImportLibrary; - this->AddInstallRule(os, type, files, + this->AddInstallRule(os, type, filesFrom, optional, this->FilePermissions.c_str(), no_dir_permissions, no_rename, literal_args.c_str(), indent); // Add post-installation tweaks. - if(tweakInstalledFile) - { - // Collect tweaking rules. - cmOStringStream tw; - this->AddInstallNamePatchRule(tw, indent.Next(), config, toDestDirPath); - this->AddChrpathPatchRule(tw, indent.Next(), config, toDestDirPath); - this->AddRanlibRule(tw, indent.Next(), type, toDestDirPath); - this->AddStripRule(tw, indent.Next(), type, toDestDirPath); - std::string tws = tw.str(); - - // Add the rules, if any. - if(!tws.empty()) - { - os << indent << "IF(EXISTS \"" << toDestDirPath << "\")\n"; - os << tws; - os << indent << "ENDIF(EXISTS \"" << toDestDirPath << "\")\n"; - } - } + this->AddTweak(os, indent, config, filesTo, + &cmInstallTargetGenerator::PostReplacementTweaks); } //---------------------------------------------------------------------------- @@ -405,6 +361,92 @@ std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget* target, return fname; } +//---------------------------------------------------------------------------- +void +cmInstallTargetGenerator +::AddTweak(std::ostream& os, Indent const& indent, const char* config, + std::string const& file, TweakMethod tweak) +{ + cmOStringStream tw; + (this->*tweak)(tw, indent.Next(), config, file); + std::string tws = tw.str(); + if(!tws.empty()) + { + os << indent << "IF(EXISTS \"" << file << "\" AND\n" + << indent << " NOT IS_SYMLINK \"" << file << "\")\n"; + os << tws; + os << indent << "ENDIF()\n"; + } +} + +//---------------------------------------------------------------------------- +void +cmInstallTargetGenerator +::AddTweak(std::ostream& os, Indent const& indent, const char* config, + std::vector const& files, TweakMethod tweak) +{ + if(files.size() == 1) + { + // Tweak a single file. + this->AddTweak(os, indent, config, this->GetDestDirPath(files[0]), tweak); + } + else + { + // Generate a foreach loop to tweak multiple files. + cmOStringStream tw; + this->AddTweak(tw, indent.Next(), config, "${file}", tweak); + std::string tws = tw.str(); + if(!tws.empty()) + { + Indent indent2 = indent.Next().Next(); + os << indent << "FOREACH(file\n"; + for(std::vector::const_iterator i = files.begin(); + i != files.end(); ++i) + { + os << indent2 << "\"" << this->GetDestDirPath(*i) << "\"\n"; + } + os << indent2 << ")\n"; + os << tws; + os << indent << "ENDFOREACH()\n"; + } + } +} + +//---------------------------------------------------------------------------- +std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file) +{ + // Construct the path of the file on disk after installation on + // which tweaks may be performed. + std::string toDestDirPath = "$ENV{DESTDIR}"; + if(file[0] != '/' && file[0] != '$') + { + toDestDirPath += "/"; + } + toDestDirPath += file; + return toDestDirPath; +} + +//---------------------------------------------------------------------------- +void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, + Indent const& indent, + const char* config, + std::string const& file) +{ + this->AddRPathCheckRule(os, indent, config, file); +} + +//---------------------------------------------------------------------------- +void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, + Indent const& indent, + const char* config, + std::string const& file) +{ + this->AddInstallNamePatchRule(os, indent, config, file); + this->AddChrpathPatchRule(os, indent, config, file); + this->AddRanlibRule(os, indent, file); + this->AddStripRule(os, indent, file); +} + //---------------------------------------------------------------------------- void cmInstallTargetGenerator @@ -599,13 +641,12 @@ cmInstallTargetGenerator void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent const& indent, - cmTarget::TargetType type, const std::string& toDestDirPath) { // don't strip static libraries, because it removes the only symbol table // they have so you can't link to them anymore - if(type == cmTarget::STATIC_LIBRARY) + if(this->Target->GetType() == cmTarget::STATIC_LIBRARY) { return; } @@ -633,11 +674,10 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os, void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent const& indent, - cmTarget::TargetType type, const std::string& toDestDirPath) { // Static libraries need ranlib on this platform. - if(type != cmTarget::STATIC_LIBRARY) + if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { return; } diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 978c30252..b48d45661 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -63,6 +63,20 @@ protected: virtual void GenerateScriptForConfig(std::ostream& os, const char* config, Indent const& indent); + typedef void (cmInstallTargetGenerator::*TweakMethod)( + std::ostream&, Indent const&, const char*, std::string const& + ); + void AddTweak(std::ostream& os, Indent const& indent, + const char* config, std::string const& file, + TweakMethod tweak); + void AddTweak(std::ostream& os, Indent const& indent, + const char* config, std::vector const& files, + TweakMethod tweak); + std::string GetDestDirPath(std::string const& file); + void PreReplacementTweaks(std::ostream& os, Indent const& indent, + const char* config, std::string const& file); + void PostReplacementTweaks(std::ostream& os, Indent const& indent, + const char* config, std::string const& file); void AddInstallNamePatchRule(std::ostream& os, Indent const& indent, const char* config, const std::string& toDestDirPath); @@ -74,10 +88,8 @@ protected: std::string const& toDestDirPath); void AddStripRule(std::ostream& os, Indent const& indent, - cmTarget::TargetType type, const std::string& toDestDirPath); void AddRanlibRule(std::ostream& os, Indent const& indent, - cmTarget::TargetType type, const std::string& toDestDirPath); cmTarget* Target; diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 697376f2c..4412414a4 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -23,10 +23,48 @@ bool cmLinkDirectoriesCommand for(std::vector::const_iterator i = args.begin(); i != args.end(); ++i) { - std::string unixPath = *i; - cmSystemTools::ConvertToUnixSlashes(unixPath); - this->Makefile->AddLinkDirectory(unixPath.c_str()); + this->AddLinkDir(*i); } return true; } +//---------------------------------------------------------------------------- +void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) +{ + std::string unixPath = dir; + cmSystemTools::ConvertToUnixSlashes(unixPath); + if(!cmSystemTools::FileIsFullPath(unixPath.c_str())) + { + bool convertToAbsolute = false; + cmOStringStream e; + e << "This command specifies the relative path\n" + << " " << unixPath << "\n" + << "as a link directory.\n"; + cmPolicies* policies = this->Makefile->GetPolicies(); + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) + { + case cmPolicies::WARN: + e << policies->GetPolicyWarning(cmPolicies::CMP0015); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + case cmPolicies::OLD: + // OLD behavior does not convert + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + e << policies->GetRequiredPolicyError(cmPolicies::CMP0015); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + case cmPolicies::NEW: + // NEW behavior converts + convertToAbsolute = true; + break; + } + if (convertToAbsolute) + { + std::string tmp = this->Makefile->GetStartDirectory(); + tmp += "/"; + tmp += unixPath; + unixPath = tmp; + } + } + this->Makefile->AddLinkDirectory(unixPath.c_str()); +} diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index 73673c440..e5ff4f0f3 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -70,6 +70,8 @@ public: } cmTypeMacro(cmLinkDirectoriesCommand, cmCommand); +private: + void AddLinkDir(std::string const& dir); }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c4ee5c793..851e34f57 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -712,6 +712,9 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string langFlags; this->AddLanguageFlags(langFlags, llang, 0); +#ifdef __APPLE__ + this->AddArchitectureFlags(langFlags, &target, llang, 0); +#endif /* __APPLE__ */ vars.LanguageCompileFlags = langFlags.c_str(); cmCustomCommandLines commandLines; @@ -908,6 +911,16 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, } return targetQuoted; } + if(variable == "TARGET_UNQUOTED") + { + std::string unquoted = replaceValues.Target; + std::string::size_type sz = unquoted.size(); + if(sz > 2 && unquoted[0] == '\"' && unquoted[sz-1] == '\"') + { + unquoted = unquoted.substr(1, sz-2); + } + return unquoted; + } if(replaceValues.LanguageCompileFlags) { if(variable == "LANGUAGE_COMPILE_FLAGS") @@ -1751,21 +1764,18 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, } } + //---------------------------------------------------------------------------- -void cmLocalGenerator::AddLanguageFlags(std::string& flags, - const char* lang, - const char* config) -{ - // Add language-specific flags. - std::string flagsVar = "CMAKE_"; - flagsVar += lang; - flagsVar += "_FLAGS"; - // Add special OSX flags #ifdef __APPLE__ +void cmLocalGenerator::AddArchitectureFlags(std::string& flags, + cmTarget* target, + const char *lang, + const char* config) +{ if(this->EmitUniversalBinaryFlags) { - const char* osxArch = - this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); + std::vector archs; + target->GetAppleArchs(config, archs); const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); const char* sysrootDefault = @@ -1774,25 +1784,18 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT"; bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str()); + std::string deploymentTargetFlagVar = + std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; + const char* deploymentTargetFlag = + this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); bool flagsUsed = false; - if(osxArch && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) + if(!archs.empty() && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) { - std::vector archs; - cmSystemTools::ExpandListArgument(std::string(osxArch), - archs); - bool addArchFlag = false; - if(archs.size() >= 1) - { - if(archs[0] != "") - { - addArchFlag = true; - } - } // if there is more than one arch add the -arch and // -isysroot flags, or if there is one arch flag, but // it is not the default -arch flag for the system, then // add it. Otherwize do not add -arch and -isysroot - if(addArchFlag) + if(archs[0] != "") { for( std::vector::iterator i = archs.begin(); i != archs.end(); ++i) @@ -1816,14 +1819,27 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, flags += sysroot; } - if (deploymentTarget && *deploymentTarget && - lang && (lang[0] =='C' || lang[0] == 'F')) + if (deploymentTargetFlag && *deploymentTargetFlag && + deploymentTarget && *deploymentTarget) { - flags += " -mmacosx-version-min="; + flags += " "; + flags += deploymentTargetFlag; flags += deploymentTarget; } } -#endif +} +#endif /* __APPLE__ */ + + +//---------------------------------------------------------------------------- +void cmLocalGenerator::AddLanguageFlags(std::string& flags, + const char* lang, + const char* config) +{ + // Add language-specific flags. + std::string flagsVar = "CMAKE_"; + flagsVar += lang; + flagsVar += "_FLAGS"; this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index d2082e422..becdfff7b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -133,6 +133,11 @@ public: std::vector& GetChildren() { return this->Children; }; +#ifdef __APPLE__ + void AddArchitectureFlags(std::string& flags, cmTarget* target, + const char *lang, const char* config); +#endif /* __APPLE__ */ + void AddLanguageFlags(std::string& flags, const char* lang, const char* config); void AddSharedFlags(std::string& flags, const char* lang, bool shared); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx old mode 100755 new mode 100644 diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h old mode 100755 new mode 100644 diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 3719b5f52..2cf840df2 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -825,6 +825,34 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, } } +//---------------------------------------------------------------------------- +cmsys::auto_ptr +cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, + const char* config) +{ + cmsys::auto_ptr pcc; + + // VS6 forgets to create the output directory for archives if it + // differs from the intermediate directory. + if(target.GetType() != cmTarget::STATIC_LIBRARY) { return pcc; } + std::string outDir = target.GetDirectory(config, false); + + // Add a pre-link event to create the directory. + cmCustomCommandLine command; + command.push_back(this->Makefile->GetRequiredDefinition("CMAKE_COMMAND")); + command.push_back("-E"); + command.push_back("make_directory"); + command.push_back(outDir); + std::vector no_output; + std::vector no_depends; + cmCustomCommandLines commands; + commands.push_back(command); + pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0)); + pcc->SetEscapeOldStyle(false); + pcc->SetEscapeAllowMakeVars(true); + return pcc; +} + // look for custom rules on a target and collect them together std::string cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, @@ -845,6 +873,11 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, event.Write(target.GetPreLinkCommands()); cmsys::auto_ptr pcc( this->MaybeCreateImplibDir(target, configName)); + if(pcc.get()) + { + event.Write(*pcc); + } + pcc = this->MaybeCreateOutputDir(target, configName); if(pcc.get()) { event.Write(*pcc); @@ -1193,6 +1226,30 @@ void cmLocalVisualStudio6Generator outputNameRelWithDebInfo = target.GetFullName("RelWithDebInfo"); } + // Compute the output directory for the target. + std::string outputDirDebug; + std::string outputDirRelease; + std::string outputDirMinSizeRel; + std::string outputDirRelWithDebInfo; + if(target.GetType() == cmTarget::EXECUTABLE || + target.GetType() == cmTarget::STATIC_LIBRARY || + target.GetType() == cmTarget::SHARED_LIBRARY || + target.GetType() == cmTarget::MODULE_LIBRARY) + { + outputDirDebug = + removeQuotes(this->ConvertToOptionallyRelativeOutputPath( + target.GetDirectory("Debug").c_str())); + outputDirRelease = + removeQuotes(this->ConvertToOptionallyRelativeOutputPath( + target.GetDirectory("Release").c_str())); + outputDirMinSizeRel = + removeQuotes(this->ConvertToOptionallyRelativeOutputPath( + target.GetDirectory("MinSizeRel").c_str())); + outputDirRelWithDebInfo = + removeQuotes(this->ConvertToOptionallyRelativeOutputPath( + target.GetDirectory("RelWithDebInfo").c_str())); + } + // Compute the proper link information for the target. std::string optionsDebug; std::string optionsRelease; @@ -1412,11 +1469,21 @@ void cmLocalVisualStudio6Generator if(targetBuilds) { + cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_DEBUG", + outputDirDebug.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_RELEASE", + outputDirRelease.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_MINSIZEREL", + outputDirMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_RELWITHDEBINFO", + outputDirRelWithDebInfo.c_str()); +#ifdef CM_USE_OLD_VS6 std::string outPath = target.GetDirectory(); cmSystemTools::ReplaceString (line, "OUTPUT_DIRECTORY", removeQuotes(this->ConvertToOptionallyRelativeOutputPath (outPath.c_str())).c_str()); +#endif } cmSystemTools::ReplaceString(line, diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 727986903..195d654bc 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -81,6 +81,8 @@ private: std::ostream &fout, const char *libName); class EventWriter; friend class EventWriter; + cmsys::auto_ptr + MaybeCreateOutputDir(cmTarget& target, const char* config); std::string CreateTargetRules(cmTarget &target, const char* configName, const char *libName); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 208480891..1af0d1d42 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -744,7 +744,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // We need to specify a program database file name even for // non-debug configurations because VS still creates .idb files. fout << "\t\t\t\tProgramDataBaseFileName=\"" - << target.GetDirectory(configName) << "/" + << this->ConvertToXMLOutputPathSingle( + target.GetDirectory(configName).c_str()) + << "/" << target.GetPDBName(configName) << "\"\n"; } fout << "/>\n"; // end of OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; + std::string path = this->ConvertToXMLOutputPathSingle( + target.GetDirectory(configName).c_str()); fout << "\t\t\t\tProgramDataBaseFile=\"" - << target.GetDirectory(configName) << "/" << targetNamePDB + << path << "/" << targetNamePDB << "\"\n"; if(isDebug) { @@ -1420,6 +1424,10 @@ void cmLocalVisualStudio7Generator else if(!fcinfo.FileConfigMap.empty()) { const char* aCompilerTool = "VCCLCompilerTool"; + if(this->FortranProject) + { + aCompilerTool = "VFFortranCompilerTool"; + } std::string ext = (*sf)->GetExtension(); ext = cmSystemTools::LowerCase(ext); if(ext == "idl") diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index a20c91721..e7c4a7d71 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -229,6 +229,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Add language feature flags. this->AddFeatureFlags(flags, linkLanguage); +#ifdef __APPLE__ + this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + linkLanguage, this->ConfigName); +#endif /* __APPLE__ */ + // Add target-specific linker flags. this->LocalGenerator->AppendFlags (linkFlags, this->Target->GetProperty("LINK_FLAGS")); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 4070a3bfc..f3511740d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -682,6 +682,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string langFlags; this->AddFeatureFlags(langFlags, linkLanguage); +#ifdef __APPLE__ + this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target, + linkLanguage, this->ConfigName); +#endif /* __APPLE__ */ + // remove any language flags that might not work with the // particular os if(forbiddenFlagVar) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c4f1d322a..dd459507e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -294,6 +294,11 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() // Add language feature flags. this->AddFeatureFlags(flags, lang); +#ifdef __APPLE__ + this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + lang, this->ConfigName); +#endif /* __APPLE__ */ + // Fortran-specific flags computed for this target. if(*l == "Fortran") { diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 6b35b5b05..2d41d403c 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -406,6 +406,21 @@ cmPolicies::cmPolicies() "The OLD behavior for this policy is to silently ignore the problem. " "The NEW behavior for this policy is to report an error.", 2,8,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0015, "CMP0015", + "link_directories() treats paths relative to the source dir.", + "In CMake 2.6.4 and lower the link_directories() command passed relative " + "paths unchanged to the linker. " + "In CMake 2.8.1 and above the link_directories() command prefers to " + "interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, " + "which is consistent with include_directories() and other commands. " + "The OLD behavior for this policy is to use relative paths verbatim in " + "the linker command. " + "The NEW behavior for this policy is to convert relative paths to " + "absolute paths by appending the relative path to " + "CMAKE_CURRENT_SOURCE_DIR.", + 2,8,1, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 4d1c3fc89..aaa3ac0ec 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -50,6 +50,7 @@ public: CMP0012, // Recognize numbers and boolean constants in if() CMP0013, // Duplicate binary directories not allowed CMP0014, // Input directories must have CMakeLists.txt + CMP0015, // link_directories() treats paths relative to source dir // Always the last entry. Useful mostly to avoid adding a comma // the last policy when adding a new one. diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 20646d094..fbc8ac1a0 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -64,14 +64,8 @@ public: " Example: PASS_REGULAR_EXPRESSION \"[^a-z]Error;ERROR;Failed\"\n" "Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a " "list of regular expressions.\n" - "PROCESSORS: Denotes the number of processors that this test will " - "require. This is typically used for MPI tests, and should be used in " - "conjunction with the ctest_test PARALLEL_LEVEL option.\n" - "COST: Set this to a floating point value. Tests in a test set will be " - "run in descending order of cost.\n" - "RUN_SERIAL: If set to true, this test will not run in parallel with " - "any other tests. This should be used in conjunction with " - "the ctest_test PARALLEL_LEVEL option.\n"; + "TIMEOUT: Setting this will limit the test runtime to the number of " + "seconds specified.\n"; } cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 38347a92a..5db020048 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -37,6 +37,7 @@ #ifdef __ICL #pragma warning ( disable : 985 ) +#pragma warning ( disable : 1572 ) /* floating-point equality test */ #endif #include // Work-around for SGI MIPSpro 7.4.2m header bug diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 031bfc32b..33e8fb0af 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1672,6 +1672,18 @@ void cmSystemTools::RestoreEnv(const std::vector& env) PutEnv(eit->c_str()); } } + +//---------------------------------------------------------------------- +cmSystemTools::SaveRestoreEnvironment::SaveRestoreEnvironment() +{ + this->Env = cmSystemTools::GetEnvironmentVariables(); +} + +//---------------------------------------------------------------------- +cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment() +{ + cmSystemTools::RestoreEnv(this->Env); +} #endif void cmSystemTools::EnableVSConsoleOutput() @@ -2590,6 +2602,33 @@ bool cmSystemTools::ChangeRPath(std::string const& file, #endif } +//---------------------------------------------------------------------------- +bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, + const char* lhss, const char* rhss) +{ + unsigned int lhs[4] = {0,0,0,0}; + unsigned int rhs[4] = {0,0,0,0}; + sscanf(lhss, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]); + sscanf(rhss, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]); + + // Do component-wise comparison. + for(unsigned int i=0; i < 4; ++i) + { + if(lhs[i] < rhs[i]) + { + // lhs < rhs, so true if operation is LESS + return op == cmSystemTools::OP_LESS; + } + else if(lhs[i] > rhs[i]) + { + // lhs > rhs, so true if operation is GREATER + return op == cmSystemTools::OP_GREATER; + } + } + // lhs == rhs, so true if operation is EQUAL + return op == cmSystemTools::OP_EQUAL; +} + //---------------------------------------------------------------------------- bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, bool* removed) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 679884e87..70d1462cd 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -268,6 +268,17 @@ public: UNKNOWN_FILE_FORMAT }; + enum CompareOp { + OP_LESS, + OP_GREATER, + OP_EQUAL + }; + + /** + * Compare versions + */ + static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs); + /** * Determine the file type based on the extension */ @@ -347,6 +358,20 @@ public: AppendEnv to put the environment back to the way it was. */ static void RestoreEnv(const std::vector& env); + + /** Helper class to save and restore the environment. + Instantiate this class as an automatic variable on + the stack. Its constructor saves a copy of the current + environment and then its destructor restores the + original environment. */ + class SaveRestoreEnvironment + { + public: + SaveRestoreEnvironment(); + virtual ~SaveRestoreEnvironment(); + private: + std::vector Env; + }; #endif /** Setup the environment to enable VS 8 IDE output. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f44fb6ba6..0436bd076 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -572,6 +572,23 @@ void cmTarget::DefineProperties(cmake *cm) "This property is ignored for non-imported targets.", false /* TODO: make this chained */ ); + cm->DefineProperty + ("OSX_ARCHITECTURES", cmProperty::TARGET, + "Target specific architectures for OS X.", + "The OSX_ARCHITECTURES property sets the target binary architecture " + "for targets on OS X. " + "This property is initialized by the value of the variable " + "CMAKE_OSX_ARCHITECTURES if it is set when a target is created. " + "Use OSX_ARCHITECTURES_ to set the binary architectures on a " + "per-configuration basis. " + " is an upper-case name (ex: \"OSX_ARCHITECTURES_DEBUG\")."); + + cm->DefineProperty + ("OSX_ARCHITECTURES_", cmProperty::TARGET, + "Per-configuration OS X binary architectures for a target.", + "This property is the configuration-specific version of " + "OSX_ARCHITECTURES."); + cm->DefineProperty ("OUTPUT_NAME", cmProperty::TARGET, "Output name for target files.", @@ -884,22 +901,44 @@ void cmTarget::DefineProperties(cmake *cm) #define CM_TARGET_OUTDIR_DOC(TYPE, type) \ "This property specifies the directory into which " #type " target " \ "files should be built. " \ + "Multi-configuration generators (VS, Xcode) append " \ + "a per-configuration subdirectory to the specified directory. " \ CM_TARGET_FILE_TYPES_DOC " " \ "This property is initialized by the value of the variable " \ "CMAKE_" #TYPE "_OUTPUT_DIRECTORY if it is set when a target is created." +#define CM_TARGET_OUTDIR_CONFIG_DOC(TYPE) \ + "This is a per-configuration version of " #TYPE "_OUTPUT_DIRECTORY, " \ + "but multi-configuration generators (VS, Xcode) do NOT append " \ + "a per-configuration subdirectory to the specified directory. " \ + "This property is initialized by the value of the variable " \ + "CMAKE_" #TYPE "_OUTPUT_DIRECTORY_ " \ + "if it is set when a target is created." + cm->DefineProperty ("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build ARCHIVE target files.", CM_TARGET_OUTDIR_DOC(ARCHIVE, archive)); + cm->DefineProperty + ("ARCHIVE_OUTPUT_DIRECTORY_", cmProperty::TARGET, + "Per-configuration output directory for ARCHIVE target files.", + CM_TARGET_OUTDIR_CONFIG_DOC(ARCHIVE)); cm->DefineProperty ("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build LIBRARY target files.", CM_TARGET_OUTDIR_DOC(LIBRARY, library)); + cm->DefineProperty + ("LIBRARY_OUTPUT_DIRECTORY_", cmProperty::TARGET, + "Per-configuration output directory for LIBRARY target files.", + CM_TARGET_OUTDIR_CONFIG_DOC(LIBRARY)); cm->DefineProperty ("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build RUNTIME target files.", CM_TARGET_OUTDIR_DOC(RUNTIME, runtime)); + cm->DefineProperty + ("RUNTIME_OUTPUT_DIRECTORY_", cmProperty::TARGET, + "Per-configuration output directory for RUNTIME target files.", + CM_TARGET_OUTDIR_CONFIG_DOC(RUNTIME)); cm->DefineProperty ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET, @@ -983,6 +1022,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); + this->SetPropertyDefault("OSX_ARCHITECTURES", 0); // Collect the set of configuration types. std::vector configNames; @@ -1000,9 +1040,22 @@ void cmTarget::SetMakefile(cmMakefile* mf) } // Setup per-configuration property default values. + const char* configProps[] = { + "ARCHIVE_OUTPUT_DIRECTORY_", + "LIBRARY_OUTPUT_DIRECTORY_", + "RUNTIME_OUTPUT_DIRECTORY_", + 0}; for(std::vector::iterator ci = configNames.begin(); ci != configNames.end(); ++ci) { + std::string configUpper = cmSystemTools::UpperCase(*ci); + for(const char** p = configProps; *p; ++p) + { + std::string property = *p; + property += configUpper; + this->SetPropertyDefault(property.c_str(), 0); + } + // Initialize per-configuration name postfix property from the // variable only for non-executable targets. This preserves // compatibility with previous CMake versions in which executables @@ -3036,13 +3089,13 @@ void cmTarget::GetFullNameInternal(const char* config, outBase += configPostfix?configPostfix:""; // Name shared libraries with their version number on some platforms. - if(const char* version = this->GetProperty("VERSION")) + if(const char* soversion = this->GetProperty("SOVERSION")) { if(this->GetType() == cmTarget::SHARED_LIBRARY && !implib && this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION")) { outBase += "-"; - outBase += version; + outBase += soversion; } } @@ -3423,14 +3476,20 @@ std::string cmTarget::GetInstallNameDirForBuildTree(const char* config, std::string cmTarget::GetInstallNameDirForInstallTree(const char* config, bool for_xcode) { - // Lookup the target property. - const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR"); - if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME") && - !this->Makefile->IsOn("CMAKE_SKIP_RPATH") && - install_name_dir && *install_name_dir) + if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { - std::string dir = install_name_dir; - dir += "/"; + std::string dir; + + if(!this->Makefile->IsOn("CMAKE_SKIP_RPATH")) + { + const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR"); + if(install_name_dir && *install_name_dir) + { + dir = install_name_dir; + dir += "/"; + } + } + if(this->IsFrameworkOnApple() && !for_xcode) { dir += this->GetFullName(config, false); @@ -3438,6 +3497,7 @@ std::string cmTarget::GetInstallNameDirForInstallTree(const char* config, dir += this->GetFrameworkVersion(); dir += "/"; } + return dir; } else @@ -3508,16 +3568,36 @@ void cmTarget::ComputeOutputDir(const char* config, { // Look for a target property defining the target output directory // based on the target type. + std::string targetTypeName = this->GetOutputTargetType(implib); const char* propertyName = 0; - std::string propertyNameStr = this->GetOutputTargetType(implib); + std::string propertyNameStr = targetTypeName; if(!propertyNameStr.empty()) { propertyNameStr += "_OUTPUT_DIRECTORY"; propertyName = propertyNameStr.c_str(); } + // Check for a per-configuration output directory target property. + std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + const char* configProp = 0; + std::string configPropStr = targetTypeName; + if(!configPropStr.empty()) + { + configPropStr += "_OUTPUT_DIRECTORY_"; + configPropStr += configUpper; + configProp = configPropStr.c_str(); + } + // Select an output directory. - if(const char* outdir = this->GetProperty(propertyName)) + if(const char* config_outdir = this->GetProperty(configProp)) + { + // Use the user-specified per-configuration output directory. + out = config_outdir; + + // Skip per-configuration subdirectory. + config = 0; + } + else if(const char* outdir = this->GetProperty(propertyName)) { // Use the user-specified output directory. out = outdir; @@ -3647,6 +3727,27 @@ void cmTarget::GetLanguages(std::set& languages) const } } +//---------------------------------------------------------------------------- +void cmTarget::GetAppleArchs(const char* config, + std::vector& archVec) +{ + const char* archs = 0; + if(config && *config) + { + std::string defVarName = "OSX_ARCHITECTURES_"; + defVarName += cmSystemTools::UpperCase(config); + archs = this->GetProperty(defVarName.c_str()); + } + if(!archs) + { + archs = this->GetProperty("OSX_ARCHITECTURES"); + } + if(archs) + { + cmSystemTools::ExpandListArgument(std::string(archs), archVec); + } +} + //---------------------------------------------------------------------------- bool cmTarget::IsChrpathUsed(const char* config) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 66e3f3df0..f2b7d61e8 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -410,6 +410,9 @@ public: // until we have per-target object file properties. void GetLanguages(std::set& languages) const; + /** Get the list of OS X target architectures to be built. */ + void GetAppleArchs(const char* config, std::vector& archVec); + /** Return whether this target is an executable with symbol exports enabled. */ bool IsExecutableWithExports(); diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 88b0eae5d..b52bc19eb 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -96,6 +96,31 @@ void cmTest::AppendProperty(const char* prop, const char* value) //---------------------------------------------------------------------------- void cmTest::DefineProperties(cmake *cm) { + cm->DefineProperty + ("ATTACHED_FILES", cmProperty::TEST, + "Attach a list of files to a dashboard submission.", + "Set this property to a list of files that will be encoded and " + "submitted to the dashboard as an addition to the test result."); + + cm->DefineProperty + ("ATTACHED_FILES_ON_FAIL", cmProperty::TEST, + "Attach a list of files to a dashboard submission if the test fails.", + "Same as ATTACHED_FILES, but these files will only be included if the " + "test does not pass."); + + cm->DefineProperty + ("COST", cmProperty::TEST, + "Set this to a floating point value. Tests in a test set will be " + "run in descending order of cost.", "This property describes the cost " + "of a test. You can explicitly set this value; tests with higher COST " + "values will run first."); + + cm->DefineProperty + ("DEPENDS", cmProperty::TEST, + "Specifies that this test should only be run after the specified " + "list of tests.", + "Set this to a list of tests that must finish before this test is run."); + cm->DefineProperty ("ENVIRONMENT", cmProperty::TEST, "Specify environment variables that should be defined for running " @@ -131,6 +156,26 @@ void cmTest::DefineProperties(cmake *cm) "against the specified regular expressions and at least one of the" " regular expressions has to match, otherwise the test will fail."); + cm->DefineProperty + ("PROCESSORS", cmProperty::TEST, + "How many process slots this test requires", + "Denotes the number of processors that this test will require. This is " + "typically used for MPI tests, and should be used in conjunction with " + "the ctest_test PARALLEL_LEVEL option."); + + cm->DefineProperty + ("REQUIRED_FILES", cmProperty::TEST, + "List of files required to run the test.", + "If set to a list of files, the test will not be run unless all of the " + "files exist."); + + cm->DefineProperty + ("RUN_SERIAL", cmProperty::TEST, + "Do not run this test in parallel with any other test.", + "Use this option in conjunction with the ctest_test PARALLEL_LEVEL " + "option to specify that this test should not be run in parallel with " + "any other tests."); + cm->DefineProperty ("TIMEOUT", cmProperty::TEST, "How many seconds to allow for this test.", diff --git a/Source/cmVS10CLFlagTable.h b/Source/cmVS10CLFlagTable.h old mode 100755 new mode 100644 diff --git a/Source/cmVS10LibFlagTable.h b/Source/cmVS10LibFlagTable.h old mode 100755 new mode 100644 diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h old mode 100755 new mode 100644 diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx old mode 100755 new mode 100644 index 32fceada9..4a8e161f3 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -396,6 +396,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::vector customBuild; std::vector none; std::vector headers; + std::vector resource; for(std::vector::const_iterator s = classes.begin(); s != classes.end(); s++) @@ -417,6 +418,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { clCompile.push_back(sf); } + if(strcmp(lang, "RC") == 0) + { + resource.push_back(sf); + } else if(sf->GetCustomCommand()) { customBuild.push_back(sf); @@ -448,6 +453,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() 0); this->WriteGroupSources("ClCompile", clCompile, sourceGroups); this->WriteGroupSources("ClInclude", headers, sourceGroups); + this->WriteGroupSources("ResourceCompile", resource, sourceGroups); this->WriteGroupSources("CustomBuild", customBuild, sourceGroups); this->WriteString("\n", 1); @@ -568,37 +574,40 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() ((*source)->GetExtension().c_str()); const char* lang = (*source)->GetLanguage(); bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0); + bool rc = lang && (strcmp(lang, "RC") == 0); + std::string sourceFile = (*source)->GetFullPath(); + sourceFile = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + sourceFile.c_str()); + this->ConvertToWindowsSlash(sourceFile); + // output the source file + if(header) + { + this->WriteString("WriteString("WriteString("WriteString("BuildFileStream ) << sourceFile << "\""; + // ouput any flags specific to this source file + if(cl && this->OutputSourceSpecificFlags(*source)) + { + // if the source file has specific flags the tag + // is ended on a new line + this->WriteString("\n", 2); + } + else { - std::string sourceFile = (*source)->GetFullPath(); - sourceFile = cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), - sourceFile.c_str()); - this->ConvertToWindowsSlash(sourceFile); - // output the source file - if(header) - { - this->WriteString("WriteString("WriteString("BuildFileStream ) << sourceFile << "\""; - // ouput any flags specific to this source file - if(cl && this->OutputSourceSpecificFlags(*source)) - { - // if the source file has specific flags the tag - // is ended on a new line - this->WriteString("\n", 2); - } - else - { - (*this->BuildFileStream ) << " />\n"; - } + (*this->BuildFileStream ) << " />\n"; } } } @@ -1222,6 +1231,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries( Convert(l->Value.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED); + this->ConvertToWindowsSlash(path); libstring += sep; libstring += path; } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h old mode 100755 new mode 100644 diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx old mode 100755 new mode 100644 diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h old mode 100755 new mode 100644 diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 5c5ad2e26..f46b87fed 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -60,9 +60,7 @@ bool cmWriteFileCommand #elif defined( __BORLANDC__ ) S_IRUSR | S_IWUSR #else - S_IRUSR | S_IWUSR | - S_IRGRP | - S_IROTH + 0666 #endif ; @@ -73,7 +71,7 @@ bool cmWriteFileCommand #if defined( _MSC_VER ) || defined( __MINGW32__ ) S_IREAD | S_IWRITE #else - S_IRUSR | S_IWUSR + 0666 #endif ); } diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx index ea55ed1c9..72fdc3466 100644 --- a/Source/cmXMLSafe.cxx +++ b/Source/cmXMLSafe.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmXMLSafe.h" +#include "cm_utf8.h" + #include #include @@ -53,44 +55,47 @@ cmsys_ios::ostream& operator<<(cmsys_ios::ostream& os, cmXMLSafe const& self) { char const* first = self.Data; char const* last = self.Data + self.Size; - for(char const* ci = first; ci != last; ++ci) + while(first != last) { - unsigned char c = static_cast(*ci); - switch(c) + unsigned int ch; + if(const char* next = cm_utf8_decode_character(first, last, &ch)) { - case '&': os << "&"; break; - case '<': os << "<"; break; - case '>': os << ">"; break; - case '"': os << (self.DoQuotes? """ : "\""); break; - case '\'': os << (self.DoQuotes? "'" : "'"); break; - case '\t': os << "\t"; break; - case '\n': os << "\n"; break; - case '\r': break; // Ignore CR - default: - if(c >= 0x20 && c <= 0x7f) - { - os.put(static_cast(c)); - } - else + // http://www.w3.org/TR/REC-xml/#NT-Char + if((ch >= 0x20 && ch <= 0xD7FF) || + (ch >= 0xE000 && ch <= 0xFFFD) || + (ch >= 0x10000 && ch <= 0x10FFFF) || + ch == 0x9 || ch == 0xA || ch == 0xD) + { + switch(ch) { - // TODO: More complete treatment of program output character - // encoding. Instead of escaping these bytes, we should - // handle the current locale and its encoding. - char buf[16]; - // http://www.w3.org/TR/REC-xml/#NT-Char - if(c >= 0x80) - { - sprintf(buf, "&#x%hx;", static_cast(c)); - } - else - { - // We cannot use "&#x%hx;" here because this value is not - // valid in XML. Instead use a human-readable hex value. - sprintf(buf, "<0x%hx>", static_cast(c)); - } - os << buf; + // Escape XML control characters. + case '&': os << "&"; break; + case '<': os << "<"; break; + case '>': os << ">"; break; + case '"': os << (self.DoQuotes? """ : "\""); break; + case '\'': os << (self.DoQuotes? "'" : "'"); break; + case '\r': break; // Ignore CR + // Print the UTF-8 character. + default: os.write(first, next-first); break; } - break; + } + else + { + // Use a human-readable hex value for this invalid character. + char buf[16]; + sprintf(buf, "%X", ch); + os << "[NON-XML-CHAR-0x" << buf << "]"; + } + + first = next; + } + else + { + ch = static_cast(*first++); + // Use a human-readable hex value for this invalid byte. + char buf[16]; + sprintf(buf, "%X", ch); + os << "[NON-UTF-8-BYTE-0x" << buf << "]"; } } return os; diff --git a/Source/cm_utf8.c b/Source/cm_utf8.c new file mode 100644 index 000000000..3d4ca16ee --- /dev/null +++ b/Source/cm_utf8.c @@ -0,0 +1,84 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cm_utf8.h" + +/* + RFC 3629 + 07-bit: 0xxxxxxx + 11-bit: 110xxxxx 10xxxxxx + 16-bit: 1110xxxx 10xxxxxx 10xxxxxx + 21-bit: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + + Pre-RFC Compatibility + 26-bit: 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx + 31-bit: 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx +*/ + +/* Number of leading ones before a zero in the byte. */ +static unsigned char const cm_utf8_ones[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,7,8 +}; + +/* Mask away control bits from bytes with n leading ones. */ +static unsigned char const cm_utf8_mask[7] = { + 0xEF, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 +}; + +/* Minimum allowed value when first byte has n leading ones. */ +static unsigned int const cm_utf8_min[7] = { + 0, 0, 1u<<7, 1u<<11, 1u<<16, 1u<<21, 1u<<26 /*, 1u<<31 */ +}; + +/*--------------------------------------------------------------------------*/ +const char* cm_utf8_decode_character(const char* first, const char* last, + unsigned int* pc) +{ + /* Count leading ones in the first byte. */ + unsigned char c = *first++; + unsigned char const ones = cm_utf8_ones[c]; + switch(ones) + { + case 0: *pc = c; return first; /* One-byte character. */ + case 1: case 7: case 8: return 0; /* Invalid leading byte. */ + default: break; + } + + /* Extract bits from this multi-byte character. */ + { + unsigned int uc = c & cm_utf8_mask[ones]; + unsigned char left; + for(left = ones-1; left && first != last; --left) + { + c = *first++; + if(cm_utf8_ones[c] != 1) + { + return 0; + } + uc = (uc << 6) | (c & cm_utf8_mask[1]); + } + + if(left > 0 || uc < cm_utf8_min[ones]) + { + return 0; + } + + *pc = uc; + return first; + } +} diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h new file mode 100644 index 000000000..06e2868d5 --- /dev/null +++ b/Source/cm_utf8.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cm_utf8_h +#define cm_utf8_h + +#ifdef __cplusplus +extern "C" { +#endif + +/** Decode one UTF-8 character from the input byte range. On success, + stores the unicode character number in *pc and returns the first + position not extracted. On failure, returns 0. */ +const char* cm_utf8_decode_character(const char* first, const char* last, + unsigned int* pc); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1a85a02c3..ef1febb37 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -67,6 +67,7 @@ # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" +# include "cmGlobalJOMMakefileGenerator.h" # include "cmGlobalWatcomWMakeGenerator.h" # define CMAKE_HAVE_VS_GENERATORS # endif @@ -81,7 +82,7 @@ #include "cmCallVisualStudioMacro.h" #endif -#if !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +#if !defined(CMAKE_BOOT_MINGW) # include "cmExtraCodeBlocksGenerator.h" #endif @@ -1378,61 +1379,12 @@ int cmake::ExecuteCMakeCommand(std::vector& args) // Internal CMake shared library support. else if (args[1] == "cmake_symlink_library" && args.size() == 5) { - int result = 0; - std::string realName = args[2]; - std::string soName = args[3]; - std::string name = args[4]; - if(soName != realName) - { - std::string fname = cmSystemTools::GetFilenameName(realName); - if(cmSystemTools::FileExists(soName.c_str()) || - cmSystemTools::FileIsSymlink(soName.c_str())) - { - cmSystemTools::RemoveFile(soName.c_str()); - } - if(!cmSystemTools::CreateSymlink(fname.c_str(), soName.c_str())) - { - cmSystemTools::ReportLastSystemError("cmake_symlink_library"); - result = 1; - } - } - if(name != soName) - { - std::string fname = cmSystemTools::GetFilenameName(soName); - if(cmSystemTools::FileExists(name.c_str()) || - cmSystemTools::FileIsSymlink(name.c_str())) - { - cmSystemTools::RemoveFile(name.c_str()); - } - if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str())) - { - cmSystemTools::ReportLastSystemError("cmake_symlink_library"); - result = 1; - } - } - return result; + return cmake::SymlinkLibrary(args); } // Internal CMake versioned executable support. else if (args[1] == "cmake_symlink_executable" && args.size() == 4) { - int result = 0; - std::string realName = args[2]; - std::string name = args[3]; - if(name != realName) - { - std::string fname = cmSystemTools::GetFilenameName(realName); - if(cmSystemTools::FileExists(name.c_str()) || - cmSystemTools::FileIsSymlink(name.c_str())) - { - cmSystemTools::RemoveFile(name.c_str()); - } - if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str())) - { - cmSystemTools::ReportLastSystemError("cmake_symlink_executable"); - result = 1; - } - } - return result; + return cmake::SymlinkExecutable(args); } #if defined(CMAKE_HAVE_VS_GENERATORS) @@ -1465,8 +1417,10 @@ int cmake::ExecuteCMakeCommand(std::vector& args) else if (args[1] == "cmake_depends" && args.size() >= 6) { // Use the make system's VERBOSE environment variable to enable - // verbose output. - bool verbose = cmSystemTools::GetEnv("VERBOSE") != 0; + // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE + // (which is set by the Eclipse and KDevelop generators). + bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) + && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0)); // Create a cmake object instance to process dependencies. cmake cm; @@ -1693,10 +1647,8 @@ void cmake::AddDefaultExtraGenerators() // e.g. kdevelop4 ? #endif -#if !defined(__CYGWIN__) this->AddExtraGenerator(cmExtraCodeBlocksGenerator::GetActualName(), &cmExtraCodeBlocksGenerator::New); -#endif #ifdef CMAKE_USE_ECLIPSE this->AddExtraGenerator(cmExtraEclipseCDT4Generator::GetActualName(), @@ -2364,34 +2316,6 @@ const char* cmake::GetCacheDefinition(const char* name) const return this->CacheManager->GetCacheValue(name); } -int cmake::DumpDocumentationToFile(std::ostream& f) -{ -#ifdef CMAKE_BUILD_WITH_CMAKE - // Loop over all registered commands and print out documentation - const char *name; - const char *terse; - const char *full; - char tmp[1024]; - sprintf(tmp,"Version %s", cmVersion::GetCMakeVersion()); - f << "\n"; - f << "

Documentation for commands of CMake " << tmp << "

\n"; - f << "
    \n"; - for(RegisteredCommandsMap::iterator j = this->Commands.begin(); - j != this->Commands.end(); ++j) - { - name = (*j).second->GetName(); - terse = (*j).second->GetTerseDocumentation(); - full = (*j).second->GetFullDocumentation(); - f << "
  • " << name << " - " << terse << std::endl - << "
    Usage: " << full << "
  • " << std::endl << std::endl; - } - f << "
\n"; -#else - (void)f; -#endif - return 1; -} - void cmake::AddDefaultCommands() { std::list commands; @@ -2430,6 +2354,8 @@ void cmake::AddDefaultGenerators() &cmGlobalBorlandMakefileGenerator::New; this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = &cmGlobalNMakeMakefileGenerator::New; + this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] = + &cmGlobalJOMMakefileGenerator::New; this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] = &cmGlobalWatcomWMakeGenerator::New; # endif @@ -2588,9 +2514,11 @@ int cmake::CheckBuildSystem() { // We do not need to rerun CMake. Check dependency integrity. Use // the make system's VERBOSE environment variable to enable verbose - // output. - bool verbose = cmSystemTools::GetEnv("VERBOSE") != 0; - + // output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set + // by the Eclipse and KDevelop generators). + bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0) + && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0)); + // This method will check the integrity of the build system if the // option was given on the command line. It reads the given file to // determine whether CMake should rerun. @@ -3130,6 +3058,65 @@ void cmake::GenerateGraphViz(const char* fileName) const str << "}" << std::endl; } +//---------------------------------------------------------------------------- +int cmake::SymlinkLibrary(std::vector& args) +{ + int result = 0; + std::string realName = args[2]; + std::string soName = args[3]; + std::string name = args[4]; + if(soName != realName) + { + if(!cmake::SymlinkInternal(realName, soName)) + { + cmSystemTools::ReportLastSystemError("cmake_symlink_library"); + result = 1; + } + } + if(name != soName) + { + if(!cmake::SymlinkInternal(soName, name)) + { + cmSystemTools::ReportLastSystemError("cmake_symlink_library"); + result = 1; + } + } + return result; +} + +//---------------------------------------------------------------------------- +int cmake::SymlinkExecutable(std::vector& args) +{ + int result = 0; + std::string realName = args[2]; + std::string name = args[3]; + if(name != realName) + { + if(!cmake::SymlinkInternal(realName, name)) + { + cmSystemTools::ReportLastSystemError("cmake_symlink_executable"); + result = 1; + } + } + return result; +} + +//---------------------------------------------------------------------------- +bool cmake::SymlinkInternal(std::string const& file, std::string const& link) +{ + if(cmSystemTools::FileExists(link.c_str()) || + cmSystemTools::FileIsSymlink(link.c_str())) + { + cmSystemTools::RemoveFile(link.c_str()); + } +#if defined(_WIN32) && !defined(__CYGWIN__) + return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str()); +#else + std::string linktext = cmSystemTools::GetFilenameName(file); + return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str()); +#endif +} + //---------------------------------------------------------------------------- #ifdef CMAKE_BUILD_WITH_CMAKE int cmake::ExecuteEchoColor(std::vector& args) @@ -4402,7 +4389,7 @@ int cmake::Build(const std::string& dir, const std::string& config, const std::vector& nativeOptions, bool clean) -{ +{ if(!cmSystemTools::FileIsDirectory(dir.c_str())) { std::cerr << "Error: " << dir << " is not a directory\n"; @@ -4422,8 +4409,8 @@ int cmake::Build(const std::string& dir, std::cerr << "Error: could find generator in Cache\n"; return 1; } - cmGlobalGenerator* gen = - this->CreateGlobalGenerator(it.GetValue()); + std::auto_ptr gen( + this->CreateGlobalGenerator(it.GetValue())); std::string output; std::string projName; std::string makeProgram; diff --git a/Source/cmake.h b/Source/cmake.h index f983dc2a5..8312795eb 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -122,12 +122,6 @@ class cmake } //@} - /** - * Dump documentation to a file. If 0 is returned, the - * operation failed. - */ - int DumpDocumentationToFile(std::ostream&); - /** * Handle a command line invocation of cmake. */ @@ -414,6 +408,10 @@ protected: void GenerateGraphViz(const char* fileName) const; + static int SymlinkLibrary(std::vector& args); + static int SymlinkExecutable(std::vector& args); + static bool SymlinkInternal(std::string const& file, + std::string const& link); static int ExecuteEchoColor(std::vector& args); static int ExecuteLinkScript(std::vector& args); static int VisualStudioLink(std::vector& args, int type); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 766eead53..ddff71d9e 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -423,7 +423,7 @@ int do_cmake(int ac, char** av) std::vector args; for(int i =0; i < ac; ++i) { - if(strcmp(av[i], "-i") == 0) + if(!command && strcmp(av[i], "-i") == 0) { wiz = true; } diff --git a/Source/ctest.cxx b/Source/ctest.cxx index eec5c0332..c9b875dcb 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -123,8 +123,8 @@ static const char * cmDocumentationOptions[][3] = {"-SP