diff options
Diffstat (limited to 'Modules')
42 files changed, 764 insertions, 309 deletions
diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake index abf560b..cb1f5d6 100644 --- a/Modules/CMakeASM-ATTInformation.cmake +++ b/Modules/CMakeASM-ATTInformation.cmake @@ -18,5 +18,8 @@ SET(ASM_DIALECT "-ATT") # *.S files are supposed to be preprocessed, so they should not be passed to # assembler but should be processed by gcc SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm) + +SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>") + INCLUDE(CMakeASMInformation) SET(ASM_DIALECT) diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in index 230805b..2dc24b0 100644 --- a/Modules/CMakeASMCompiler.cmake.in +++ b/Modules/CMakeASMCompiler.cmake.in @@ -4,6 +4,7 @@ SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") SET(CMAKE_LINKER "@CMAKE_LINKER@") SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1) +SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@") SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@") SET(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index b94303e..d50f351 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -12,8 +12,6 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MESSAGE(STATUS "Loaded CMakeASM${ASM_DIALECT}Information - ASM${ASM_DIALECT} support is still experimental, please report issues") - IF(UNIX) SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o) ELSE(UNIX) @@ -34,6 +32,9 @@ IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) IF(NOT _INCLUDED_FILE) + IF("ASM${ASM_DIALECT}" STREQUAL "ASM") + MESSAGE(FATAL_ERROR "Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}") + ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM") INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL) ENDIF(NOT _INCLUDED_FILE) @@ -89,7 +90,7 @@ MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) @@ -100,9 +101,21 @@ ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) IF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE) SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE - "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE) +IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG) + SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG}) +ENDIF() + +IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP) + SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP}) +ENDIF() + +IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG) + SET(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG}) +ENDIF() + # to be done IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY) diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index 237f8dd..a2929f1 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -16,7 +16,7 @@ # cache values that can be initialized in the platform-compiler.cmake file # it may be included by more than one language. -SET (CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS} +SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" CACHE STRING "Flags used by the linker.") @@ -70,11 +70,11 @@ IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) # shared linker flags -SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS} +SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" CACHE STRING "Flags used by the linker during the creation of dll's.") # module linker flags -SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS} +SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" CACHE STRING "Flags used by the linker during the creation of modules.") SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index d6350bf..171e31f 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -21,11 +21,37 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+") # finally list compilers to try - IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT}) - ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}as ${_CMAKE_TOOLCHAIN_PREFIX}gas) - ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support + + IF(CMAKE_ASM_COMPILER_INIT) + SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT}) + ELSE(CMAKE_ASM_COMPILER_INIT) + + IF(CMAKE_C_COMPILER) + SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler") + SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}") + ELSEIF(CMAKE_CXX_COMPILER) + SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler") + SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") + ELSE(CMAKE_CXX_COMPILER) + # List all default C and CXX compilers + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc + ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC) + ENDIF(CMAKE_C_COMPILER) + + ENDIF(CMAKE_ASM_COMPILER_INIT) + + + ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect" + + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT}) + ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !") + ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + + ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM") + # Find the compiler. IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH) @@ -63,7 +89,24 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) # Table of per-vendor compiler id flags with expected output. LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C") + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") @@ -71,14 +114,15 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) INCLUDE(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) - IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") - ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") - ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - ENDIF() +IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") +ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") +ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + + # If we have a gas/as cross compiler, they have usually some prefix, like # e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally @@ -90,10 +134,25 @@ ENDIF() IF (NOT _CMAKE_TOOLCHAIN_PREFIX) GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME) IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) +# Now try the C compiler regexp: +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + +# Finally try the CXX compiler regexp: +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + + INCLUDE(CMakeFindBinUtils) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}") @@ -106,6 +165,7 @@ ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER) SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}") +SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}") SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 9a3884a..b160dee 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -287,6 +287,13 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) RESULT_VARIABLE result TIMEOUT 10 ) + + IF("${lang}" STREQUAL "ASM") + MESSAGE(STATUS "Checked for ${vendor}") + MESSAGE(STATUS " Output: -${output}-") + MESSAGE(STATUS " Result: -${result}-") + ENDIF("${lang}" STREQUAL "ASM") + IF("${output}" MATCHES "${regex}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 4f033e3..dc15e55 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -178,9 +178,10 @@ IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH) ENDIF() # compile a Fortran file into an object file +# (put -o after -c to workaround bug in at least one mpif77 wrapper) IF(NOT CMAKE_Fortran_COMPILE_OBJECT) SET(CMAKE_Fortran_COMPILE_OBJECT - "<CMAKE_Fortran_COMPILER> -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>") + "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -c <SOURCE> -o <OBJECT>") ENDIF(NOT CMAKE_Fortran_COMPILE_OBJECT) # link a fortran program diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 98d40d6..469f08f 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -60,7 +60,7 @@ # CPACK_DEBIAN_PACKAGE_DEBUG # Mandatory : NO # Default : - -# May be set when invoking cpack in order to trace debug informations +# May be set when invoking cpack in order to trace debug information # during CPackDeb run. # CPACK_DEBIAN_PACKAGE_PREDEPENDS # Mandatory : NO @@ -311,6 +311,28 @@ ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY ) # SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") +# Are we packaging components ? +IF(CPACK_DEB_PACKAGE_COMPONENT) + SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") + SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "/${CPACK_DEB_PACKAGE_COMPONENT}") + SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_DEB_PACKAGE_COMPONENT}") +ELSE(CPACK_DEB_PACKAGE_COMPONENT) + SET(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") + SET(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "") + SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") +ENDIF(CPACK_DEB_PACKAGE_COMPONENT) + +# Print out some debug information if we were asked for that +IF(CPACK_DEBIAN_PACKAGE_DEBUG) + MESSAGE("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") + MESSAGE("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") + MESSAGE("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") + MESSAGE("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") + MESSAGE("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") + MESSAGE("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") + MESSAGE("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") + MESSAGE("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") +ENDIF(CPACK_DEBIAN_PACKAGE_DEBUG) # For debian source packages: # debian/control diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 026c45a..26209a7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -194,6 +194,25 @@ IF(NOT RPMBUILD_EXECUTABLE) MESSAGE(FATAL_ERROR "RPM package requires rpmbuild executable") ENDIF(NOT RPMBUILD_EXECUTABLE) +# Display lsb_release output if DEBUG mode enable +# This will help to diagnose problem with CPackRPM +# because we will know on which kind of Linux we are +IF(CPACK_RPM_PACKAGE_DEBUG) + find_program(LSB_RELEASE_EXECUTABLE lsb_release) + if(LSB_RELEASE_EXECUTABLE) + execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a + OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE "\n" ", " + LSB_RELEASE_OUTPUT + ${_TMP_LSB_RELEASE_OUTPUT}) + else (LSB_RELEASE_EXECUTABLE) + set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") + endif(LSB_RELEASE_EXECUTABLE) + MESSAGE("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") +ENDIF(CPACK_RPM_PACKAGE_DEBUG) + # We may use RPM version in the future in order # to shut down warning about space in buildtree # some recent RPM version should support space in different places. @@ -621,13 +640,18 @@ IF(RPMBUILD_EXECUTABLE) --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - IF(CPACK_RPM_PACKAGE_DEBUG) + IF(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) + FILE(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) + FILE(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ") MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + MESSAGE("CPackRPM:Debug: *** ${RPMBUILDERR} ***") MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") - ENDIF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: *** ${RPMBUILDERR} ***") + ENDIF(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) ELSE(RPMBUILD_EXECUTABLE) IF(ALIEN_EXECUTABLE) MESSAGE(FATAL_ERROR "RPM packaging through alien not done (yet)") diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index bb76ddd..c261eb3 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -63,7 +63,8 @@ OPTION(BUILD_TESTING "Build the testing tree." ON) # function to turn generator name into a version string # like vs7 vs71 vs8 vs9 FUNCTION(GET_VS_VERSION_STRING generator var) - STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" NUMBER "${generator}") + STRING(REGEX REPLACE "Visual Studio ([0-9][0-9]?)($|.*)" "\\1" + NUMBER "${generator}") IF("${generator}" MATCHES "Visual Studio 7 .NET 2003") SET(ver_string "vs71") ELSE("${generator}" MATCHES "Visual Studio 7 .NET 2003") @@ -253,15 +254,16 @@ IF(BUILD_TESTING) ENDIF(CTEST_USE_LAUNCHERS) MARK_AS_ADVANCED( + BZRCOMMAND + BZR_UPDATE_OPTIONS COVERAGE_COMMAND + CTEST_SUBMIT_RETRY_DELAY + CTEST_SUBMIT_RETRY_COUNT CVSCOMMAND - SVNCOMMAND - BZRCOMMAND - HGCOMMAND - GITCOMMAND CVS_UPDATE_OPTIONS - SVN_UPDATE_OPTIONS - BZR_UPDATE_OPTIONS + DART_TESTING_TIMEOUT + GITCOMMAND + HGCOMMAND MAKECOMMAND MEMORYCHECK_COMMAND MEMORYCHECK_SUPPRESSIONS_FILE @@ -270,10 +272,9 @@ IF(BUILD_TESTING) SLURM_SBATCH_COMMAND SLURM_SRUN_COMMAND SITE - CTEST_SUBMIT_RETRY_DELAY - CTEST_SUBMIT_RETRY_COUNT + SVNCOMMAND + SVN_UPDATE_OPTIONS ) - # BUILDNAME IF(NOT RUN_FROM_DART) SET(RUN_FROM_CTEST_OR_DART 1) INCLUDE(CTestTargets) diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index e3ef86c..d66874d 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -84,4 +84,12 @@ IF(NOT _CTEST_TARGETS_ADDED) ENDFOREACH(testtype) ENDFOREACH(mode) ENDIF("${CMAKE_GENERATOR}" MATCHES Make) + + # If requested, add an alias that is the equivalent of the built-in "test" + # or "RUN_TESTS" target: + IF(CTEST_TEST_TARGET_ALIAS) + ADD_CUSTOM_TARGET(${CTEST_TEST_TARGET_ALIAS} + ${CMAKE_CTEST_COMMAND} ${__conf_types} + ) + ENDIF() ENDIF(NOT _CTEST_TARGETS_ADDED) diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake new file mode 100644 index 0000000..e07401d --- /dev/null +++ b/Modules/Compiler/GNU-ASM.cmake @@ -0,0 +1,6 @@ +# This file is loaded when gcc/g++ is used for assembler files (the "ASM" cmake language) +include(Compiler/GNU) + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm) + +__compiler_gnu(ASM) diff --git a/Modules/Compiler/HP-ASM.cmake b/Modules/Compiler/HP-ASM.cmake new file mode 100644 index 0000000..8aa7bdb --- /dev/null +++ b/Modules/Compiler/HP-ASM.cmake @@ -0,0 +1,3 @@ +SET(CMAKE_ASM_VERBOSE_FLAG "-v") + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake index abf384a..dc7fbb2 100644 --- a/Modules/Compiler/HP-C.cmake +++ b/Modules/Compiler/HP-C.cmake @@ -1 +1,4 @@ SET(CMAKE_C_VERBOSE_FLAG "-v") + +SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake index f3c6b5f..82c1a86 100644 --- a/Modules/Compiler/HP-CXX.cmake +++ b/Modules/Compiler/HP-CXX.cmake @@ -1 +1,4 @@ SET(CMAKE_CXX_VERBOSE_FLAG "-v") + +SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") diff --git a/Modules/Compiler/Intel-ASM.cmake b/Modules/Compiler/Intel-ASM.cmake new file mode 100644 index 0000000..59b50a1 --- /dev/null +++ b/Modules/Compiler/Intel-ASM.cmake @@ -0,0 +1,13 @@ +SET(CMAKE_ASM_VERBOSE_FLAG "-v") + +SET(CMAKE_ASM_FLAGS_INIT "") +SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") +SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") +SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + +IF(UNIX) + SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S) +ELSE(UNIX) + SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm) +ENDIF(UNIX) diff --git a/Modules/Compiler/SunPro-ASM.cmake b/Modules/Compiler/SunPro-ASM.cmake new file mode 100644 index 0000000..dfc5702 --- /dev/null +++ b/Modules/Compiler/SunPro-ASM.cmake @@ -0,0 +1,24 @@ +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) + +SET(CMAKE_ASM_VERBOSE_FLAG "-#") + +SET(CMAKE_SHARED_LIBRARY_ASM_FLAGS "-KPIC") +SET(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-G") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R") +SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":") +SET(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h") + +SET(CMAKE_ASM_FLAGS_INIT "") +SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") +SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") +SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") + +# Initialize ASM 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_ASM_FLAGS "-Bstatic") + SET(CMAKE_${type}_LINK_DYNAMIC_ASM_FLAGS "-Bdynamic") +ENDFOREACH(type) diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake new file mode 100644 index 0000000..e5d4ffa --- /dev/null +++ b/Modules/Compiler/XL-ASM.cmake @@ -0,0 +1,13 @@ +SET(CMAKE_ASM_VERBOSE_FLAG "-V") + +# -qthreaded = Ensures that all optimizations will be thread-safe +# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer) +# -qhalt=e = Halt on error messages (rather than just severe errors) +SET(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler") + +SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g") +SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG") +SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG") +SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g") + +SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s ) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 3de6b7e..390b8f9 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -403,11 +403,11 @@ endfunction(_ep_write_verifyfile_script) function(_ep_write_extractfile_script script_filename name filename directory) set(args "") - if(filename MATCHES "(\\.bz2|\\.tar\\.gz|\\.tgz|\\.zip)$") + if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$") set(args xfz) endif() - if(filename MATCHES "\\.tar$") + if(filename MATCHES "(\\.|=)tar$") set(args xf) endif() @@ -1109,10 +1109,15 @@ function(_ep_add_download_command name) else() if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? - string(REGEX MATCH "[^/]*$" fname "${url}") - if(NOT "${fname}" MATCHES "\\.(bz2|tar|tgz|tar\\.gz|zip)$") + string(REGEX MATCH "[^/\\?]*$" fname "${url}") + if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") + string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}") + set(fname "${CMAKE_MATCH_1}") + endif() + if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() + string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}") diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index d57513c..ae4a13f 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -23,7 +23,7 @@ ########## ### List of vendors (BLA_VENDOR) valid in this module ## ATLAS, PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model), -## Intel( older versions of mkl 32 and 64 bit), ACML,Apple, NAS, Generic +## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,Apple, NAS, Generic # C/CXX should be enabled to use Intel mkl #============================================================================= @@ -39,12 +39,23 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) include(CheckFunctionExists) -else () include(CheckFortranFunctionExists) -endif() + +# Check the language being used +get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) +if( _LANGUAGES_ MATCHES Fortran ) + set( _CHECK_FORTRAN TRUE ) +elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) + set( _CHECK_FORTRAN FALSE ) +else() + if(BLAS_FIND_REQUIRED) + message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") + else(BLAS_FIND_REQUIRED) + message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)") + return() + endif(BLAS_FIND_REQUIRED) +endif( ) macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) # This macro checks for the existence of the combination of fortran libraries @@ -102,7 +113,7 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - if (_LANGUAGES_ MATCHES Fortran) + if (_CHECK_FORTRAN) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) @@ -244,7 +255,76 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") #BLAS in acml library? -if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR STREQUAL "All") +# the patch from Chuck Atkins: + if( ((_BLAS_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR + ((_BLAS_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) ) + if( WIN32 ) + file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" ) + else() + file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" ) + endif() + if( _ACML_ROOT ) + get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH ) + if( SIZEOF_INTEGER EQUAL 8 ) + set( _ACML_PATH_SUFFIX "_int64" ) + else() + set( _ACML_PATH_SUFFIX "" ) + endif() + if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) + set( _ACML_COMPILER32 "ifort32" ) + set( _ACML_COMPILER64 "ifort64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) + set( _ACML_COMPILER32 "sun32" ) + set( _ACML_COMPILER64 "sun64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ) + set( _ACML_COMPILER32 "pgi32" ) + if( WIN32 ) + set( _ACML_COMPILER64 "win64" ) + else() + set( _ACML_COMPILER64 "pgi64" ) + endif() + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" ) + # 32 bit builds not supported on Open64 but for code simplicity + # We'll just use the same directory twice + set( _ACML_COMPILER32 "open64_64" ) + set( _ACML_COMPILER64 "open64_64" ) + elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" ) + set( _ACML_COMPILER32 "nag32" ) + set( _ACML_COMPILER64 "nag64" ) + else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) + set( _ACML_COMPILER32 "gfortran32" ) + set( _ACML_COMPILER64 "gfortran64" ) + endif() + + if( _BLAS_VENDOR STREQUAL "ACML_MP" ) + set(_ACML_MP_LIB_DIRS + "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib" + "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" ) + else() #if( _BLAS_VENDOR STREQUAL "ACML" ) + set(_ACML_LIB_DIRS + "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib" + "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" ) + endif() + endif() + endif() + + if( _BLAS_VENDOR STREQUAL "ACML_MP" ) + foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS} ) + _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp;acml_mv" "" ) + if( BLAS_${_BLAS_VENDOR}_FOUND ) + break() + endif() + endforeach() + else() #if( _BLAS_VENDOR STREQUAL "ACML" ) + foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} ) + _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml;acml_mv" "" ) + if( BLAS_${_BLAS_VENDOR}_FOUND ) + break() + endif() + endforeach() + endif() + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) check_fortran_libraries( @@ -266,7 +346,7 @@ if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") "" ) endif(NOT BLAS_LIBRARIES) -endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") +endif () # ACML # Apple BLAS library? if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index 6455c99..96b6741 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -1,6 +1,4 @@ -# Find the PostgreSQL installation. -# -# ---------------------------------------------------------------------------- +# - Find the PostgreSQL installation. # Usage: # In your CMakeLists.txt file do something like this: # ... diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 79a3d51..0a11cfb 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -9,7 +9,7 @@ # QT_LIBRARIES variable. # # Typical usage could be something like: -# find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtXml REQUIRED ) +# find_package(Qt4 4.4.3 REQUIRED QtCore QtGui QtXml) # include(${QT_USE_FILE}) # add_executable(myexe main.cpp) # target_link_libraries(myexe ${QT_LIBRARIES}) @@ -354,6 +354,7 @@ ENDIF(QT_QT_LIBRARY) INCLUDE(CheckSymbolExists) INCLUDE(MacroAddFileDependencies) +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) @@ -472,6 +473,7 @@ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS DOC "The qmake executable for the Qt installation to use" ) +# double check that it was a Qt4 qmake, if not, re-find with different names IF (QT_QMAKE_EXECUTABLE) IF(QT_QMAKE_EXECUTABLE_LAST) @@ -480,8 +482,6 @@ IF (QT_QMAKE_EXECUTABLE) SET(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE) - SET(QT4_QMAKE_FOUND FALSE) - _qt4_query_qmake(QT_VERSION QTVERSION) # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path @@ -498,74 +498,9 @@ IF (QT_QMAKE_EXECUTABLE) ENDIF(QT_QMAKE_EXECUTABLE) ENDIF(NOT QTVERSION) - # check that we found the Qt4 qmake, Qt3 qmake output won't match here - STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}") - IF (qt_version_tmp) - - # we need at least version 4.0.0 - IF (NOT QT_MIN_VERSION) - SET(QT_MIN_VERSION "4.0.0") - ENDIF (NOT QT_MIN_VERSION) - - #now parse the parts of the user given version string into variables - STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT_MIN_VERSION}") - IF (NOT req_qt_major_vers) - MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"4.0.1\"") - ENDIF (NOT req_qt_major_vers) - - # now parse the parts of the user given version string into variables - STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}") - - # Suppport finding at least a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 ) - # This implementation is a hack to avoid duplicating code and make sure we stay - # source-compatible with CMake 2.6.x - IF( Qt4_FIND_VERSION ) - SET( QT_MIN_VERSION ${Qt4_FIND_VERSION} ) - SET( req_qt_major_vers ${Qt4_FIND_VERSION_MAJOR} ) - SET( req_qt_minor_vers ${Qt4_FIND_VERSION_MINOR} ) - SET( req_qt_patch_vers ${Qt4_FIND_VERSION_PATCH} ) - ENDIF( Qt4_FIND_VERSION ) - - IF (NOT req_qt_major_vers EQUAL 4) - MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"") - ENDIF (NOT req_qt_major_vers EQUAL 4) - - # and now the version string given by qmake - STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") - - # compute an overall version number which can be compared at once - MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}") - MATH(EXPR found_vers "${QT_VERSION_MAJOR}*10000 + ${QT_VERSION_MINOR}*100 + ${QT_VERSION_PATCH}") - - # Support finding *exactly* a particular version, for instance FIND_PACKAGE( Qt4 4.4.3 EXACT ) - IF( Qt4_FIND_VERSION_EXACT ) - IF(found_vers EQUAL req_vers) - SET( QT4_QMAKE_FOUND TRUE ) - ELSE(found_vers EQUAL req_vers) - SET( QT4_QMAKE_FOUND FALSE ) - IF (found_vers LESS req_vers) - SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE) - ELSE (found_vers LESS req_vers) - SET(QT4_INSTALLED_VERSION_TOO_NEW TRUE) - ENDIF (found_vers LESS req_vers) - ENDIF(found_vers EQUAL req_vers) - ELSE( Qt4_FIND_VERSION_EXACT ) - IF (found_vers LESS req_vers) - SET(QT4_QMAKE_FOUND FALSE) - SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE) - ELSE (found_vers LESS req_vers) - SET(QT4_QMAKE_FOUND TRUE) - ENDIF (found_vers LESS req_vers) - ENDIF( Qt4_FIND_VERSION_EXACT ) - ENDIF (qt_version_tmp) - ENDIF (QT_QMAKE_EXECUTABLE) -IF (QT4_QMAKE_FOUND) +IF (QT_QMAKE_EXECUTABLE AND QTVERSION) # ask qmake for the mkspecs directory # we do this first because QT_LIBINFIX might be set @@ -607,14 +542,25 @@ IF (QT4_QMAKE_FOUND) FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 HINTS ${QT_LIBRARY_DIR_TMP} - NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH + NO_DEFAULT_PATH ) FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 HINTS ${QT_LIBRARY_DIR_TMP} - NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH + NO_DEFAULT_PATH ) + IF(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG) + FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE + NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 + HINTS ${QT_LIBRARY_DIR_TMP} + ) + FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG + NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 + HINTS ${QT_LIBRARY_DIR_TMP} + ) + ENDIF(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG) + # try dropping a hint if trying to use Visual Studio with Qt built by mingw IF(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC) IF(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a) @@ -644,10 +590,13 @@ IF (QT4_QMAKE_FOUND) ENDIF() IF (APPLE) + SET(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE) + SET(CMAKE_FIND_FRAMEWORK FIRST) ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) SET(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE) + SET(CMAKE_FIND_FRAMEWORK LAST) ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework) MARK_AS_ADVANCED(QT_USE_FRAMEWORKS) ENDIF (APPLE) @@ -663,8 +612,7 @@ IF (QT4_QMAKE_FOUND) _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) SET(QT_QTCORE_INCLUDE_DIR NOTFOUND) FIND_PATH(QT_QTCORE_INCLUDE_DIR QtCore - HINTS ${qt_headers} - ${QT_LIBRARY_DIR}/QtCore.framework/Headers + HINTS ${qt_headers} ${QT_LIBRARY_DIR} PATH_SUFFIXES QtCore ) @@ -682,6 +630,10 @@ IF (QT4_QMAKE_FOUND) ENDIF() ENDIF() + IF(APPLE) + SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD}) + ENDIF(APPLE) + # Set QT_INCLUDE_DIR based on QT_HEADERS_DIR IF(QT_HEADERS_DIR) IF(QT_USE_FRAMEWORKS) @@ -835,7 +787,7 @@ IF (QT4_QMAKE_FOUND) PATHS ${QT_HEADERS_DIR}/${QT_MODULE} ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) # phonon doesn't seem consistent, let's try phonondefs.h for some # installations @@ -844,7 +796,7 @@ IF (QT4_QMAKE_FOUND) PATHS ${QT_HEADERS_DIR}/${QT_MODULE} ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) ENDIF(${QT_MODULE} STREQUAL "phonon") ENDFOREACH(QT_MODULE) @@ -854,11 +806,11 @@ IF (QT4_QMAKE_FOUND) # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR FIND_PATH(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt PATHS ${QT_HEADERS_DIR}/ActiveQt - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PATH(QT_QAXSERVER_INCLUDE_DIR ActiveQt PATHS ${QT_HEADERS_DIR}/ActiveQt - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) ENDIF(Q_WS_WIN) @@ -867,7 +819,7 @@ IF (QT4_QMAKE_FOUND) PATHS ${QT_HEADERS_DIR}/QtDesigner ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) # Set QT_QTASSISTANT_INCLUDE_DIR @@ -875,7 +827,7 @@ IF (QT4_QMAKE_FOUND) PATHS ${QT_HEADERS_DIR}/QtAssistant ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR @@ -883,7 +835,7 @@ IF (QT4_QMAKE_FOUND) PATHS ${QT_HEADERS_DIR}/QtAssistant ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) ######################################## @@ -897,11 +849,11 @@ IF (QT4_QMAKE_FOUND) STRING(TOUPPER ${QT_MODULE} _upper_qt_module) FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_RELEASE NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4 - PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH + PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_LIBRARY(QT_${_upper_qt_module}_LIBRARY_DEBUG NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4 - PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH + PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) ENDFOREACH(QT_MODULE) @@ -911,26 +863,26 @@ IF (QT4_QMAKE_FOUND) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE) # Set QT_QTDESIGNERCOMPONENTS_LIBRARY - FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents${QT_LIBINFIX} QtDesignerComponents${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents${QT_LIBINFIX}_debug QtDesignerComponents${QT_LIBINFIX}d QtDesignerComponents${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # Set QT_QTMAIN_LIBRARY IF(Q_WS_WIN) - FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) ENDIF(Q_WS_WIN) # Set QT_QTASSISTANTCLIENT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + FIND_LIBRARY(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # Set QT_QTASSISTANT_LIBRARY - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient${QT_LIBINFIX} QtAssistantClient${QT_LIBINFIX}4 QtAssistant${QT_LIBINFIX} QtAssistant${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient${QT_LIBINFIX}_debug QtAssistantClient${QT_LIBINFIX}d QtAssistantClient${QT_LIBINFIX}d4 QtAssistant${QT_LIBINFIX}_debug QtAssistant${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) # Set QT_QTHELP_LIBRARY - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) - FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) IF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) FIND_LIBRARY(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR}) ENDIF(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE) @@ -993,67 +945,67 @@ IF (QT4_QMAKE_FOUND) FIND_PROGRAM(QT_MOC_EXECUTABLE NAMES moc-qt4 moc PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_UIC_EXECUTABLE NAMES uic-qt4 uic PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_UIC3_EXECUTABLE NAMES uic3 PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_RCC_EXECUTABLE NAMES rcc PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE NAMES qdbuscpp2xml PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE NAMES qdbusxml2cpp PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_LUPDATE_EXECUTABLE NAMES lupdate-qt4 lupdate PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_LRELEASE_EXECUTABLE NAMES lrelease-qt4 lrelease PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_QCOLLECTIONGENERATOR_EXECUTABLE NAMES qcollectiongenerator-qt4 qcollectiongenerator PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_DESIGNER_EXECUTABLE NAMES designer-qt4 designer PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_PROGRAM(QT_LINGUIST_EXECUTABLE NAMES linguist-qt4 linguist PATHS ${QT_BINARY_DIR} - NO_DEFAULT_PATH + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) IF (QT_MOC_EXECUTABLE) @@ -1075,32 +1027,7 @@ IF (QT4_QMAKE_FOUND) # get the directory of the current file, used later on in the file GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) - ###################################### - # - # decide if Qt got found - # - ###################################### - - # if the includes,libraries,moc,uic and rcc are found then we have it - IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND - QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) - SET( QT4_FOUND "YES" ) - INCLUDE(FindPackageMessage) - FIND_PACKAGE_MESSAGE(Qt4 "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})" - "[${QT_LIBRARY_DIR}][${QT_INCLUDE_DIR}][${QT_MOC_EXECUTABLE}][${QT_UIC_EXECUTABLE}][${QT_RCC_EXECUTABLE}]") - ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND - QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) - SET( QT4_FOUND "NO") - SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) - IF( Qt4_FIND_REQUIRED) - MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!") - ENDIF( Qt4_FIND_REQUIRED) - ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND - QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE AND QT_QTCORE_LIBRARY) - SET(QT_FOUND ${QT4_FOUND}) - - ############################################### # # configuration/system dependent settings @@ -1158,11 +1085,11 @@ IF (QT4_QMAKE_FOUND) IF(QT_IS_STATIC) FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_RELEASE NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4 - PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_DEBUG NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4 - PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) _QT4_ADJUST_LIB_VARS(${QT_PLUGIN}) ELSE(QT_IS_STATIC) @@ -1171,11 +1098,11 @@ IF (QT4_QMAKE_FOUND) SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX}) FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_RELEASE NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4 - PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_DEBUG NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4 - PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) MARK_AS_ADVANCED(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG) SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT}) @@ -1192,44 +1119,58 @@ IF (QT4_QMAKE_FOUND) INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake") + # set version variables + STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") + STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") + STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") - ####################################### - # - # compatibility settings - # - ####################################### - # Backwards compatibility for CMake1.4 and 1.2 - SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) - SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) - - SET( QT_QT_LIBRARY "") - -ELSE(QT4_QMAKE_FOUND) - - SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE) - - # The code below is overly complex to make sure we do not break compatibility with CMake 2.6.x - # For CMake 2.8, it should be simplified by getting rid of QT4_INSTALLED_VERSION_TOO_OLD and - # QT4_INSTALLED_VERSION_TOO_NEW - IF(Qt4_FIND_REQUIRED) - IF(QT4_INSTALLED_VERSION_TOO_OLD) - IF( Qt4_FIND_VERSION_EXACT ) - MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, version ${QT_MIN_VERSION} is required") - ELSE( Qt4_FIND_VERSION_EXACT ) - MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") - ENDIF( Qt4_FIND_VERSION_EXACT ) - ELSE(QT4_INSTALLED_VERSION_TOO_OLD) - IF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) - MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too new, version ${QT_MIN_VERSION} is required") - ELSE( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) - MESSAGE( FATAL_ERROR "Qt qmake not found!") - ENDIF( Qt4_FIND_VERSION_EXACT AND QT4_INSTALLED_VERSION_TOO_NEW ) - ENDIF(QT4_INSTALLED_VERSION_TOO_OLD) - ELSE(Qt4_FIND_REQUIRED) - IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) - MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required") - ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY) - ENDIF(Qt4_FIND_REQUIRED) - -ENDIF (QT4_QMAKE_FOUND) +ENDIF(QT_QMAKE_EXECUTABLE AND QTVERSION) + +#support old QT_MIN_VERSION if set, but not if version is supplied by find_package() +IF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION) + SET(Qt4_FIND_VERSION ${QT_MIN_VERSION}) +ENDIF(NOT Qt4_FIND_VERSION AND QT_MIN_VERSION) + +IF( Qt4_FIND_COMPONENTS ) + + # if components specified in find_package(), make sure each of those pieces were found + SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR) + FOREACH( component ${Qt4_FIND_COMPONENTS} ) + STRING( TOUPPER ${component} _COMPONENT ) + if(${_COMPONENT} STREQUAL "QTMAIN") + IF(Q_WS_WIN) + SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_LIBRARY) + ENDIF(Q_WS_WIN) + else(${_COMPONENT} STREQUAL "QTMAIN") + SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY) + endif(${_COMPONENT} STREQUAL "QTMAIN") + ENDFOREACH( component ) + + if(Qt4_FIND_COMPONENTS MATCHES QtGui) + SET(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE) + endif(Qt4_FIND_COMPONENTS MATCHES QtGui) + +ELSE( Qt4_FIND_COMPONENTS ) + + # if no components specified, we'll make a default set of required variables to say Qt is found + SET(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR + QT_LIBRARY_DIR QT_QTCORE_LIBRARY) + +ENDIF( Qt4_FIND_COMPONENTS ) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4 + REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} + VERSION_VAR QTVERSION + ) + +####################################### +# +# compatibility settings +# +####################################### +# Backwards compatibility for CMake1.4 and 1.2 +SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} ) +SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} ) +SET( QT_QT_LIBRARY "") +SET(QT_FOUND ${QT4_FOUND}) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 2dfe8b1..59e5ec1 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -70,9 +70,11 @@ IF(MSVC) IF(MSVC80) # Find the runtime library redistribution directory. + GET_FILENAME_COMPONENT(msvc_install_dir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]" ABSOLUTE) FIND_PATH(MSVC80_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC80.CRT/Microsoft.VC80.CRT.manifest PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../VC/redist" + "${msvc_install_dir}/../../VC/redist" "${base_dir}/VC/redist" ) MARK_AS_ADVANCED(MSVC80_REDIST_DIR) @@ -103,10 +105,14 @@ IF(MSVC) IF(MSVC90) # Find the runtime library redistribution directory. + GET_FILENAME_COMPONENT(msvc_install_dir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]" ABSOLUTE) + GET_FILENAME_COMPONENT(msvc_express_install_dir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]" ABSOLUTE) FIND_PATH(MSVC90_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0;InstallDir]/../../VC/redist" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0;InstallDir]/../../VC/redist" + "${msvc_install_dir}/../../VC/redist" + "${msvc_express_install_dir}/../../VC/redist" "${base_dir}/VC/redist" ) MARK_AS_ADVANCED(MSVC90_REDIST_DIR) @@ -137,9 +143,11 @@ IF(MSVC) IF(MSVC10) # Find the runtime library redistribution directory. + GET_FILENAME_COMPONENT(msvc_install_dir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]" ABSOLUTE) FIND_PATH(MSVC10_REDIST_DIR NAMES ${CMAKE_MSVC_ARCH}/Microsoft.VC100.CRT PATHS - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]/../../VC/redist" + "${msvc_install_dir}/../../VC/redist" "${base_dir}/VC/redist" "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/VC/redist" "$ENV{ProgramFiles(x86)}/Microsoft Visual Studio 10.0/VC/redist" diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index 79c06ba..543f3e8 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -19,5 +19,7 @@ endif() set(__AIX_COMPILER_GNU 1) macro(__aix_compiler_gnu lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G") endmacro() diff --git a/Modules/Platform/AIX-XL-ASM.cmake b/Modules/Platform/AIX-XL-ASM.cmake new file mode 100644 index 0000000..ea0944b --- /dev/null +++ b/Modules/Platform/AIX-XL-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XL) +__aix_compiler_xl(ASM) diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake index 2de30d5..5e437fa 100644 --- a/Modules/Platform/AIX-XL-C.cmake +++ b/Modules/Platform/AIX-XL-C.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_C_FLAGS " ") -SET(CMAKE_SHARED_MODULE_C_FLAGS " ") +include(Platform/AIX-XL) +__aix_compiler_xl(C) diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake index 648cb31..ef38a5f 100644 --- a/Modules/Platform/AIX-XL-CXX.cmake +++ b/Modules/Platform/AIX-XL-CXX.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS " ") -SET(CMAKE_SHARED_MODULE_CXX_FLAGS " ") +include(Platform/AIX-XL) +__aix_compiler_xl(CXX) diff --git a/Modules/Platform/AIX-XL-Fortran.cmake b/Modules/Platform/AIX-XL-Fortran.cmake index 8292e78..6d4f655 100644 --- a/Modules/Platform/AIX-XL-Fortran.cmake +++ b/Modules/Platform/AIX-XL-Fortran.cmake @@ -1,4 +1,2 @@ -SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared -SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib -SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS " ") -SET(CMAKE_SHARED_MODULE_Fortran_FLAGS " ") +include(Platform/AIX-XL) +__aix_compiler_xl(Fortran) diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake new file mode 100644 index 0000000..1f94152 --- /dev/null +++ b/Modules/Platform/AIX-XL.cmake @@ -0,0 +1,28 @@ + +#============================================================================= +# Copyright 2002-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__AIX_COMPILER_XL) + return() +endif() +set(__AIX_COMPILER_XL 1) + +macro(__aix_compiler_xl lang) + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-brtl,-bnoipath") # -shared + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") + set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") +endmacro() diff --git a/Modules/Platform/AIX.cmake b/Modules/Platform/AIX.cmake index 0ab0cce..a9f773e 100644 --- a/Modules/Platform/AIX.cmake +++ b/Modules/Platform/AIX.cmake @@ -9,8 +9,6 @@ SET(CMAKE_DL_LIBS "-lld") # When our own RPATH is to be added it may be inserted before the # "always" paths. SET(CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH /usr/lib /lib) -SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-blibpath:") -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) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index a99ff4a..c11c8fb 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -68,7 +68,8 @@ IF(NOT _CMAKE_OSX_SDKS) FIND_PROGRAM(CMAKE_XCODE_SELECT xcode-select) IF(CMAKE_XCODE_SELECT) EXECUTE_PROCESS(COMMAND ${CMAKE_XCODE_SELECT} "-print-path" - OUTPUT_VARIABLE OSX_DEVELOPER_ROOT) + OUTPUT_VARIABLE OSX_DEVELOPER_ROOT + OUTPUT_STRIP_TRAILING_WHITESPACE) FILE(GLOB _CMAKE_OSX_SDKS "${OSX_DEVELOPER_ROOT}/SDKs/*") ENDIF(CMAKE_XCODE_SELECT) ENDIF(NOT _CMAKE_OSX_SDKS) diff --git a/Modules/Platform/HP-UX-HP-ASM.cmake b/Modules/Platform/HP-UX-HP-ASM.cmake new file mode 100644 index 0000000..0a85905 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-ASM.cmake @@ -0,0 +1,6 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(ASM) + +set(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-E -b +nodefaultrpath -L/usr/lib") + +set(CMAKE_ASM_CREATE_SHARED_LIBRARY "ld <CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake new file mode 100644 index 0000000..d83e01b --- /dev/null +++ b/Modules/Platform/HP-UX-HP-C.cmake @@ -0,0 +1,11 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(C) + +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-E -b +nodefaultrpath -L/usr/lib") + +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <FLAGS> -o <OBJECT> -c <SOURCE>") + +# use ld directly to create shared libraries for hp cc +set(CMAKE_C_CREATE_SHARED_LIBRARY "ld <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake new file mode 100644 index 0000000..8f3c70c --- /dev/null +++ b/Modules/Platform/HP-UX-HP-CXX.cmake @@ -0,0 +1,16 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(CXX) + +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "+Z -Wl,-E,+nodefaultrpath -b -L/usr/lib") + +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE + "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE>" + "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" + "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o" + ) + +set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") +set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake new file mode 100644 index 0000000..5a3ab19 --- /dev/null +++ b/Modules/Platform/HP-UX-HP-Fortran.cmake @@ -0,0 +1,7 @@ +include(Platform/HP-UX-HP) +__hpux_compiler_hp(Fortran) + +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-E -b -L/usr/lib") + +set(CMAKE_Fortran_CREATE_SHARED_LIBRARY + "ld <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake new file mode 100644 index 0000000..5e70d31 --- /dev/null +++ b/Modules/Platform/HP-UX-HP.cmake @@ -0,0 +1,34 @@ + +#============================================================================= +# Copyright 2002-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__HPUX_COMPILER_HP) + return() +endif() +set(__HPUX_COMPILER_HP 1) +set(_Wl_C "") +set(_Wl_CXX "-Wl,") +set(_Wl_Fortran "") +set(_Wl_ASM "") + +macro(__hpux_compiler_hp lang) + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "${_Wl_${lang}}+b") + set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "${_Wl_${lang}}+h") + set(CMAKE_EXECUTABLE_RUNTIME_${lang}_FLAG "-Wl,+b") + + set(CMAKE_${lang}_FLAGS_INIT "") +endmacro() diff --git a/Modules/Platform/HP-UX.cmake b/Modules/Platform/HP-UX.cmake index 9d357c9..ab3dc22 100644 --- a/Modules/Platform/HP-UX.cmake +++ b/Modules/Platform/HP-UX.cmake @@ -15,57 +15,6 @@ SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) # specifying the file path. SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1) -# fortran -IF(CMAKE_COMPILER_IS_GNUG77) -ELSE(CMAKE_COMPILER_IS_GNUG77) - # use ld directly to create shared libraries for hp cc - SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "ld <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "+Z") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-E -b -L/usr/lib") # -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 "+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "+h") - SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-Wl,+b") # -rpath -ENDIF(CMAKE_COMPILER_IS_GNUG77) - -# C compiler -IF(CMAKE_COMPILER_IS_GNUCC) -ELSE(CMAKE_COMPILER_IS_GNUCC) - # hp cc - # use ld directly to create shared libraries for hp cc - SET(CMAKE_C_CREATE_SHARED_LIBRARY - "ld <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") - SET(CMAKE_SHARED_LIBRARY_C_FLAGS "+Z") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-E -b +nodefaultrpath -L/usr/lib") # -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 "+b") # -rpath - SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty - SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "+h") - SET(CMAKE_EXECUTABLE_RUNTIME_C_FLAG "-Wl,+b") # -rpath - SET(CMAKE_C_FLAGS_INIT "") - SET(CMAKE_C_COMPILE_OBJECT - "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <FLAGS> -o <OBJECT> -c <SOURCE>") -ENDIF(CMAKE_COMPILER_IS_GNUCC) - -# CXX compiler -IF(CMAKE_COMPILER_IS_GNUCXX) -ELSE(CMAKE_COMPILER_IS_GNUCXX) - # for hp aCC - SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "+Z") # -pic - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "+Z -Wl,-E,+nodefaultrpath -b -L/usr/lib") # -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_SONAME_CXX_FLAG "-Wl,+h") - SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath - SET (CMAKE_CXX_FLAGS_INIT "") - SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g") -ENDIF(CMAKE_COMPILER_IS_GNUCXX) # set flags for gcc support INCLUDE(Platform/UnixPaths) @@ -81,20 +30,6 @@ LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64) LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /usr/lib/hpux32 /usr/lib/hpux64) -IF(NOT CMAKE_COMPILER_IS_GNUCC) - SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") -ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) - -IF(NOT CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") - SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE>" - "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>" - "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o" - ) -ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) - # Initialize C and CXX 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 diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 271236c..1d3e4b5 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -43,6 +43,7 @@ endif() set(CMAKE_DL_LIBS "") set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "-l") +set(CMAKE_LINK_DEF_FILE_FLAG "") # Empty string: passing the file is enough set(CMAKE_LINK_LIBRARY_SUFFIX "") set(CMAKE_CREATE_WIN32_EXE "-mwindows") diff --git a/Modules/Platform/Windows-Intel-ASM.cmake b/Modules/Platform/Windows-Intel-ASM.cmake new file mode 100644 index 0000000..31d08c7 --- /dev/null +++ b/Modules/Platform/Windows-Intel-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(ASM) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake new file mode 100644 index 0000000..eff4766 --- /dev/null +++ b/Modules/ProcessorCount.cmake @@ -0,0 +1,183 @@ +# - ProcessorCount(var) +# Determine the number of processors/cores and save value in ${var} +# +# Sets the variable named ${var} to the number of physical cores available on +# the machine if the information can be determined. Otherwise it is set to 0. +# Currently this functionality is implemented for AIX, cygwin, FreeBSD, HPUX, +# IRIX, Linux, Mac OS X, QNX, Sun and Windows. +# +# This function is guaranteed to return a positive integer (>=1) if it +# succeeds. It returns 0 if there's a problem determining the processor count. +# +# Example use, in a ctest -S dashboard script: +# +# include(ProcessorCount) +# ProcessorCount(N) +# if(NOT N EQUAL 0) +# set(CTEST_BUILD_FLAGS -j${N}) +# set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +# endif() +# +# This function is intended to offer an approximation of the value of the +# number of compute cores available on the current machine, such that you +# may use that value for parallel building and parallel testing. It is meant +# to help utilize as much of the machine as seems reasonable. Of course, +# knowledge of what else might be running on the machine simultaneously +# should be used when deciding whether to request a machine's full capacity +# all for yourself. + +# A more reliable way might be to compile a small C program that uses the CPUID +# instruction, but that again requires compiler support or compiling assembler +# code. + +#============================================================================= +# Copyright 2010-2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(ProcessorCount var) + # Unknown: + set(count 0) + + if(WIN32) + # Windows: + set(count "$ENV{NUMBER_OF_PROCESSORS}") + #message("ProcessorCount: WIN32, trying environment variable") + endif() + + if(NOT count) + # Mac, FreeBSD, OpenBSD (systems with sysctl): + find_program(ProcessorCount_cmd_sysctl sysctl + PATHS /usr/sbin /sbin) + if(ProcessorCount_cmd_sysctl) + execute_process(COMMAND ${ProcessorCount_cmd_sysctl} -n hw.ncpu + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE count) + #message("ProcessorCount: trying sysctl '${ProcessorCount_cmd_sysctl}'") + endif() + endif() + + if(NOT count) + # Linux (systems with getconf): + find_program(ProcessorCount_cmd_getconf getconf) + if(ProcessorCount_cmd_getconf) + execute_process(COMMAND ${ProcessorCount_cmd_getconf} _NPROCESSORS_ONLN + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE count) + #message("ProcessorCount: trying getconf '${ProcessorCount_cmd_getconf}'") + endif() + endif() + + if(NOT count) + # HPUX (systems with machinfo): + find_program(ProcessorCount_cmd_machinfo machinfo + PATHS /usr/contrib/bin) + if(ProcessorCount_cmd_machinfo) + execute_process(COMMAND ${ProcessorCount_cmd_machinfo} + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE machinfo_output) + string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'") + endif() + endif() + + if(NOT count) + # IRIX (systems with hinv): + find_program(ProcessorCount_cmd_hinv hinv + PATHS /sbin) + if(ProcessorCount_cmd_hinv) + execute_process(COMMAND ${ProcessorCount_cmd_hinv} + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE hinv_output) + string(REGEX MATCHALL "([0-9]+) .* Processors" procs "${hinv_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying hinv '${ProcessorCount_cmd_hinv}'") + endif() + endif() + + if(NOT count) + # AIX (systems with lsconf): + find_program(ProcessorCount_cmd_lsconf lsconf + PATHS /usr/sbin) + if(ProcessorCount_cmd_lsconf) + execute_process(COMMAND ${ProcessorCount_cmd_lsconf} + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE lsconf_output) + string(REGEX MATCHALL "Number Of Processors: ([0-9]+)" procs "${lsconf_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying lsconf '${ProcessorCount_cmd_lsconf}'") + endif() + endif() + + if(NOT count) + # QNX (systems with pidin): + find_program(ProcessorCount_cmd_pidin pidin) + if(ProcessorCount_cmd_pidin) + execute_process(COMMAND ${ProcessorCount_cmd_pidin} info + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE pidin_output) + string(REGEX MATCHALL "Processor[0-9]+: " procs "${pidin_output}") + list(LENGTH procs count) + #message("ProcessorCount: trying pidin '${ProcessorCount_cmd_pidin}'") + endif() + endif() + + if(NOT count) + # Sun (systems where uname -X emits "NumCPU" in its output): + find_program(ProcessorCount_cmd_uname uname) + if(ProcessorCount_cmd_uname) + execute_process(COMMAND ${ProcessorCount_cmd_uname} -X + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE uname_X_output) + string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'") + endif() + endif() + + # Execute this code when all previously attempted methods return empty + # output: + # + if(NOT count) + # Systems with /proc/cpuinfo: + set(cpuinfo_file /proc/cpuinfo) + if(EXISTS "${cpuinfo_file}") + file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$") + list(LENGTH procs count) + #message("ProcessorCount: trying cpuinfo '${cpuinfo_file}'") + endif() + endif() + + # Since cygwin builds of CMake do not define WIN32 anymore, but they still + # run on Windows, and will still have this env var defined: + # + if(NOT count) + set(count "$ENV{NUMBER_OF_PROCESSORS}") + #message("ProcessorCount: last fallback, trying environment variable") + endif() + + # Ensure an integer return (avoid inadvertently returning an empty string + # or an error string)... If it's not a decimal integer, return 0: + # + if(NOT count MATCHES "^[0-9]+$") + set(count 0) + endif() + + set(${var} ${count} PARENT_SCOPE) +endfunction() diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 86a7404..6d7a3ec 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -107,10 +107,8 @@ MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) 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) + STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") + FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}") ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters DEPENDS ${infile} diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index 9ecfff0..a0f2e86 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -6,7 +6,7 @@ # # Note that for MinGW users the order of libs is important! # FIND_PACKAGE(wxWidgets REQUIRED net gl core base) # INCLUDE(${wxWidgets_USE_FILE}) -# # and for each of your dependant executable/library targets: +# # and for each of your dependent executable/library targets: # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES}) # # DEPRECATED |