diff options
Diffstat (limited to 'Modules')
79 files changed, 1845 insertions, 348 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index b7975d3..45dda40 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -424,7 +424,9 @@ function(get_item_rpaths item rpaths_var) string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}") string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}") if(load_cmds_ov) - gp_append_unique(${rpaths_var} "${load_cmds_ov}") + foreach(rpath ${load_cmds_ov}) + gp_append_unique(${rpaths_var} "${rpath}") + endforeach() endif() endif() diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index c72e338..f109a14 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,6 +2,7 @@ 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_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 63f8787..5bfe0fd 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -21,6 +21,10 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ @@ -55,6 +59,9 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif require += info_language_dialect_default[argc]; (void)argv; return require; diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index d2417aa..fa87ca8 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -18,6 +18,8 @@ # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. +include(CMakeLanguageInformation) + # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file if(UNIX) @@ -60,6 +62,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_C_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(C) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 52e44f6..9e90aea 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,6 +2,7 @@ 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_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") +set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 61cd790..3e5c0fc 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,6 +20,10 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@ @@ -49,6 +53,9 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif require += info_language_dialect_default[argc]; (void)argv; return require; diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 091627b..b35280f 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -18,6 +18,8 @@ # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. +include(CMakeLanguageInformation) + # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file if(UNIX) @@ -59,6 +61,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_CXX_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(CXX) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 19bcbcc..cbc0055 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -89,6 +89,7 @@ function(compiler_id_detection outvar lang) MSVC ADSP IAR + ARMCC ) if (lang STREQUAL C) list(APPEND ordered_compilers diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 25af3e3..91111d2 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -92,6 +92,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)") + include(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 5b3c7f2..feae1c4 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -107,6 +107,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) PARENT_SCOPE) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_WRAPPER "${CMAKE_${lang}_COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) @@ -432,6 +433,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(HAVE_COMPILER_VERSION_MINOR 0) set(HAVE_COMPILER_VERSION_PATCH 0) set(HAVE_COMPILER_VERSION_TWEAK 0) + set(COMPILER_WRAPPER) set(DIGIT_VALUE_1 1) set(DIGIT_VALUE_2 10) set(DIGIT_VALUE_3 100) @@ -473,6 +475,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endforeach() endforeach() + if("${info}" MATCHES "INFO:compiler_wrapper\\[([^]\"]*)\\]") + set(COMPILER_WRAPPER "${CMAKE_MATCH_1}") + endif() if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]") set(SIMULATE_ID "${CMAKE_MATCH_1}") endif() @@ -585,6 +590,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 911ffac..ccafb07 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -54,6 +54,7 @@ else() if(NOT CMAKE_Fortran_COMPILER_INIT) # Known compilers: # f77/f90/f95: generic compiler names + # ftn: Cray fortran compiler wrapper # g77: GNU Fortran 77 compiler # gfortran: putative GNU Fortran 95+ compiler (in progress) # fort77: native F77 compiler under HP-UX (and some older Crays) @@ -73,6 +74,7 @@ else() # then 77 or older compilers, gnu is always last in the group, # so if you paid for a compiler it is picked by default. set(CMAKE_Fortran_COMPILER_LIST + ftn ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 1d8b110..343ab3f 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -2,11 +2,17 @@ # CMakeForceCompiler # ------------------ # +# Deprecated. Do not use. # +# The macros provided by this module were once intended for use by +# cross-compiling toolchain files when CMake was not able to automatically +# detect the compiler identification. Since the introduction of this module, +# CMake's compiler identification capabilities have improved and can now be +# taught to recognize any compiler. Furthermore, the suite of information +# CMake detects from a compiler is now too extensive to be provided by +# toolchain files using these macros. # -# This module defines macros intended for use by cross-compiling -# toolchain files when CMake is not able to automatically detect the -# compiler identification. +# ------------------------------------------------------------------------- # # Macro CMAKE_FORCE_C_COMPILER has the following signature: # @@ -64,6 +70,8 @@ # License text for the above reference.) macro(CMAKE_FORCE_C_COMPILER compiler id) + message(DEPRECATION "The CMAKE_FORCE_C_COMPILER macro is deprecated. " + "Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler.") set(CMAKE_C_COMPILER "${compiler}") set(CMAKE_C_COMPILER_ID_RUN TRUE) set(CMAKE_C_COMPILER_ID ${id}) @@ -76,6 +84,8 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_CXX_COMPILER compiler id) + message(DEPRECATION "The CMAKE_FORCE_CXX_COMPILER macro is deprecated. " + "Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler.") set(CMAKE_CXX_COMPILER "${compiler}") set(CMAKE_CXX_COMPILER_ID_RUN TRUE) set(CMAKE_CXX_COMPILER_ID ${id}) @@ -88,6 +98,8 @@ macro(CMAKE_FORCE_CXX_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_Fortran_COMPILER compiler id) + message(DEPRECATION "The CMAKE_FORCE_Fortran_COMPILER macro is deprecated. " + "Instead just set CMAKE_Fortran_COMPILER and allow CMake to identify the compiler.") set(CMAKE_Fortran_COMPILER "${compiler}") set(CMAKE_Fortran_COMPILER_ID_RUN TRUE) set(CMAKE_Fortran_COMPILER_ID ${id}) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 14fdd60..2a4bea4 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") +set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 2f7f40e..67cda3b 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -110,6 +110,9 @@ # endif PRINT *, 'INFO:compiler[]' #endif +#if defined(__CRAYXE) || defined(__CRAYXC) + PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' +#endif #if 0 ! Identify the platform diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 79393d3..1fd0972 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -12,6 +12,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +include(CMakeLanguageInformation) + # This file sets the basic flags for the Fortran language in CMake. # It also loads the available platform file for the system-compiler # if it exists. @@ -36,6 +38,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_Fortran_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(Fortran) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake new file mode 100644 index 0000000..f052a3b --- /dev/null +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -0,0 +1,297 @@ + +#============================================================================= +# Copyright 2014-2015 Ruslan Baratov, Gregor Jasny +# +# 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 to print messages of this module +function(_ios_install_combined_message) + message("[iOS combined] " ${ARGN}) +endfunction() + +# Get build settings for the current target/config/SDK by running +# `xcodebuild -sdk ... -showBuildSettings` and parsing it's output +function(_ios_install_combined_get_build_setting sdk variable resultvar) + if("${sdk}" STREQUAL "") + message(FATAL_ERROR "`sdk` is empty") + endif() + + if("${variable}" STREQUAL "") + message(FATAL_ERROR "`variable` is empty") + endif() + + if("${resultvar}" STREQUAL "") + message(FATAL_ERROR "`resultvar` is empty") + endif() + + set( + cmd + xcodebuild -showBuildSettings + -sdk "${sdk}" + -target "${CURRENT_TARGET}" + -config "${CURRENT_CONFIG}" + ) + + execute_process( + COMMAND ${cmd} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Command failed (${result}): ${cmd}") + endif() + + if(NOT output MATCHES " ${variable} = ([^\n]*)") + message(FATAL_ERROR "${variable} not found.") + endif() + + set("${resultvar}" "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + +# Get architectures of given SDK (iphonesimulator/iphoneos) +function(_ios_install_combined_get_valid_archs sdk resultvar) + cmake_policy(SET CMP0007 NEW) + + if("${resultvar}" STREQUAL "") + message(FATAL_ERROR "`resultvar` is empty") + endif() + + _ios_install_combined_get_build_setting("${sdk}" "VALID_ARCHS" valid_archs) + + separate_arguments(valid_archs) + list(REMOVE_ITEM valid_archs "") # remove empty elements + list(REMOVE_DUPLICATES valid_archs) + + set("${resultvar}" "${valid_archs}" PARENT_SCOPE) +endfunction() + +# Final target can contain more architectures that specified by SDK. This +# function will run 'lipo -info' and parse output. Result will be returned +# as a CMake list. +function(_ios_install_combined_get_real_archs filename resultvar) + set(cmd "${_lipo_path}" -info "${filename}") + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() + + if(NOT output MATCHES "(Architectures in the fat file: [^\n]+ are|Non-fat file: [^\n]+ is architecture): ([^\n]*)") + message(FATAL_ERROR "Could not detect architecture from: ${output}") + endif() + + separate_arguments(CMAKE_MATCH_2) + set(${resultvar} ${CMAKE_MATCH_2} PARENT_SCOPE) +endfunction() + +# Run build command for the given SDK +function(_ios_install_combined_build sdk) + if("${sdk}" STREQUAL "") + message(FATAL_ERROR "`sdk` is empty") + endif() + + _ios_install_combined_message("Build `${CURRENT_TARGET}` for `${sdk}`") + + execute_process( + COMMAND + "${CMAKE_COMMAND}" + --build + . + --target "${CURRENT_TARGET}" + --config ${CURRENT_CONFIG} + -- + -sdk "${sdk}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Build failed") + endif() +endfunction() + +# Remove given architecture from file. This step needed only in rare cases +# when target was built in "unusual" way. Emit warning message. +function(_ios_install_combined_remove_arch lib arch) + _ios_install_combined_message( + "Warning! Unexpected architecture `${arch}` detected and will be removed " + "from file `${lib}`") + set(cmd "${_lipo_path}" -remove ${arch} -output ${lib} ${lib}) + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() +endfunction() + +# Check that 'lib' contains only 'archs' architectures (remove others). +function(_ios_install_combined_keep_archs lib archs) + _ios_install_combined_get_real_archs("${lib}" real_archs) + set(archs_to_remove ${real_archs}) + list(REMOVE_ITEM archs_to_remove ${archs}) + foreach(x ${archs_to_remove}) + _ios_install_combined_remove_arch("${lib}" "${x}") + endforeach() +endfunction() + +function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var) + cmake_policy(SET CMP0057 NEW) + + set(this_sdk "$ENV{PLATFORM_NAME}") + if("${this_sdk}" STREQUAL "") + message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty") + endif() + + set(all_platforms "$ENV{SUPPORTED_PLATFORMS}") + if("${all_platforms}" STREQUAL "") + message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty") + endif() + + separate_arguments(all_platforms) + if(NOT this_sdk IN_LIST all_platforms) + message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`") + endif() + + list(REMOVE_ITEM all_platforms "" "${this_sdk}") + list(LENGTH all_platforms all_platforms_length) + if(NOT all_platforms_length EQUAL 1) + message(FATAL_ERROR "Expected one element: ${all_platforms}") + endif() + + set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE) + set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE) +endfunction() + +# Create combined binary for the given target. +# +# Preconditions: +# * Target already installed at ${destination} +# for the ${PLATFORM_NAME} platform +# +# This function will: +# * Run build for the lacking platform, i.e. opposite to the ${PLATFORM_NAME} +# * Fuse both libraries by running lipo +function(ios_install_combined target destination) + if("${target}" STREQUAL "") + message(FATAL_ERROR "`target` is empty") + endif() + + if("${destination}" STREQUAL "") + message(FATAL_ERROR "`destination` is empty") + endif() + + if(NOT IS_ABSOLUTE "${destination}") + message(FATAL_ERROR "`destination` is not absolute: ${destination}") + endif() + + if(IS_DIRECTORY "${destination}" OR IS_SYMLINK "${destination}") + message(FATAL_ERROR "`destination` is no regular file: ${destination}") + endif() + + if("${CMAKE_BINARY_DIR}" STREQUAL "") + message(FATAL_ERROR "`CMAKE_BINARY_DIR` is empty") + endif() + + if(NOT IS_DIRECTORY "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "Is not a directory: ${CMAKE_BINARY_DIR}") + endif() + + if("${CMAKE_INSTALL_CONFIG_NAME}" STREQUAL "") + message(FATAL_ERROR "CMAKE_INSTALL_CONFIG_NAME is empty") + endif() + + set(cmd xcrun -f lipo) + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() + set(_lipo_path ${output}) + + set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}") + set(CURRENT_TARGET "${target}") + + _ios_install_combined_message("Target: ${CURRENT_TARGET}") + _ios_install_combined_message("Config: ${CURRENT_CONFIG}") + _ios_install_combined_message("Destination: ${destination}") + + # Get SDKs + _ios_install_combined_detect_sdks(this_sdk corr_sdk) + + # Get architectures of the target + _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs) + _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs) + + # Return if there are no valid architectures for the SDK. + # (note that library already installed) + if("${corr_valid_archs}" STREQUAL "") + _ios_install_combined_message( + "No architectures detected for `${corr_sdk}` (skip)" + ) + return() + endif() + + # Trigger build of corresponding target + _ios_install_combined_build("${corr_sdk}") + + # Get location of the library in build directory + _ios_install_combined_get_build_setting( + "${corr_sdk}" "CONFIGURATION_BUILD_DIR" corr_build_dir) + _ios_install_combined_get_build_setting( + "${corr_sdk}" "EXECUTABLE_PATH" corr_executable_path) + set(corr "${corr_build_dir}/${corr_executable_path}") + + _ios_install_combined_keep_archs("${corr}" "${corr_valid_archs}") + _ios_install_combined_keep_archs("${destination}" "${this_valid_archs}") + + _ios_install_combined_message("Current: ${destination}") + _ios_install_combined_message("Corresponding: ${corr}") + + set(cmd "${_lipo_path}" -create ${corr} ${destination} -output ${destination}) + + execute_process( + COMMAND ${cmd} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Command failed: ${cmd}") + endif() + + _ios_install_combined_message("Install done: ${destination}") +endfunction() diff --git a/Modules/CMakeLanguageInformation.cmake b/Modules/CMakeLanguageInformation.cmake new file mode 100644 index 0000000..e03d149 --- /dev/null +++ b/Modules/CMakeLanguageInformation.cmake @@ -0,0 +1,37 @@ + +#============================================================================= +# Copyright 2015 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 file contains common code blocks used by all the language information +# files + +# load any compiler-wrapper specific information +macro(__cmake_include_compiler_wrapper lang) + set(_INCLUDED_WRAPPER_FILE 0) + if (CMAKE_${lang}_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif() + if (NOT _INCLUDED_WRAPPER_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif () + + # No platform - wrapper - lang information so maybe there's just wrapper - lang information + if(NOT _INCLUDED_WRAPPER_FILE) + if (CMAKE_${lang}_COMPILER_ID) + include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif() + if (NOT _INCLUDED_WRAPPER_FILE) + include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif () + endif () +endmacro () diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake index 8553f38..fc64ab9 100644 --- a/Modules/CMakeParseArguments.cmake +++ b/Modules/CMakeParseArguments.cmake @@ -2,86 +2,10 @@ # CMakeParseArguments # ------------------- # -# -# -# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> -# <multi_value_keywords> args...) -# -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions -# for parsing the arguments given to that macro or function. It -# processes the arguments and defines a set of variables which hold the -# values of the respective options. -# -# The <options> argument contains all options for the respective macro, -# i.e. keywords which can be used when calling the macro without any -# value following, like e.g. the OPTIONAL keyword of the install() -# command. -# -# The <one_value_keywords> argument contains all keywords for this macro -# which are followed by one value, like e.g. DESTINATION keyword of the -# install() command. -# -# The <multi_value_keywords> argument contains all keywords for this -# macro which can be followed by more than one value, like e.g. the -# TARGETS or FILES keywords of the install() command. -# -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the -# keywords listed in <options>, <one_value_keywords> and -# <multi_value_keywords> a variable composed of the given <prefix> -# followed by "_" and the name of the respective keyword. These -# variables will then hold the respective value from the argument list. -# For the <options> keywords this will be TRUE or FALSE. -# -# All remaining arguments are collected in a variable -# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see -# whether your macro was called with unrecognized parameters. -# -# As an example here a my_install() macro, which takes similar arguments -# as the real install() command: -# -# :: -# -# function(MY_INSTALL) -# set(options OPTIONAL FAST) -# set(oneValueArgs DESTINATION RENAME) -# set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" -# "${multiValueArgs}" ${ARGN} ) -# ... -# -# -# -# Assume my_install() has been called like this: -# -# :: -# -# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) -# -# -# -# After the cmake_parse_arguments() call the macro will have set the -# following variables: -# -# :: -# -# MY_INSTALL_OPTIONAL = TRUE -# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() -# MY_INSTALL_DESTINATION = "bin" -# MY_INSTALL_RENAME = "" (was not used) -# MY_INSTALL_TARGETS = "foo;bar" -# MY_INSTALL_CONFIGURATIONS = "" (was not used) -# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" -# -# -# -# You can then continue and process these variables. -# -# Keywords terminate lists of values, e.g. if directly after a -# one_value_keyword another recognized keyword follows, this is -# interpreted as the beginning of the new option. E.g. -# my_install(TARGETS foo DESTINATION OPTIONAL) would result in -# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION -# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. +# This module once implemented the :command:`cmake_parse_arguments` command +# that is now implemented natively by CMake. It is now an empty placeholder +# for compatibility with projects that include it to get the command from +# CMake 3.4 and lower. #============================================================================= # Copyright 2010 Alexander Neundorf <neundorf@kde.org> @@ -95,67 +19,3 @@ #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) - - -if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) - return() -endif() -set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) - - -function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) - # first set all result variables to empty/FALSE - foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach() - - foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach() - - set(${prefix}_UNPARSED_ARGUMENTS) - - set(insideValues FALSE) - set(currentArgName) - - # now iterate over all arguments and fill the result variables - foreach(currentArg ${ARGN}) - list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword - - if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) - if(insideValues) - if("${insideValues}" STREQUAL "SINGLE") - set(${prefix}_${currentArgName} ${currentArg}) - set(insideValues FALSE) - elseif("${insideValues}" STREQUAL "MULTI") - list(APPEND ${prefix}_${currentArgName} ${currentArg}) - endif() - else() - list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif() - else() - if(NOT ${optionIndex} EQUAL -1) - set(${prefix}_${currentArg} TRUE) - set(insideValues FALSE) - elseif(NOT ${singleArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "SINGLE") - elseif(NOT ${multiArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "MULTI") - endif() - endif() - - endforeach() - - # propagate the result variables to the caller: - foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) - set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach() - set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) - -endfunction() diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 5756001..77f854d 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -586,7 +586,7 @@ _cpack_set_default(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}") # set sysroot so SDK tools can be used if(CMAKE_OSX_SYSROOT) - _cpack_set_default(CPACK_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}") + _cpack_set_default(CPACK_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") endif() if(DEFINED CPACK_COMPONENTS_ALL) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index b7a6ba5..e34f8cd 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -26,15 +26,56 @@ # Path to a custom DS_Store file. This .DS_Store file 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 +# the Finder (either manually or through AppleScript) using a normal folder # from which the .DS_Store file can then be extracted. # +# .. variable:: CPACK_DMG_DS_STORE_SETUP_SCRIPT +# +# Path to a custom AppleScript file. This AppleScript is used to generate +# a .DS_Store file which specifies the Finder window position/geometry and +# layout (such as hidden toolbars, placement of the icons etc.). +# By specifying a custom AppleScript there is no need to use +# CPACK_DMG_DS_STORE, as the .DS_Store that is generated by the AppleScript +# will be packaged. +# # .. variable:: CPACK_DMG_BACKGROUND_IMAGE # -# Path to a background image file. This file will 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. +# Path to an image file to be used as the background. This file will be +# copied to .background/background.<ext>, where ext is the original image file +# extension. The background image is installed into the image before +# CPACK_DMG_DS_STORE_SETUP_SCRIPT is executed or CPACK_DMG_DS_STORE is +# installed. By default no background image is set. +# +# .. variable:: CPACK_DMG_SLA_DIR +# +# Directory where license and menu files for different languages are stored. +# Setting this causes CPack to look for a ``<language>.menu.txt`` and +# ``<language>.license.txt`` file for every language defined in +# ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and +# ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu +# files and use the same license file for all languages. +# +# .. variable:: CPACK_DMG_SLA_LANGUAGES +# +# Languages for which a license agreement is provided when mounting the +# generated DMG. A menu file consists of 9 lines of text. The first line is +# is the name of the language itself, uppercase, in English (e.g. German). +# The other lines are translations of the following strings: +# +# - Agree +# - Disagree +# - Print +# - Save... +# - You agree to the terms of the License Agreement when you click the +# "Agree" button. +# - Software License Agreement +# - This text cannot be saved. The disk may be full or locked, or the file +# may be locked. +# - Unable to print. Make sure you have selected a printer. +# +# For every language in this list, CPack will try to find files +# ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory +# specified by the :variable:`CPACK_DMG_SLA_DIR` variable. # # .. variable:: CPACK_COMMAND_HDIUTIL # diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 60e0d1f..2aaef61 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -8,7 +8,7 @@ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # CPackDeb may be used to create Deb package using CPack. -# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables +# CPackDeb is a CPack generator thus it uses the ``CPACK_XXX`` variables # used by CPack : https://cmake.org/Wiki/CMake:CPackConfiguration. # CPackDeb generator should work on any linux host but it will produce # better deb package when Debian specific tools 'dpkg-xxx' are usable on @@ -18,7 +18,7 @@ # :code:`CPACK_DEBIAN_XXX` variables. # # :code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have -# **component** specific values. Note however that <COMPONENT> refers to the +# **component** specific values. Note however that ``<COMPONENT>`` refers to the # **grouping name** written in upper case. It may be either a component name or # a component GROUP name. # @@ -27,11 +27,20 @@ # However as a handy reminder here comes the list of specific variables: # # .. variable:: CPACK_DEBIAN_PACKAGE_NAME +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME # -# The Debian package summary +# Set Package control field (variable is automatically transformed to lower +# case). # # * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_NAME` (lower case) +# * Default : +# +# - :variable:`CPACK_PACKAGE_NAME` for non-component based +# installations +# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT> +# for component-based installations. +# +# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source # # # .. variable:: CPACK_DEBIAN_PACKAGE_VERSION @@ -100,10 +109,16 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION +# +# Set Section control field e.g. admin, devel, doc, ... # # * Mandatory : YES # * Default : 'devel' # +# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections +# +# # .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE # # The compression used for creating the Debian package. @@ -114,12 +129,16 @@ # # # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY # -# The Debian package priority +# Set Priority control field e.g. required, important, standard, optional, +# extra # # * Mandatory : YES # * Default : 'optional' # +# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities +# # # .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE # @@ -354,7 +373,28 @@ # set by Debian policy # https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners # - +# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE +# +# Sets the ``Source`` field of the binary Debian package. +# When the binary package name is not the same as the source package name +# (in particular when several components/binaries are generated from one +# source) the source from which the binary has been generated should be +# indicated with the field ``Source``. +# +# * Mandatory : NO +# * Default : +# +# - An empty string for non-component based installations +# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based +# installations. +# +# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source +# +# .. note:: +# +# This value is not interpreted. It is possible to pass an optional +# revision number of the referenced source package as well. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -554,24 +594,33 @@ function(cpack_deb_prepare_package_vars) ) endif() + # Source: (optional) + # in case several packages are constructed from a unique source + # (multipackaging), the source may be indicated as well. + # The source might contain a version if the generated package + # version is different from the source version + if(NOT CPACK_DEBIAN_PACKAGE_SOURCE) + set(CPACK_DEBIAN_PACKAGE_SOURCE "") + endif() + # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES), # this returns the successful find_package() calls, maybe this can help # Depends: # You should set: DEBIAN_PACKAGE_DEPENDS # TODO: automate 'objdump -p | grep NEEDED' - # if per-component dependency, overrides the global CPACK_DEBIAN_PACKAGE_${dependency_type_} + # if per-component variable, overrides the global CPACK_DEBIAN_PACKAGE_${variable_type_} # automatic dependency discovery will be performed afterwards. if(CPACK_DEB_PACKAGE_COMPONENT) - foreach(dependency_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES) - set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${dependency_type_}") + foreach(value_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE SECTION PRIORITY NAME) + set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${value_type_}") - # if set, overrides the global dependency + # if set, overrides the global variable if(DEFINED ${_component_var}) - set(CPACK_DEBIAN_PACKAGE_${dependency_type_} "${${_component_var}}") + set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}") if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${_local_component_name}' ${dependency_type_}" - "dependencies set to '${CPACK_DEBIAN_PACKAGE_${dependency_}}'") + message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} " + "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'") endif() endif() endforeach() @@ -664,23 +713,25 @@ function(cpack_deb_prepare_package_vars) endif() endforeach() - set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}") - string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME) - else() - set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "") + if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME) + string(TOLOWER "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) + else() + string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEB_PACKAGE_COMPONENT}" CPACK_DEBIAN_PACKAGE_NAME) + endif() endif() # 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}") - message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = ${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}") + 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}'") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = '${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}'") + message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_SOURCE = '${CPACK_DEBIAN_PACKAGE_SOURCE}'") endif() # For debian source packages: @@ -719,6 +770,8 @@ function(cpack_deb_prepare_package_vars) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE) set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE) + set(GEN_CPACK_DEBIAN_PACKAGE_SOURCE + "${CPACK_DEBIAN_PACKAGE_SOURCE}" PARENT_SCOPE) set(GEN_WDIR "${WDIR}" PARENT_SCOPE) endfunction() diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index c6b3d19..db5984a 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -30,6 +30,14 @@ # # undocumented. # +# .. variable:: CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP +# +# The filename of a bitmap to use as the NSIS MUI_WELCOMEFINISHPAGE_BITMAP. +# +# .. variable:: CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP +# +# The filename of a bitmap to use as the NSIS MUI_UNWELCOMEFINISHPAGE_BITMAP. +# # .. variable:: CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS # # Extra NSIS commands that will be added to the beginning of the install diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 1e7b055..7fb11c3 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -37,6 +37,7 @@ # * Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY # # .. variable:: CPACK_RPM_PACKAGE_NAME +# CPACK_RPM_<component>_PACKAGE_NAME # # The RPM package name. # @@ -81,6 +82,7 @@ # * Default : "unknown" # # .. variable:: CPACK_RPM_PACKAGE_GROUP +# CPACK_RPM_<component>_PACKAGE_GROUP # # The RPM package group. # @@ -1106,10 +1108,7 @@ function(cpack_rpm_generate_package) # Are we packaging components ? if(CPACK_RPM_PACKAGE_COMPONENT) - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) - else() - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") endif() set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") @@ -1143,10 +1142,19 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_NAME (mandatory) + if(NOT CPACK_RPM_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME) + set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME}) + else() + set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}) + endif() + endif() + # CPACK_RPM_PACKAGE_VERSION (mandatory) if(NOT CPACK_RPM_PACKAGE_VERSION) if(NOT CPACK_PACKAGE_VERSION) @@ -1206,6 +1214,15 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_GROUP + + #Check for component group first. + #If not set, it will use regular package group logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP) + set(CPACK_RPM_PACKAGE_GROUP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP}) + endif() + endif() + if(NOT CPACK_RPM_PACKAGE_GROUP) set(CPACK_RPM_PACKAGE_GROUP "unknown") endif() @@ -1613,7 +1630,7 @@ function(cpack_rpm_generate_package) ) # 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}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") + set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") # Print out some debug information if we were asked for that if(CPACK_RPM_PACKAGE_DEBUG) @@ -1645,7 +1662,7 @@ function(cpack_rpm_generate_package) "# -*- rpm-spec -*- BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ -Name: \@CPACK_RPM_PACKAGE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_NAME\@ +Name: \@CPACK_RPM_PACKAGE_NAME\@ Version: \@CPACK_RPM_PACKAGE_VERSION\@ Release: \@CPACK_RPM_PACKAGE_RELEASE\@ License: \@CPACK_RPM_PACKAGE_LICENSE\@ @@ -1749,15 +1766,15 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT "${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") + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") 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) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_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: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err") message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***") endif() else() diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index bef8e16..4994005 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -119,7 +119,8 @@ # # .. variable:: CPACK_WIX_PATCH_FILE # -# Optional XML file with fragments to be inserted into generated WiX sources +# Optional list of XML files with fragments to be inserted into +# generated WiX sources # # This optional variable can be used to specify an XML file that the # WiX generator will use to inject fragments into its generated diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 6e80fb5..c2b1723 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -93,7 +93,7 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 0ce423c..5afeab6 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -81,7 +81,7 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 6d52ec6..f8736e2 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -94,7 +94,7 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 3c06d75..84b661d 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -82,7 +82,7 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c index 2732957..344c81b 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -16,8 +16,8 @@ int main(int ac, char*av[]){ pthread_create(&tid[0], 0, runner, (void*)1); pthread_create(&tid[1], 0, runner, (void*)2); -#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.) - usleep(1); // for strange behavior on single-processor sun +#if defined(__BEOS__) && !defined(__ZETA__) /* (no usleep on BeOS 5.) */ + usleep(1); /* for strange behavior on single-processor sun */ #endif pthread_join(tid[0], 0); diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake index f90d05b..0bdcffa 100644 --- a/Modules/CheckFortranSourceCompiles.cmake +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -94,7 +94,7 @@ macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) message(STATUS "Performing Test ${VAR} - Success") endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n" + "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() diff --git a/Modules/Compiler/ARMCC-ASM.cmake b/Modules/Compiler/ARMCC-ASM.cmake new file mode 100644 index 0000000..8e3cfc5 --- /dev/null +++ b/Modules/Compiler/ARMCC-ASM.cmake @@ -0,0 +1,7 @@ +include(Compiler/ARMCC) + +set(CMAKE_ASM_OUTPUT_EXTENSION ".o") +set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1) + +set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>") +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) diff --git a/Modules/Compiler/ARMCC-C.cmake b/Modules/Compiler/ARMCC-C.cmake new file mode 100644 index 0000000..dcdcaab --- /dev/null +++ b/Modules/Compiler/ARMCC-C.cmake @@ -0,0 +1,2 @@ +include(Compiler/ARMCC) +__compiler_armcc(C) diff --git a/Modules/Compiler/ARMCC-CXX.cmake b/Modules/Compiler/ARMCC-CXX.cmake new file mode 100644 index 0000000..811fc93 --- /dev/null +++ b/Modules/Compiler/ARMCC-CXX.cmake @@ -0,0 +1,2 @@ +include(Compiler/ARMCC) +__compiler_armcc(CXX) diff --git a/Modules/Compiler/ARMCC-DetermineCompiler.cmake b/Modules/Compiler/ARMCC-DetermineCompiler.cmake new file mode 100644 index 0000000..a3667d7 --- /dev/null +++ b/Modules/Compiler/ARMCC-DetermineCompiler.cmake @@ -0,0 +1,16 @@ +# ARMCC Toolchain +set(_compiler_id_pp_test "defined(__ARMCC_VERSION)") + +set(_compiler_id_version_compute " +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/1000000) + # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 100) + # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ARMCC_VERSION/100000) + # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ARMCC_VERSION/10000 % 10) + # define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ARMCC_VERSION % 10000) +#endif +") diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake new file mode 100644 index 0000000..3cf628c --- /dev/null +++ b/Modules/Compiler/ARMCC.cmake @@ -0,0 +1,36 @@ +if(_ARMCC_CMAKE_LOADED) + return() +endif() +set(_ARMCC_CMAKE_LOADED TRUE) + +# See ARM Compiler documentation at: +# http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html + +get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) +get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) + +set(CMAKE_EXECUTABLE_SUFFIX ".elf") + +find_program(CMAKE_ARMCC_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" ) +find_program(CMAKE_ARMCC_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" ) + +set(CMAKE_LINKER "${CMAKE_ARMCC_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE) +mark_as_advanced(CMAKE_ARMCC_LINKER) +set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE) +mark_as_advanced(CMAKE_ARMCC_AR) + +macro(__compiler_armcc lang) + set(CMAKE_${lang}_FLAGS_INIT "") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-Otime -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g") + + set(CMAKE_${lang}_OUTPUT_EXTENSION ".o") + set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1) + + set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map") + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>") + + set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers") +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-C.cmake b/Modules/Compiler/CrayPrgEnv-C.cmake new file mode 100644 index 0000000..6b461ce --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-C.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_c) + return() +endif() +set(__craylinux_crayprgenv_c 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_C compiler_cmd link_cmd) + __CrayPrgEnv_setup(C + ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-CXX.cmake b/Modules/Compiler/CrayPrgEnv-CXX.cmake new file mode 100644 index 0000000..aad85b6 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-CXX.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_cxx) + return() +endif() +set(__craylinux_crayprgenv_cxx 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_CXX compiler_cmd link_cmd) + __CrayPrgEnv_setup(CXX + ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake new file mode 100644 index 0000000..547a4b4 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_c) + return() +endif() +set(__craylinux_crayprgenv_cray_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake new file mode 100644 index 0000000..df8452c --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_cxx) + return() +endif() +set(__craylinux_crayprgenv_cray_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake new file mode 100644 index 0000000..9f46a04 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_fortran) + return() +endif() +set(__craylinux_crayprgenv_cray_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/cray/cce/.*/ftnfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Fortran.cmake new file mode 100644 index 0000000..9c4d269 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Fortran.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_fortran) + return() +endif() +set(__craylinux_crayprgenv_fortran 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_Fortran compiler_cmd link_cmd) + __CrayPrgEnv_setup(Fortran + ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake new file mode 100644 index 0000000..248081b --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_c) + return() +endif() +set(__craylinux_crayprgenv_gnu_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/gcc/.*/cc1" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake new file mode 100644 index 0000000..be4eb6d --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_cxx) + return() +endif() +set(__craylinux_crayprgenv_gnu_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/gcc/.*/cc1plus" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake new file mode 100644 index 0000000..8bd23ff --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_fortran) + return() +endif() +set(__craylinux_crayprgenv_gnu_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/gcc/.*/f951" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake new file mode 100644 index 0000000..83c4e38 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_c) + return() +endif() +set(__craylinux_crayprgenv_intel_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake new file mode 100644 index 0000000..3c3c3e6 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_cxx) + return() +endif() +set(__craylinux_crayprgenv_intel_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake new file mode 100644 index 0000000..08a316d --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_fortran) + return() +endif() +set(__craylinux_crayprgenv_intel_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/intel/.*/fortcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake new file mode 100644 index 0000000..f45767c --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_c) + return() +endif() +set(__craylinux_crayprgenv_pgi_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/pgi/[^ ]*/pgc" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake new file mode 100644 index 0000000..a2a286f --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_cxx) + return() +endif() +set(__craylinux_crayprgenv_pgi_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/pgi/[^ ]*/pgcpp" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake new file mode 100644 index 0000000..f6ba7c0 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_fortran) + return() +endif() +set(__craylinux_crayprgenv_pgi_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/pgi/[^ ]*/pgf" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake new file mode 100644 index 0000000..61daa0f --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -0,0 +1,88 @@ +# Guard against multiple inclusions +if(__craylinux_crayprgenv) + return() +endif() +set(__craylinux_crayprgenv 1) + +macro(__cray_extract_args cmd tag_regex out_var make_absolute) + string(REGEX MATCHALL "${tag_regex}" args "${cmd}") + foreach(arg IN LISTS args) + string(REGEX REPLACE "^${tag_regex}$" "\\2" param "${arg}") + if(make_absolute) + get_filename_component(param "${param}" ABSOLUTE) + endif() + list(APPEND ${out_var} ${param}) + endforeach() +endmacro() + +function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var link_dirs_var link_libs_var) + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_VERBOSE_FLAG} -o cray_extract_implicit_${lang} ${src} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error + ) + set(include_dirs) + set(link_dirs) + set(link_libs) + string(REGEX REPLACE "\r?\n" ";" output_lines "${output}\n${error}") + foreach(line IN LISTS output_lines) + if("${line}" MATCHES "${compiler_cmd}") + __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs 1) + set(processed_include 1) + endif() + if("${line}" MATCHES "${link_cmd}") + __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs 1) + __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs 0) + set(processed_link 1) + endif() + if(processed_include AND processed_link) + break() + endif() + endforeach() + + set(${include_dirs_var} "${include_dirs}" PARENT_SCOPE) + set(${link_dirs_var} "${link_dirs}" PARENT_SCOPE) + set(${link_libs_var} "${link_libs}" PARENT_SCOPE) + set(CRAY_${lang}_EXTRACTED_IMPLICIT 1 CACHE INTERNAL "" FORCE) +endfunction() + +macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) + if(DEFINED ENV{CRAYPE_VERSION}) + message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}") + elseif(DEFINED ENV{ASYNCPE_VERSION}) + message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}") + endif() + + # Flags for the Cray wrappers + set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic") + + # If the link type is not explicitly specified in the environment then + # the Cray wrappers assume that the code will be built staticly so + # we check the following condition(s) are NOT met + # Compiler flags are explicitly dynamic + # Env var is dynamic and compiler flags are not explicitly static + if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) + OR + (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND + NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_LINK_SEARCH_START_STATIC TRUE) + endif() + if(NOT CRAY_${lang}_EXTRACTED_IMPLICIT) + __cray_extract_implicit( + ${test_src} ${compiler_cmd} ${link_cmd} ${lang} + CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES + CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES + CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES + ) + endif() +endmacro() diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index 2feedac..8375624 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__ set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)") +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__ & 0xFFFF)") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 33e6a49..edfed8e 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -54,6 +54,33 @@ # Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant # Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant # +# The following :prop_tgt:`IMPORTED` targets are also defined:: +# +# Boost::boost - Target for header-only dependencies +# (Boost include directory) +# Boost::<C> - Target for specific component dependency +# (shared or static library); <C> is lower- +# case +# Boost::diagnostic_definitions - interface target to enable diagnostic +# information about Boost's automatic linking +# during compilation (adds BOOST_LIB_DIAGNOSTIC) +# Boost::disable_autolinking - interface target to disable automatic +# linking with MSVC (adds BOOST_ALL_NO_LIB) +# Boost::dynamic_linking - interface target to enable dynamic linking +# linking with MSVC (adds BOOST_ALL_DYN_LINK) +# +# Implicit dependencies such as Boost::filesystem requiring +# Boost::system will be automatically detected and satisfied, even +# if system is not specified when using find_package and if +# Boost::system is not added to target_link_libraries. If using +# Boost::thread, then Thread::Thread will also be added automatically. +# +# It is important to note that the imported targets behave differently +# than variables created by this module: multiple calls to +# find_package(Boost) in the same directory or sub-directories with +# different options (e.g. static or shared) will not override the +# values of the targets created by the first call. +# # Users may set these hints or results as cache entries. Projects # should not read these entries directly but instead use the above # result variables. Note that some hint names start in upper-case @@ -142,6 +169,14 @@ # add_executable(foo foo.cc) # endif() # +# Example to find Boost libraries and use imported targets:: +# +# find_package(Boost 1.56 REQUIRED COMPONENTS +# date_time filesystem iostreams) +# add_executable(foo foo.cc) +# target_link_libraries(foo Boost::date_time Boost::filesystem +# Boost::iostreams) +# # Example to find Boost headers and some *static* libraries:: # # set(Boost_USE_STATIC_LIBS ON) # only find static libs @@ -472,6 +507,276 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) endfunction() # +# Get component dependencies. Requires the dependencies to have been +# defined for the Boost release version. +# +# component - the component to check +# _ret - list of library dependencies +# +function(_Boost_COMPONENT_DEPENDENCIES component _ret) + # Note: to add a new Boost release, run + # + # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake + # + # The output may be added in a new block below. If it's the same as + # the previous release, simply update the version range of the block + # for the previous release. + # + # This information was originally generated by running + # BoostScanDeps.cmake against every boost release to date supported + # by FindBoost: + # + # % for version in /path/to/boost/sources/* + # do + # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake + # done + # + # The output was then updated by search and replace with these regexes: + # + # - Strip message(STATUS) prefix dashes + # s;^-- ;; + # - Indent + # s;^set(; set(;; + # - Add conditionals + # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx); + # + # This results in the logic seen below, but will require the xxxx + # replacing with the following Boost release version (or the next + # minor version to be released, e.g. 1.59 was the latest at the time + # of writing, making 1.60 the next, so 106000 is the needed version + # number). Identical consecutive releases were then merged together + # by updating the end range of the first block and removing the + # following redundant blocks. + # + # Running the script against all historical releases should be + # required only if the BoostScanDeps.cmake script logic is changed. + # The addition of a new release should only require it to be run + # against the new release. + set(_Boost_IMPORTED_TARGETS TRUE) + if(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500) + set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) + set(_Boost_REGEX_DEPENDENCIES thread) + set(_Boost_WAVE_DEPENDENCIES filesystem thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + else() + message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}") + set(_Boost_IMPORTED_TARGETS FALSE) + endif() + + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + + string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") + if (NOT _boost_DEPS_STRING) + set(_boost_DEPS_STRING "(none)") + endif() + # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") +endfunction() + +# +# Determine if any missing dependencies require adding to the component list. +# +# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, +# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be +# defined; FALSE if dependency information is unavailable). +# +# componentvar - the component list variable name +# +# +function(_Boost_MISSING_DEPENDENCIES componentvar) + # _boost_unprocessed_components - list of components requiring processing + # _boost_processed_components - components already processed (or currently being processed) + # _boost_new_components - new components discovered for future processing + # + list(APPEND _boost_unprocessed_components ${${componentvar}}) + + while(_boost_unprocessed_components) + list(APPEND _boost_processed_components ${_boost_unprocessed_components}) + foreach(component ${_boost_unprocessed_components}) + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) + set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) + list(FIND _boost_processed_components "${componentdep}" _boost_component_found) + list(FIND _boost_new_components "${componentdep}" _boost_component_new) + if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1) + list(APPEND _boost_new_components ${componentdep}) + endif() + endforeach() + endforeach() + set(_boost_unprocessed_components ${_boost_new_components}) + unset(_boost_new_components) + endwhile() + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) +endfunction() + +# # End functions/macros # #------------------------------------------------------------------------------- @@ -511,8 +816,12 @@ if(Boost_FIND_VERSION_EXACT) else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. + # + # Note: When adding a new Boost release, also update the dependency + # information in _Boost_COMPONENT_DEPENDENCIES. See the + # instructions at the top of _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - + "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" @@ -562,6 +871,16 @@ if(Boost_DEBUG) "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") endif() +# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It +# will only contain any interface definitions on WIN32, but is created +# on all platforms to keep end user code free from platform dependent +# code. Also provide convenience targets to disable autolinking and +# enable dynamic linking. +if(NOT TARGET Boost::diagnostic_definitions) + add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) + add_library(Boost::disable_autolinking INTERFACE IMPORTED) + add_library(Boost::dynamic_linking INTERFACE IMPORTED) +endif() if(WIN32) # In windows, automatic linking is performed, so you do not have # to specify the libraries. If you are linking to a dynamic @@ -581,6 +900,12 @@ if(WIN32) # code to emit a #pragma message each time a library is selected # for linking. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::diagnostic_definitions PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::disable_autolinking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") + set_target_properties(Boost::dynamic_linking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") endif() _Boost_CHECK_SPELLING(Boost_ROOT) @@ -979,6 +1304,17 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS) endif() endif() +# Additional components may be required via component dependencies. +# Add any missing components to the list. +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) + +# If thread is required, get the thread libs as a dependency +list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) +if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) + include(CMakeFindDependencyMacro) + find_dependency(Threads) +endif() + # If the user changed any of our control inputs flush previous results. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) @@ -1222,6 +1558,70 @@ else() endif() # ------------------------------------------------------------------------ +# Add imported targets +# ------------------------------------------------------------------------ + +if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) + # For header-only libraries + if(NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + endif() + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + if(NOT TARGET Boost::${COMPONENT}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + if(Boost_${UPPERCOMPONENT}_FOUND) + if(Boost_USE_STATIC_LIBS) + add_library(Boost::${COMPONENT} STATIC IMPORTED) + else() + # Even if Boost_USE_STATIC_LIBS is OFF, we might have static + # libraries as a result. + add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) + endif() + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + endif() + if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) + unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) + foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) + endforeach() + if(COMPONENT STREQUAL "thread") + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) + endif() + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") + endif() + endif() + endif() + endforeach() +endif() + +# ------------------------------------------------------------------------ # Notification to end user about what was found # ------------------------------------------------------------------------ diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 1fc582f..ada5b8a 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -653,6 +653,9 @@ set(CUDA_VERSION_STRING "${CUDA_VERSION}") # Support for arm cross compilation with CUDA 5.5 if(CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf") set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" CACHE PATH "Toolkit target location.") +# Support for aarch64 cross compilation with CUDA 7.0 +elseif(CUDA_VERSION VERSION_GREATER "6.5" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux") + set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux" CACHE PATH "Toolkit target location.") else() set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}" CACHE PATH "Toolkit target location.") endif() @@ -764,13 +767,9 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME) if (NOT APPLE) # Here is librt that has things such as, clock_gettime, shm_open, and shm_unlink. find_library(CUDA_rt_LIBRARY rt) - find_library(CUDA_dl_LIBRARY dl) if (NOT CUDA_rt_LIBRARY) message(WARNING "Expecting to find librt for libcudart_static, but didn't find it.") endif() - if (NOT CUDA_dl_LIBRARY) - message(WARNING "Expecting to find libdl for libcudart_static, but didn't find it.") - endif() endif() endif() endif() @@ -793,13 +792,10 @@ set(CUDA_LIBRARIES) if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) list(APPEND CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY}) elseif(CUDA_USE_STATIC_CUDA_RUNTIME AND CUDA_cudart_static_LIBRARY) - list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND CUDA_LIBRARIES ${CUDA_cudart_static_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) if (CUDA_rt_LIBRARY) list(APPEND CUDA_LIBRARIES ${CUDA_rt_LIBRARY}) endif() - if (CUDA_dl_LIBRARY) - list(APPEND CUDA_LIBRARIES ${CUDA_dl_LIBRARY}) - endif() if(APPLE) # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that # the static cuda runtime can find it at runtime. diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index c837c52..ca66493 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -27,13 +27,17 @@ # # :: # -# FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>]) +# FLEX_TARGET(Name FlexInput FlexOutput +# [COMPILE_FLAGS <string>] +# [DEFINES_FILE <string>] +# ) # # which creates a custom command to generate the <FlexOutput> file from # the <FlexInput> file. If COMPILE_FLAGS option is specified, the next -# parameter is added to the flex command line. Name is an alias used to -# get details of this custom command. Indeed the macro defines the -# following variables: +# parameter is added to the flex command line. If flex is configured to +# output a header file, the DEFINES_FILE option may be used to specify its +# name. Name is an alias used to get details of this custom command. +# Indeed the macro defines the following variables: # # :: # @@ -41,6 +45,7 @@ # FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an # alias for FlexOutput # FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput} +# FLEX_${Name}_OUTPUT_HEADER - the header flex output, if any. # # # @@ -113,6 +118,8 @@ find_path(FLEX_INCLUDE_DIR FlexLexer.h mark_as_advanced(FL_LIBRARY FLEX_INCLUDE_DIR) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) + set(FLEX_INCLUDE_DIRS ${FLEX_INCLUDE_DIR}) set(FLEX_LIBRARIES ${FL_LIBRARY}) @@ -145,31 +152,55 @@ if(FLEX_EXECUTABLE) #============================================================ # macro(FLEX_TARGET Name Input Output) - set(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]") - if(${ARGC} GREATER 3) - if(${ARGC} EQUAL 5) - if("${ARGV3}" STREQUAL "COMPILE_FLAGS") - set(FLEX_EXECUTABLE_opts "${ARGV4}") - separate_arguments(FLEX_EXECUTABLE_opts) - else() - message(SEND_ERROR ${FLEX_TARGET_usage}) - endif() + set(FLEX_TARGET_outputs "${Output}") + set(FLEX_EXECUTABLE_opts "") + + set(FLEX_TARGET_PARAM_OPTIONS) + set(FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS + COMPILE_FLAGS + DEFINES_FILE + ) + set(FLEX_TARGET_PARAM_MULTI_VALUE_KEYWORDS) + + cmake_parse_arguments( + FLEX_TARGET_ARG + "${FLEX_TARGET_PARAM_OPTIONS}" + "${FLEX_TARGET_PARAM_ONE_VALUE_KEYWORDS}" + "${FLEX_TARGET_MULTI_VALUE_KEYWORDS}" + ${ARGN} + ) + + set(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>] [DEFINES_FILE <string>]") + + if(NOT "${FLEX_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "") + message(SEND_ERROR ${FLEX_TARGET_usage}) + else() + if(NOT "${FLEX_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "") + set(FLEX_EXECUTABLE_opts "${FLEX_TARGET_ARG_COMPILE_FLAGS}") + separate_arguments(FLEX_EXECUTABLE_opts) + endif() + if(NOT "${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + list(APPEND FLEX_TARGET_outputs "${FLEX_TARGET_ARG_DEFINES_FILE}") + list(APPEND FLEX_EXECUTABLE_opts --header-file=${FLEX_TARGET_ARG_DEFINES_FILE}) + endif() + + add_custom_command(OUTPUT ${FLEX_TARGET_outputs} + COMMAND ${FLEX_EXECUTABLE} + ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} + DEPENDS ${Input} + COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + set(FLEX_${Name}_DEFINED TRUE) + set(FLEX_${Name}_OUTPUTS ${Output}) + set(FLEX_${Name}_INPUT ${Input}) + set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) + if("${FLEX_TARGET_ARG_DEFINES_FILE}" STREQUAL "") + set(FLEX_${Name}_OUTPUT_HEADER "") else() - message(SEND_ERROR ${FLEX_TARGET_usage}) + set(FLEX_${Name}_OUTPUT_HEADER ${FLEX_TARGET_ARG_DEFINES_FILE}) endif() endif() - - add_custom_command(OUTPUT ${Output} - COMMAND ${FLEX_EXECUTABLE} - ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} - DEPENDS ${Input} - COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - - set(FLEX_${Name}_DEFINED TRUE) - set(FLEX_${Name}_OUTPUTS ${Output}) - set(FLEX_${Name}_INPUT ${Input}) - set(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts}) endmacro() #============================================================ @@ -181,11 +212,11 @@ if(FLEX_EXECUTABLE) macro(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget) if(NOT FLEX_${FlexTarget}_OUTPUTS) - message(SEND_ERROR "Flex target `${FlexTarget}' does not exists.") + message(SEND_ERROR "Flex target `${FlexTarget}' does not exist.") endif() if(NOT BISON_${BisonTarget}_OUTPUT_HEADER) - message(SEND_ERROR "Bison target `${BisonTarget}' does not exists.") + message(SEND_ERROR "Bison target `${BisonTarget}' does not exist.") endif() set_source_files_properties(${FLEX_${FlexTarget}_OUTPUTS} diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 72bb8eb..6e4a7f2 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -34,6 +34,7 @@ # GTK2_FOUND - Were all of your specified components found? # GTK2_INCLUDE_DIRS - All include directories # GTK2_LIBRARIES - All libraries +# GTK2_TARGETS - All imported targets # GTK2_DEFINITIONS - Additional compiler flags # # @@ -202,6 +203,43 @@ function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) endif() endfunction() + +#============================================================= +# _GTK2_SIGCXX_GET_VERSION +# Internal function to parse the version number in +# sigc++config.h +# _OUT_major = Major version number +# _OUT_minor = Minor version number +# _OUT_micro = Micro version number +# _sigcxxversion_hdr = Header file to parse +#============================================================= + +function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversion_hdr) + file(STRINGS ${_sigcxxversion_hdr} _contents REGEX "#define SIGCXX_M[A-Z]+_VERSION[ \t]+") + if(_contents) + string(REGEX REPLACE ".*#define SIGCXX_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_major} "${_contents}") + string(REGEX REPLACE ".*#define SIGCXX_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_minor} "${_contents}") + string(REGEX REPLACE ".*#define SIGCXX_MICRO_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_micro} "${_contents}") + + if(NOT ${_OUT_major} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MAJOR_VERSION!") + endif() + if(NOT ${_OUT_minor} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MINOR_VERSION!") + endif() + if(NOT ${_OUT_micro} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MICRO_VERSION!") + endif() + + set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE) + set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE) + set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist") + endif() +endfunction() + + #============================================================= # _GTK2_FIND_INCLUDE_DIR # Internal function to find the GTK include directories @@ -513,6 +551,9 @@ function(_GTK2_ADD_TARGET _var) add_library(GTK2::${_basename} UNKNOWN IMPORTED) + set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) + set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) + if(GTK2_${_var}_LIBRARY_RELEASE) set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) @@ -565,6 +606,7 @@ endfunction() set(GTK2_FOUND) set(GTK2_INCLUDE_DIRS) set(GTK2_LIBRARIES) +set(GTK2_TARGETS) set(GTK2_DEFINITIONS) if(NOT GTK2_FIND_COMPONENTS) @@ -734,6 +776,27 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) _GTK2_FIND_LIBRARY (SIGC++ sigc true true) _GTK2_ADD_TARGET (SIGC++) + # Since sigc++ 2.5.1 c++11 support is required + if(GTK2_SIGC++CONFIG_INCLUDE_DIR) + _GTK2_SIGCXX_GET_VERSION(GTK2_SIGC++_VERSION_MAJOR + GTK2_SIGC++_VERSION_MINOR + GTK2_SIGC++_VERSION_MICRO + ${GTK2_SIGC++CONFIG_INCLUDE_DIR}/sigc++config.h) + if(NOT ${GTK2_SIGC++_VERSION_MAJOR}.${GTK2_SIGC++_VERSION_MINOR}.${GTK2_SIGC++_VERSION_MICRO} VERSION_LESS 2.5.1) + # These are the features needed by clients in order to include the + # project headers: + set_property(TARGET GTK2::sigc++ + PROPERTY INTERFACE_COMPILE_FEATURES cxx_alias_templates + cxx_auto_type + cxx_decltype + cxx_deleted_functions + cxx_noexcept + cxx_nullptr + cxx_right_angle_brackets + cxx_rvalue_references + cxx_variadic_templates) + endif() + endif() _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h) _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) @@ -882,6 +945,11 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) endif() endforeach() +if(GTK2_USE_IMPORTED_TARGETS) + set(GTK2_LIBRARIES ${GTK2_TARGETS}) +endif() + + if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED) set(GTK2_FOUND true) else() @@ -893,6 +961,7 @@ else() set(GTK2_VERSION_PATCH) set(GTK2_INCLUDE_DIRS) set(GTK2_LIBRARIES) + set(GTK2_TARGETS) set(GTK2_DEFINITIONS) endif() diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index eb7abfd..ca49e4a 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -4,88 +4,89 @@ # # Locate the Google C++ Testing Framework. # -# Defines the following variables: +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# :: -# -# GTEST_FOUND - Found the Google Testing framework -# GTEST_INCLUDE_DIRS - Include directories +# This module defines the following :prop_tgt:`IMPORTED` targets: # +# ``GTest::GTest`` +# The Google Test ``gtest`` library, if found; adds Thread::Thread +# automatically +# ``GTest::Main`` +# The Google Test ``gtest_main`` library, if found # # -# Also defines the library variables below as normal variables. These -# contain debug/optimized keywords when a debugging library is found. -# -# :: +# Result variables +# ^^^^^^^^^^^^^^^^ # -# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main -# GTEST_LIBRARIES - libgtest -# GTEST_MAIN_LIBRARIES - libgtest-main +# This module will set the following variables in your project: # +# ``GTEST_FOUND`` +# Found the Google Testing framework +# ``GTEST_INCLUDE_DIRS`` +# the directory containing the Google Test headers # +# The library variables below are set as normal variables. These +# contain debug/optimized keywords when a debugging library is found. # -# Accepts the following variables as input: -# -# :: -# -# GTEST_ROOT - (as a CMake or environment variable) -# The root directory of the gtest install prefix -# -# +# ``GTEST_LIBRARIES`` +# The Google Test ``gtest`` library; note it also requires linking +# with an appropriate thread library +# ``GTEST_MAIN_LIBRARIES`` +# The Google Test ``gtest_main`` library +# ``GTEST_BOTH_LIBRARIES`` +# Both ``gtest`` and ``gtest_main`` # -# :: +# Cache variables +# ^^^^^^^^^^^^^^^ # -# 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") +# The following cache variables may also be set: # +# ``GTEST_ROOT`` +# The root directory of the Google Test installation (may also be +# set as an environment variable) +# ``GTEST_MSVC_SEARCH`` +# If compiling with MSVC, this variable can be set to ``MD`` or +# ``MT`` (the default) to enable searching a GTest build tree # # -# Example Usage: +# Example usage +# ^^^^^^^^^^^^^ # # :: # # enable_testing() # find_package(GTest REQUIRED) -# include_directories(${GTEST_INCLUDE_DIRS}) -# -# -# -# :: # # add_executable(foo foo.cc) -# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES}) -# -# -# -# :: +# target_link_libraries(foo GTest::GTest GTest::Main) # # add_test(AllTestsInFoo foo) # # -# -# +# Deeper integration with CTest +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # 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 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) -# -# :: +# may use the following macro:: # -# executable = The path to the test executable -# extra_args = Pass a list of extra arguments to be passed to -# executable enclosed in quotes (or "" for none) -# ARGN = A list of source files to search for tests & test -# fixtures. Or AUTO to find them from executable target. +# GTEST_ADD_TESTS(executable extra_args files...) # +# ``executable`` +# the path to the test executable +# ``extra_args`` +# a list of extra arguments to be passed to executable enclosed in +# quotes (or ``""`` for none) +# ``files...`` +# a list of source files to search for tests and test fixtures. Or +# ``AUTO`` to find them from executable target # +# However, note that this macro will slow down your tests by running +# an executable for each test and test fixture. You will also have to +# re-run CMake after adding or removing tests or test fixtures. # -# :: +# Example usage:: # -# Example: # set(FooTestArgs --foo 1 --bar 2) # add_executable(FooTest FooUnitTest.cc) # GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO) @@ -208,5 +209,60 @@ if(GTEST_FOUND) _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) -endif() + include(CMakeFindDependencyMacro) + find_dependency(Threads) + + if(NOT TARGET GTest::GTest) + add_library(GTest::GTest UNKNOWN IMPORTED) + set_target_properties(GTest::GTest PROPERTIES + INTERFACE_LINK_LIBRARIES "Threads::Threads") + if(GTEST_INCLUDE_DIRS) + set_target_properties(GTest::GTest PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}") + endif() + if(EXISTS "${GTEST_LIBRARY}") + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GTEST_LIBRARY}") + endif() + if(EXISTS "${GTEST_LIBRARY_DEBUG}") + set_property(TARGET GTest::GTest APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}") + endif() + if(EXISTS "${GTEST_LIBRARY_RELEASE}") + set_property(TARGET GTest::GTest APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}") + endif() + endif() + if(NOT TARGET GTest::Main) + add_library(GTest::Main UNKNOWN IMPORTED) + set_target_properties(GTest::Main PROPERTIES + INTERFACE_LINK_LIBRARIES "GTest::GTest") + if(EXISTS "${GTEST_MAIN_LIBRARY}") + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}") + endif() + if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}") + set_property(TARGET GTest::Main APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}") + endif() + if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}") + set_property(TARGET GTest::Main APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}") + endif() + endif() +endif() diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index b4f7b4b..2c3e5fd 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -48,17 +48,21 @@ if(WIN32) # GitHub search path for Windows set(github_path "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin") file(GLOB github_path "${github_path}") + # SourceTree search path for Windows + set(_git_sourcetree_path "$ENV{LOCALAPPDATA}/Atlassian/SourceTree/git_local/bin") endif() endif() find_program(GIT_EXECUTABLE NAMES ${git_names} - PATHS ${github_path} + PATHS ${github_path} ${_git_sourcetree_path} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client" ) mark_as_advanced(GIT_EXECUTABLE) +unset(_git_sourcetree_path) + if(GIT_EXECUTABLE) execute_process(COMMAND ${GIT_EXECUTABLE} --version OUTPUT_VARIABLE git_version diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index cbe21d7..135038c 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -63,7 +63,7 @@ macro(java_append_library_directories _var) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") set(_java_libarch "ppc64" "ppc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - set(_java_libarch "ppc") + set(_java_libarch "ppc" "ppc64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") # Both flavours can run on the same processor set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") @@ -271,7 +271,8 @@ find_path(JAVA_INCLUDE_PATH jni.h ${JAVA_AWT_INCLUDE_DIRECTORIES} ) -find_path(JAVA_INCLUDE_PATH2 jni_md.h +find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h + PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/darwin ${JAVA_INCLUDE_PATH}/win32 @@ -281,6 +282,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h ${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/alpha + ${JAVA_INCLUDE_PATH}/aix ) find_path(JAVA_AWT_INCLUDE_PATH jawt.h diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9f87997..cc67df6 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -228,12 +228,12 @@ if(Java_FIND_COMPONENTS) endif() elseif(component STREQUAL "IdlJ") list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE) - if(Java_IdlJ_EXECUTABLE) - set(Java_Extra_FOUND TRUE) + if(Java_IDLJ_EXECUTABLE) + set(Java_IdlJ_FOUND TRUE) endif() elseif(component STREQUAL "JarSigner") list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE) - if(Java_IDLJ_EXECUTABLE) + if(Java_JARSIGNER_EXECUTABLE) set(Java_JarSigner_FOUND TRUE) endif() else() diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 8150ff2..eb63cef 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -79,11 +79,17 @@ find_path(OPENAL_INCLUDE_DIR al.h [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_OpenAL_ARCH_DIR libs/Win64) +else() + set(_OpenAL_ARCH_DIR libs/Win32) +endif() + find_library(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 HINTS ENV OPENALDIR - PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 + PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR} PATHS ~/Library/Frameworks /Library/Frameworks @@ -94,6 +100,7 @@ find_library(OPENAL_LIBRARY [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) +unset(_OpenAL_ARCH_DIR) # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index a7eefa7..93e488b 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -71,9 +71,11 @@ elseif (WIN32) elseif (APPLE) - find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") - find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") - find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + # The OpenGL.framework provides both gl and glu + find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X") + find_library(OPENGL_glu_LIBRARY OpenGL DOC + "GLU library for OS X (usually same as OpenGL library)") + find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X") list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) else() @@ -149,7 +151,9 @@ if(OPENGL_gl_LIBRARY) set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) if(OPENGL_glu_LIBRARY) set( OPENGL_GLU_FOUND "YES" ) - set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}") + set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + endif() else() set( OPENGL_GLU_FOUND "NO" ) endif() diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index a102c66..ee4bdd6 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -50,6 +50,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG) " " #GNU "-fopenmp" + #Clang + "-fopenmp=libomp" #Microsoft Visual Studio "/openmp" #Intel windows @@ -67,6 +69,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG) ) set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_Clang "-fopenmp=libomp") set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index d75e8ab..8b4b988 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -37,6 +37,7 @@ # # Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. # Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries. +# Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -113,7 +114,7 @@ if(WIN32 AND NOT CYGWIN) # /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 + # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL) # 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 @@ -126,6 +127,12 @@ if(WIN32 AND NOT CYGWIN) # ssleay32MD.lib is identical to ../ssleay32.lib # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static + if (OPENSSL_MSVC_STATIC_RT) + set(_OPENSSL_MSVC_RT_MODE "MT") + else () + set(_OPENSSL_MSVC_RT_MODE "MD") + endif () + if(OPENSSL_USE_STATIC_LIBS) set(_OPENSSL_PATH_SUFFIXES "lib" @@ -142,7 +149,7 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_DEBUG NAMES - libeay32MDd + libeay32${_OPENSSL_MSVC_RT_MODE}d libeay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -151,7 +158,7 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY_RELEASE NAMES - libeay32MD + libeay32${_OPENSSL_MSVC_RT_MODE} libeay32 ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -160,7 +167,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_DEBUG NAMES - ssleay32MDd + ssleay32${_OPENSSL_MSVC_RT_MODE}d ssleay32d ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES @@ -169,7 +176,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY_RELEASE NAMES - ssleay32MD + ssleay32${_OPENSSL_MSVC_RT_MODE} ssleay32 ssl ${_OPENSSL_ROOT_HINTS_AND_PATHS} @@ -193,12 +200,8 @@ if(WIN32 AND NOT CYGWIN) set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW - set(LIB_EAY_NAMES libeay32) - set(SSL_EAY_NAMES ssleay32) - if(CMAKE_CROSSCOMPILING) - list(APPEND LIB_EAY_NAMES crypto) - list(APPEND SSL_EAY_NAMES ssl) - endif() + set(LIB_EAY_NAMES crypto libeay32) + set(SSL_EAY_NAMES ssl ssleay32) find_library(LIB_EAY NAMES ${LIB_EAY_NAMES} @@ -318,7 +321,7 @@ endfunction() if (OPENSSL_INCLUDE_DIR) if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str - REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") # The version number is encoded as 0xMNNFFPPS: major minor fix patch status # The status gives if this is a developer or prerelease and is ignored here. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index e822b9c..d519c1d 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -328,7 +328,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if (_pkg_check_modules_pkg_op) list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") else() - list(APPEND _pkg_check_modules_exist_query --exists) + list(APPEND _pkg_check_modules_exist_query --exists --print-errors --short-errors) endif() _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) @@ -342,12 +342,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma # execute the query execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query} - RESULT_VARIABLE _pkgconfig_retval) + RESULT_VARIABLE _pkgconfig_retval + ERROR_VARIABLE _pkgconfig_error + ERROR_STRIP_TRAILING_WHITESPACE) # evaluate result and tell failures if (_pkgconfig_retval) if(NOT ${_is_silent}) - message(STATUS " Package '${_pkg_check_modules_pkg}' not found") + message(STATUS " ${_pkgconfig_error}") endif() set(_pkg_check_modules_failed 1) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 4a68cd1..2f13b09 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -305,7 +305,7 @@ mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf DEFAULT_MSG PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) if(PROTOBUF_FOUND) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index ed092ea..e600498 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -2,24 +2,43 @@ # FindTIFF # -------- # -# Find TIFF library +# Find the TIFF library (libtiff). # -# Find the native TIFF includes and library This module defines +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# TIFF_INCLUDE_DIR, where to find tiff.h, etc. -# TIFF_LIBRARIES, libraries to link against to use TIFF. -# TIFF_FOUND, If false, do not try to use TIFF. +# ``TIFF::TIFF`` +# The TIFF library, if found. # -# also defined, but not for general use are +# Result variables +# ^^^^^^^^^^^^^^^^ # -# :: +# This module will set the following variables in your project: # -# TIFF_LIBRARY, where to find the TIFF library. +# ``TIFF_FOUND`` +# true if the TIFF headers and libraries were found +# ``TIFF_INCLUDE_DIR`` +# the directory containing the TIFF headers +# ``TIFF_INCLUDE_DIRS`` +# the directory containing the TIFF headers +# ``TIFF_LIBRARIES`` +# TIFF libraries to be linked +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``TIFF_INCLUDE_DIR`` +# the directory containing the TIFF headers +# ``TIFF_LIBRARY`` +# the path to the TIFF library #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -65,7 +84,35 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF VERSION_VAR TIFF_VERSION_STRING) if(TIFF_FOUND) - set( TIFF_LIBRARIES ${TIFF_LIBRARY} ) + set(TIFF_LIBRARIES ${TIFF_LIBRARY}) + set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}") + + if(NOT TARGET TIFF::TIFF) + add_library(TIFF::TIFF UNKNOWN IMPORTED) + if(TIFF_INCLUDE_DIRS) + set_target_properties(TIFF::TIFF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}") + endif() + if(EXISTS "${TIFF_LIBRARY}") + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${TIFF_LIBRARY}") + endif() + if(EXISTS "${TIFF_LIBRARY_DEBUG}") + set_property(TARGET TIFF::TIFF APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}") + endif() + if(EXISTS "${TIFF_LIBRARY_RELEASE}") + set_property(TARGET TIFF::TIFF APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}") + endif() + endif() endif() mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY) diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index cf84826..a4b80e5 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -4,23 +4,42 @@ # # Find the Apache Xerces-C++ validating XML parser headers and libraries. # -# This module reports information about the Xerces installation in -# several variables. General variables:: +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# XercesC_FOUND - true if the Xerces headers and libraries were found -# XercesC_VERSION - Xerces release version -# XercesC_INCLUDE_DIRS - the directory containing the Xerces headers -# XercesC_LIBRARIES - Xerces libraries to be linked +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# The following cache variables may also be set:: +# ``XercesC::XercesC`` +# The Xerces-C++ ``xerces-c`` library, if found. # -# XercesC_INCLUDE_DIR - the directory containing the Xerces headers -# XercesC_LIBRARY - the Xerces library +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ``XercesC_FOUND`` +# true if the Xerces headers and libraries were found +# ``XercesC_VERSION`` +# Xerces release version +# ``XercesC_INCLUDE_DIRS`` +# the directory containing the Xerces headers +# ``XercesC_LIBRARIES`` +# Xerces libraries to be linked +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``XercesC_INCLUDE_DIR`` +# the directory containing the Xerces headers +# ``XercesC_LIBRARY`` +# the Xerces library # Written by Roger Leigh <rleigh@codelibre.net> #============================================================================= -# Copyright 2014 University of Dundee +# Copyright 2014-2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -90,4 +109,32 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC if(XercesC_FOUND) set(XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}") set(XercesC_LIBRARIES "${XercesC_LIBRARY}") + + # For header-only libraries + if(NOT TARGET XercesC::XercesC) + add_library(XercesC::XercesC UNKNOWN IMPORTED) + if(XercesC_INCLUDE_DIRS) + set_target_properties(XercesC::XercesC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${XercesC_INCLUDE_DIRS}") + endif() + if(EXISTS "${XercesC_LIBRARY}") + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${XercesC_LIBRARY}") + endif() + if(EXISTS "${XercesC_LIBRARY_DEBUG}") + set_property(TARGET XercesC::XercesC APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}") + endif() + if(EXISTS "${XercesC_LIBRARY_RELEASE}") + set_property(TARGET XercesC::XercesC APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(XercesC::XercesC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}") + endif() + endif() endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 8205425..4f4efbc 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -230,7 +230,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) + # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated) + # without error, but this is not a documented feature and the attribute does + # not actually generate any warnings. if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero OR CMAKE_CXX_COMPILER_ID MATCHES HP OR GCC_TOO_OLD OR CMAKE_CXX_COMPILER_ID MATCHES PGI diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 76310af..1ef3d28 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -542,6 +542,8 @@ FunctionEnd ; Define some macro setting for the gui @CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ @CPACK_NSIS_INSTALLER_ICON_CODE@ +@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@ +@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@ @CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ @CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index e5d9434..d6f5331 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -18,10 +18,20 @@ if(__AIX_COMPILER_GNU) endif() set(__AIX_COMPILER_GNU 1) +# +# By default, runtime linking is enabled. All shared objects specified on the command line +# will be listed, even if there are no symbols referenced, in the output file. +set (CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl") +set (CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl") +set (CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl") + + 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,-bnoipath") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") endmacro() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index abf3855..5470441 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -18,11 +18,21 @@ if(__AIX_COMPILER_XL) endif() set(__AIX_COMPILER_XL 1) +# +# By default, runtime linking is enabled. All shared objects specified on the command line +# will be listed, even if there are no symbols referenced, in the output file. +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl") + + 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,-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_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") endmacro() diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake new file mode 100644 index 0000000..97771a2 --- /dev/null +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -0,0 +1,143 @@ +# Compute Node Linux doesn't quite work the same as native Linux so all of this +# needs to be custom. We use the variables defined through Cray's environment +# modules to set up the right paths for things. + +set(UNIX 1) + +if(DEFINED ENV{CRAYOS_VERSION}) + set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}") +elseif(DEFINED ENV{XTOS_VERSION}) + set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}") +else() + message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)") +endif() + +# Guard against multiple messages +if(NOT __CrayLinuxEnvironment_message) + set(__CrayLinuxEnvironment_message 1) + message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") +endif() + +# All cray systems are x86 CPUs and have been for quite some time +# Note: this may need to change in the future with 64-bit ARM +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_SHARED_LIBRARY_PREFIX "lib") +set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") +set(CMAKE_STATIC_LIBRARY_PREFIX "lib") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") + +# Don't override shared lib support if it's already been set and possibly +# overridden elsewhere by the CrayPrgEnv module +if(NOT CMAKE_FIND_LIBRARY_SUFFIXES) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +endif() + +set(CMAKE_DL_LIBS dl) + +# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray +# environment accordingly + +# Get the install directory of the running cmake to the search directories +# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up +get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH) +get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH) + +# Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy +# of the NIDs userland. If so, then we'll use it. Otherwise, just assume +# the userland from the login node is ok + +# List common installation prefixes. These will be used for all +# search types. +list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Standard + $ENV{SYSROOT_DIR}/usr/local $ENV{SYSROOT_DIR}/usr $ENV{SYSROOT_DIR}/ + + # CMake install location + "${__cmake_install_dir}" + ) +if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # Project install destination. + "${CMAKE_INSTALL_PREFIX}" + ) + if(CMAKE_STAGING_PREFIX) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH + # User-supplied staging prefix. + "${CMAKE_STAGING_PREFIX}" + ) + endif() +endif() + +list(APPEND CMAKE_SYSTEM_INCLUDE_PATH + $ENV{SYSROOT_DIR}/usr/include + $ENV{SYSROOT_DIR}/usr/include/X11 +) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH + $ENV{SYSROOT_DIR}/usr/local/lib64 + $ENV{SYSROOT_DIR}/usr/lib64 + $ENV{SYSROOT_DIR}/lib64 +) +list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + $ENV{SYSROOT_DIR}/usr/local/lib64 + $ENV{SYSROOT_DIR}/usr/lib64 + $ENV{SYSROOT_DIR}/lib64 +) + +# Compute the intersection of several lists +function(__cray_list_intersect OUTPUT INPUT0) + if(ARGC EQUAL 2) + list(APPEND ${OUTPUT} ${${INPUT0}}) + else() + foreach(I IN LISTS ${INPUT0}) + set(__is_common 1) + foreach(L IN LISTS ARGN) + list(FIND ${L} "${I}" __idx) + if(__idx EQUAL -1) + set(__is_common 0) + break() + endif() + endforeach() + if(__is_common) + list(APPEND ${OUTPUT} "${I}") + endif() + endforeach() + endif() + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() + +macro(__list_clean_dupes var) + if(${var}) + list(REMOVE_DUPLICATES ${var}) + endif() +endmacro() + +get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) +set(__cray_inc_path_vars) +set(__cray_lib_path_vars) +foreach(__lang IN LISTS __langs) + list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) +endforeach() +if(__cray_inc_path_vars) + __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars}) + if(__cray_implicit_include_dirs) + list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs}) + endif() +endif() +if(__cray_lib_path_vars) + __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars}) + if(__cray_implicit_library_dirs) + list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs}) + endif() +endif() +__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH) +__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH) +__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH) +__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES) + +# Enable use of lib64 search path variants by default. +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake index eb909fe..6c71784 100644 --- a/Modules/Platform/HP-UX-GNU.cmake +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -20,8 +20,10 @@ 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_LINK_${lang}_FLAGS "-Wl,-E") 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") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath") endmacro() diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake index 871ea13..3935c31 100644 --- a/Modules/Platform/HP-UX-HP.cmake +++ b/Modules/Platform/HP-UX-HP.cmake @@ -22,10 +22,12 @@ macro(__hpux_compiler_hp lang) set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "+Z") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-Wl,-E,+nodefaultrpath -b -L/usr/lib") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E") 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") set(CMAKE_${lang}_FLAGS_INIT "") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath") endmacro() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index 77946f2..58398c0 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -9,12 +9,6 @@ endif() include(Platform/UnixPaths) -# Add the compiler's implicit link directories. -if("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) - list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES - /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib) -endif() - # 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/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 5295a48e..102e3a6 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -78,7 +78,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R # invocations within a single working directory. if(NOT DEFINED CMAKE_JOB_POOL_LINK) set(CMAKE_JOB_POOL_LINK BCC32LinkPool) - set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + get_property(_bccjp GLOBAL PROPERTY JOB_POOLS) + if(NOT _bccjp MATCHES "BCC32LinkPool=") + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + endif() + unset(_bccjp) endif() macro(__embarcadero_language lang) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index b421b0d..a61413a 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -302,6 +302,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) + set(CMAKE_NINJA_DEPTYPE_${lang} msvc) if(NOT CMAKE_RC_COMPILER_INIT) set(CMAKE_RC_COMPILER_INIT rc) @@ -311,4 +312,5 @@ macro(__windows_compiler_msvc lang) endif() enable_language(RC) + set(CMAKE_NINJA_CMCLDEPS_RC 1) endmacro() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index dced6ec..6146d78 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -444,7 +444,7 @@ function(add_jar _TARGET_NAME) if (_add_jar_MANIFEST) set(_MANIFEST_OPTION m) - set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE) endif () if (LIBRARY_OUTPUT_PATH) |