diff options
Diffstat (limited to 'Modules')
141 files changed, 2898 insertions, 1096 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 0c733fa..fee0a7c 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -19,6 +19,7 @@ # get_bundle_and_executable # get_bundle_all_executables # get_item_key +# get_item_rpaths # clear_bundle_keys # set_bundle_key_values # get_bundle_keys @@ -124,7 +125,7 @@ # :: # # SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs> -# <copyflag>) +# <copyflag> [<rpaths>]) # # Add a key to the list (if necessary) for the given item. If added, # also set all the variables associated with that key. @@ -237,6 +238,7 @@ function(get_bundle_main_executable bundle result_var) file(READ "${bundle}/Contents/Info.plist" info_plist) string(REPLACE ";" "\\;" info_plist "${info_plist}") string(REPLACE "\n" "${eol_char};" info_plist "${info_plist}") + string(REPLACE "\r" "${eol_char};" info_plist "${info_plist}") # Scan the lines for "<key>CFBundleExecutable</key>" - the line after that # is the name of the main executable. @@ -377,7 +379,25 @@ endfunction() function(get_bundle_all_executables bundle exes_var) set(exes "") - file(GLOB_RECURSE file_list "${bundle}/*") + if(UNIX) + find_program(find_cmd "find") + mark_as_advanced(find_cmd) + endif() + + # find command is much quicker than checking every file one by one on Unix + # which can take long time for large bundles, and since anyway we expect + # executable to have execute flag set we can narrow the list much quicker. + if(find_cmd) + execute_process(COMMAND "${find_cmd}" "${bundle}" + -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \) + OUTPUT_VARIABLE file_list + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REPLACE "\n" ";" file_list "${file_list}") + else() + file(GLOB_RECURSE file_list "${bundle}/*") + endif() + foreach(f ${file_list}) is_file_executable("${f}" is_executable) if(is_executable) @@ -389,6 +409,29 @@ function(get_bundle_all_executables bundle exes_var) endfunction() +function(get_item_rpaths item rpaths_var) + if(APPLE) + find_program(otool_cmd "otool") + mark_as_advanced(otool_cmd) + endif() + + if(otool_cmd) + execute_process( + COMMAND "${otool_cmd}" -l "${item}" + OUTPUT_VARIABLE load_cmds_ov + ) + string(REGEX REPLACE "[^\n]+cmd LC_RPATH\n[^\n]+\n[^\n]+path ([^\n]+) \\(offset[^\n]+\n" "rpath \\1\n" load_cmds_ov "${load_cmds_ov}") + 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}") + endif() + endif() + + set(${rpaths_var} ${${rpaths_var}} PARENT_SCOPE) +endfunction() + + function(get_item_key item key_var) get_filename_component(item_name "${item}" NAME) if(WIN32) @@ -407,12 +450,14 @@ function(clear_bundle_keys keys_var) set(${key}_EMBEDDED_ITEM PARENT_SCOPE) set(${key}_RESOLVED_EMBEDDED_ITEM PARENT_SCOPE) set(${key}_COPYFLAG PARENT_SCOPE) + set(${key}_RPATHS PARENT_SCOPE) endforeach() set(${keys_var} PARENT_SCOPE) endfunction() function(set_bundle_key_values keys_var context item exepath dirs copyflag) + set(rpaths "${ARGV6}") get_filename_component(item_name "${item}" NAME) get_item_key("${item}" key) @@ -422,10 +467,12 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) list(LENGTH ${keys_var} length_after) if(NOT length_before EQUAL length_after) - gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item) + gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}") gp_item_default_embedded_path("${item}" default_embedded_path) + get_item_rpaths("${resolved_item}" item_rpaths) + if(item MATCHES "[^/]+\\.framework/") # For frameworks, construct the name under the embedded path from the # opening "${item_name}.framework/" to the closing "/${item_name}": @@ -461,6 +508,8 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag) set(${key}_EMBEDDED_ITEM "${embedded_item}" PARENT_SCOPE) set(${key}_RESOLVED_EMBEDDED_ITEM "${resolved_embedded_item}" PARENT_SCOPE) set(${key}_COPYFLAG "${copyflag}" PARENT_SCOPE) + set(${key}_RPATHS "${item_rpaths}" PARENT_SCOPE) + set(${key}_RDEP_RPATHS "${rpaths}" PARENT_SCOPE) else() #message("warning: item key '${key}' already in the list, subsequent references assumed identical to first") endif() @@ -481,18 +530,27 @@ function(get_bundle_keys app libs dirs keys_var) # get_bundle_all_executables("${bundle}" exes) + # Set keys for main executable first: + # + set_bundle_key_values(${keys_var} "${executable}" "${executable}" "${exepath}" "${dirs}" 0) + + # Get rpaths specified by main executable: + # + get_item_key("${executable}" executable_key) + set(main_rpaths "${${executable_key}_RPATHS}") + # For each extra lib, accumulate a key as well and then also accumulate # any of its prerequisites. (Extra libs are typically dynamically loaded # plugins: libraries that are prerequisites for full runtime functionality # but that do not show up in otool -L output...) # foreach(lib ${libs}) - set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0) + set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0 "${main_rpaths}") set(prereqs "") - get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}") + get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}" "${main_rpaths}") foreach(pr ${prereqs}) - set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1) + set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1 "${main_rpaths}") endforeach() endforeach() @@ -501,16 +559,27 @@ function(get_bundle_keys app libs dirs keys_var) # binaries in the bundle have been analyzed. # foreach(exe ${exes}) - # Add the exe itself to the keys: + # Main executable is scanned first above: # - set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0) + if(NOT "${exe}" STREQUAL "${executable}") + # Add the exe itself to the keys: + # + set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0 "${main_rpaths}") + + # Get rpaths specified by executable: + # + get_item_key("${exe}" exe_key) + set(exe_rpaths "${main_rpaths}" "${${exe_key}_RPATHS}") + else() + set(exe_rpaths "${main_rpaths}") + endif() # Add each prerequisite to the keys: # set(prereqs "") - get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}") + get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}" "${exe_rpaths}") foreach(pr ${prereqs}) - set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1) + set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1 "${exe_rpaths}") endforeach() endforeach() @@ -524,6 +593,8 @@ function(get_bundle_keys app libs dirs keys_var) set(${key}_EMBEDDED_ITEM "${${key}_EMBEDDED_ITEM}" PARENT_SCOPE) set(${key}_RESOLVED_EMBEDDED_ITEM "${${key}_RESOLVED_EMBEDDED_ITEM}" PARENT_SCOPE) set(${key}_COPYFLAG "${${key}_COPYFLAG}" PARENT_SCOPE) + set(${key}_RPATHS "${${key}_RPATHS}" PARENT_SCOPE) + set(${key}_RDEP_RPATHS "${${key}_RDEP_RPATHS}" PARENT_SCOPE) endforeach() endif() endfunction() @@ -579,12 +650,45 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}") # Plus Resources, if they exist: - string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}") - string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}") + string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}") + string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}") if(EXISTS "${resolved_resources}") #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_resources}' '${resolved_embedded_resources}'") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}") endif() + + # Some frameworks e.g. Qt put Info.plist in wrong place, so when it is + # missing in resources, copy it from other well known incorrect locations: + if(NOT EXISTS "${resolved_resources}/Info.plist") + # Check for Contents/Info.plist in framework root (older Qt SDK): + string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Contents/Info.plist" resolved_info_plist "${resolved_item}") + string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources/Info.plist" resolved_embedded_info_plist "${resolved_embedded_item}") + if(EXISTS "${resolved_info_plist}") + #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_info_plist}' '${resolved_embedded_info_plist}'") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_info_plist}" "${resolved_embedded_info_plist}") + endif() + endif() + + # Check if framework is versioned and fix it layout + string(REGEX REPLACE "^.*/([^/]+)/[^/]+$" "\\1" resolved_embedded_version "${resolved_embedded_item}") + string(REGEX REPLACE "^(.*)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions "${resolved_embedded_item}") + string(REGEX REPLACE "^.*/([^/]+)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions_basename "${resolved_embedded_item}") + if(resolved_embedded_versions_basename STREQUAL "Versions") + # Ensure Current symlink points to the framework version + if(NOT EXISTS "${resolved_embedded_versions}/Current") + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${resolved_embedded_version}" "${resolved_embedded_versions}/Current") + endif() + # Restore symlinks in framework root pointing to current framework + # binary and resources: + string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1" resolved_embedded_root "${resolved_embedded_item}") + string(REGEX REPLACE "^.*/([^/]+)$" "\\1" resolved_embedded_item_basename "${resolved_embedded_item}") + if(NOT EXISTS "${resolved_embedded_root}/${resolved_embedded_item_basename}") + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/${resolved_embedded_item_basename}" "${resolved_embedded_root}/${resolved_embedded_item_basename}") + endif() + if(NOT EXISTS "${resolved_embedded_root}/Resources") + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/Resources" "${resolved_embedded_root}/Resources") + endif() + endif() endif() if(UNIX AND NOT APPLE) file(RPATH_REMOVE FILE "${resolved_embedded_item}") @@ -629,8 +733,10 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) message(FATAL_ERROR "cannot fixup an item that is not in the bundle...") endif() + set(rpaths "${${ikey}_RPATHS}" "${${ikey}_RDEP_RPATHS}") + set(prereqs "") - get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}") + get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}" "${rpaths}") set(changes "") @@ -650,12 +756,28 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) execute_process(COMMAND chmod u+w "${resolved_embedded_item}") endif() + # Only if install_name_tool supports -delete_rpath: + # + execute_process(COMMAND install_name_tool + OUTPUT_VARIABLE install_name_tool_usage + ERROR_VARIABLE install_name_tool_usage + ) + if(install_name_tool_usage MATCHES ".*-delete_rpath.*") + foreach(rpath ${${ikey}_RPATHS}) + set(changes ${changes} -delete_rpath "${rpath}") + endforeach() + endif() + + if(${ikey}_EMBEDDED_ITEM) + set(changes ${changes} -id "${${ikey}_EMBEDDED_ITEM}") + endif() + # Change this item's id and all of its references in one call # to install_name_tool: # - execute_process(COMMAND install_name_tool - ${changes} -id "${${ikey}_EMBEDDED_ITEM}" "${resolved_embedded_item}" - ) + if(changes) + execute_process(COMMAND install_name_tool ${changes} "${resolved_embedded_item}") + endif() endfunction() @@ -746,10 +868,8 @@ function(verify_bundle_prerequisites bundle result_var info_var) get_bundle_main_executable("${bundle}" main_bundle_exe) - file(GLOB_RECURSE file_list "${bundle}/*") + get_bundle_all_executables("${bundle}" file_list) foreach(f ${file_list}) - is_file_executable("${f}" is_executable) - if(is_executable) get_filename_component(exepath "${f}" PATH) math(EXPR count "${count} + 1") @@ -788,7 +908,6 @@ function(verify_bundle_prerequisites bundle result_var info_var) set(result 0) set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n") endif() - endif() endforeach() if(result) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index dce1624..62ef972 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -50,6 +50,24 @@ if(NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) endif() +# This should be included before the _INIT variables are +# used to initialize the cache. Since the rule variables +# have if blocks on them, users can still define them here. +# But, it should still be after the platform file so changes can +# be made to those values. + +if(CMAKE_USER_MAKE_RULES_OVERRIDE) + # Save the full path of the file so try_compile can use it. + include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") +endif() + +if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM) + # Save the full path of the file so try_compile can use it. + include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override) + set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}") +endif() + # Set default assembler file extensions: if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index eb105ab..972883c 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM") set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) -set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> /c /Fo <OBJECT> <SOURCE>") include(CMakeASMInformation) set(ASM_DIALECT) diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 9d8ba9e..19b2bbc 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -28,14 +28,16 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "option.*not supported" # Intel FAIL_REGEX "invalid argument .*option" # Intel FAIL_REGEX "ignoring option .*argument required" # Intel + FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL FAIL_REGEX "command option .* contains an incorrect subargument" # XL - FAIL_REGEX "not supported in this configuration; ignored" # AIX + FAIL_REGEX "not supported in this configuration. ignored" # AIX FAIL_REGEX "File with unknown suffix passed to linker" # PGI FAIL_REGEX "WARNING: unknown flag:" # Open64 FAIL_REGEX "Incorrect command line option:" # Borland FAIL_REGEX "Warning: illegal option" # SunStudio 12 + FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu ) endmacro () diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index d8a0d67..19bcbcc 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -17,6 +17,7 @@ function(_readFile file) get_filename_component(name ${file} NAME_WE) string(REGEX REPLACE "-.*" "" CompilerId ${name}) set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) + set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE) set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE) endfunction() @@ -60,8 +61,6 @@ function(compiler_id_detection outvar lang) list(APPEND ordered_compilers Intel PathScale - AppleClang - Clang Embarcadero Borland Watcom @@ -75,6 +74,7 @@ function(compiler_id_detection outvar lang) PGI Cray TI + Fujitsu ) if (lang STREQUAL C) list(APPEND ordered_compilers @@ -83,6 +83,8 @@ function(compiler_id_detection outvar lang) endif() list(APPEND ordered_compilers SCO + AppleClang + Clang GNU MSVC ADSP @@ -114,7 +116,9 @@ function(compiler_id_detection outvar lang) endif() set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n") if (CID_ID_STRING) - set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"") + set(PREFIX ${CID_PREFIX}) + string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY) + set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}") endif() if (CID_ID_DEFINE) set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n") @@ -122,6 +126,8 @@ function(compiler_id_detection outvar lang) endif() if (CID_VERSION_STRINGS) set(PREFIX ${CID_PREFIX}) + set(MACRO_DEC DEC) + set(MACRO_HEX HEX) string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY) set(id_content "${id_content}${VERSION_BLOCK}\n") endif() diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake index 665a65c..142ef95 100644 --- a/Modules/CMakeDetermineASM_MASMCompiler.cmake +++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake @@ -17,7 +17,8 @@ set(ASM_DIALECT "_MASM") # if we are using the 64bit cl compiler, assume we also want the 64bit assembler -if(CMAKE_CL_64) +if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};" + MATCHES ";(Win64|Itanium|x64|IA64);") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64) else() set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 3847b75..6b425c6 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -136,7 +136,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) + if(CMAKE_C_COMPILER_TARGET) + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) + endif() elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$") if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?") set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index e6a9d9a..893c454 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -133,7 +133,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) + if(CMAKE_CXX_COMPILER_TARGET) + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) + endif() elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$") if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?") set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-) diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index cd0f8b8..0ab3af6 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -65,7 +65,7 @@ macro(_cmake_find_compiler lang) endif() find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) - set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE) + set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}") endif() unset(_${lang}_COMPILER_HINTS) unset(_languages) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 8595b97..4bc42dd 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -28,13 +28,15 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") endif() + if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") + # Avoid adding our own platform standard libraries for compilers + # from which we might detect implicit link libraries. + list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=") + endif() try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} - CMAKE_FLAGS "${CMAKE_FLAGS}" - "-DCMAKE_${lang}_STANDARD_LIBRARIES=" - # We need ignore these warnings because some platforms need - # CMAKE_${lang}_STANDARD_LIBRARIES to link properly and we - # don't care when we are just determining the ABI. + CMAKE_FLAGS ${CMAKE_FLAGS} + # Ignore unused flags when we are just determining the ABI. "--no-warn-unused-cli" OUTPUT_VARIABLE OUTPUT COPY_FILE "${BIN}" @@ -50,7 +52,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) message(STATUS "Detecting ${lang} compiler ABI info - done") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n") - file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[") + file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") foreach(info ${ABI_STRINGS}) if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]") set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 025d296..613f4b3 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -142,7 +142,17 @@ Id flags: ${testflags} set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_cl cl.exe) - if(lang STREQUAL Fortran) + if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(v NsightTegra) + set(ext vcxproj) + if(lang STREQUAL CXX) + set(id_gcc g++) + set(id_clang clang++) + else() + set(id_gcc gcc) + set(id_clang clang) + endif() + elseif(lang STREQUAL Fortran) set(v Intel) set(ext vfproj) set(id_cl ifort.exe) @@ -161,13 +171,34 @@ Id flags: ${testflags} set(id_platform ia64) endif() if(CMAKE_VS_PLATFORM_TOOLSET) - set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") - set(id_cl icl.exe) + if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>") + else() + set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") + set(id_cl icl.exe) + endif() endif() else() set(id_toolset "") endif() + if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(id_system "<ApplicationType>Windows Phone</ApplicationType>") + elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(id_system "<ApplicationType>Windows Store</ApplicationType>") + else() + set(id_system "") + endif() + if(id_system AND CMAKE_SYSTEM_VERSION) + set(id_system_version "<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>") + else() + set(id_system_version "") + endif() + if(id_platform STREQUAL ARM) + set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>") + else() + set(id_WindowsSDKDesktopARMSupport "") + endif() if(CMAKE_VS_WINCE_VERSION) set(id_entrypoint "mainACRTStartup") if("${vs_version}" VERSION_LESS 9) @@ -230,11 +261,20 @@ Id flags: ${testflags} else() set(id_deployment_target "") endif() + set(id_product_type "com.apple.product-type.tool") if(CMAKE_OSX_SYSROOT) set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";") + if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]") + set(id_product_type "com.apple.product-type.bundle.unit-test") + endif() else() set(id_sdkroot "") endif() + if(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY) + set(id_code_sign_identity "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";") + else() + set(id_code_sign_identity "") + endif() if(NOT ${XCODE_VERSION} VERSION_LESS 3) set(v 3) set(ext xcodeproj) @@ -267,7 +307,7 @@ Id flags: ${testflags} # ... # /path/to/cc ...CompilerId${lang}/... # to extract the compiler front-end for the language. - if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?CompilerId${lang}[ \t\n\\\"]") + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}(/CompilerId${lang}.xctest)?/(\\./)?CompilerId${lang}[ \t\n\\\"]") set(_comp "${CMAKE_MATCH_2}") if(EXISTS "${_comp}") set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) @@ -335,7 +375,13 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # binary dir. file(GLOB files RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR} - ${CMAKE_${lang}_COMPILER_ID_DIR}/*) + + # normal case + ${CMAKE_${lang}_COMPILER_ID_DIR}/* + + # com.apple.package-type.bundle.unit-test + ${CMAKE_${lang}_COMPILER_ID_DIR}/*.xctest/* + ) list(REMOVE_ITEM files "${src}") set(COMPILER_${lang}_PRODUCED_FILES "") foreach(file ${files}) @@ -373,7 +419,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(SIMULATE_ID) set(SIMULATE_VERSION) file(STRINGS ${file} - CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:") + CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") set(COMPILER_ID_TWICE) foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 1c0941a..fe292ea 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -47,7 +47,7 @@ if(CMAKE_HOST_UNIX) if(CMAKE_UNAME) exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) - if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin") + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$") exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index 0752e04..8ac3364 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -20,8 +20,9 @@ # # :: # -# cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" ) +# cmake_expand_imported_targets(expandedLibs +# LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} +# CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" ) #============================================================================= @@ -71,7 +72,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) set(_CCSR_NEW_REQ_LIBS ) set(_CHECK_FOR_IMPORTED_TARGETS FALSE) foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) - get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if(TARGET "${_CURRENT_LIB}") + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + else() + set(_importedConfigs "") + endif() if (_importedConfigs) # message(STATUS "Detected imported target ${_CURRENT_LIB}") # Ok, so this is an imported target. @@ -123,7 +128,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) # all remaining imported target names (there shouldn't be any left anyway). set(_CCSR_NEW_REQ_LIBS ) foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS}) - get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + if(TARGET "${_CURRENT_LIB}") + get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS) + else() + set(_importedConfigs "") + endif() if (NOT _importedConfigs) list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) # message(STATUS "final: appending ${_CURRENT_LIB}") diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 829b6ff..e0ba131 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -35,7 +35,8 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" - OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") + OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" + AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) @@ -66,9 +67,7 @@ else() endif() - -# on Apple there really should be install_name_tool -if(APPLE) +if(CMAKE_PLATFORM_HAS_INSTALLNAME) find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) if(NOT CMAKE_INSTALL_NAME_TOOL) diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 9f97ee5..fc3058d 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -7,15 +7,24 @@ # This file is executed by cmake when invoked with --find-package. It # expects that the following variables are set using -D: # -# :: -# -# NAME = name of the package -# COMPILER_ID = the CMake compiler ID for which the result is, i.e. GNU/Intel/Clang/MSVC, etc. -# LANGUAGE = language for which the result will be used, i.e. C/CXX/Fortan/ASM -# MODE = EXIST : only check for existence of the given package -# COMPILE : print the flags needed for compiling an object file which uses the given package -# LINK : print the flags needed for linking when using the given package -# QUIET = if TRUE, don't print anything +# ``NAME`` +# name of the package +# ``COMPILER_ID`` +# the CMake compiler ID for which the result is, +# i.e. GNU/Intel/Clang/MSVC, etc. +# ``LANGUAGE`` +# language for which the result will be used, +# i.e. C/CXX/Fortan/ASM +# ``MODE`` +# ``EXIST`` +# only check for existence of the given package +# ``COMPILE`` +# print the flags needed for compiling an object file which uses +# the given package +# ``LINK`` +# print the flags needed for linking when using the given package +# ``QUIET`` +# if TRUE, don't print anything #============================================================================= # Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org> diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 473bbe5..206ea7a 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -2,29 +2,37 @@ # CMakePackageConfigHelpers # ------------------------- # -# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() +# Helpers functions for creating config files that can be included by other +# projects to find and use a package. # +# Adds the :command:`configure_package_config_file()` and +# :command:`write_basic_package_version_file()` commands. # +# Generating a Package Configuration File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # -# :: +# .. command:: configure_package_config_file # -# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path> -# [PATH_VARS <var1> <var2> ... <varN>] -# [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) +# Create a config file for a project:: # +# configure_package_config_file(<input> <output> +# INSTALL_DESTINATION <path> +# [PATH_VARS <var1> <var2> ... <varN>] +# [NO_SET_AND_CHECK_MACRO] +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [INSTALL_PREFIX <path>] +# ) # +# ``configure_package_config_file()`` should be used instead of the plain +# :command:`configure_file()` command when creating the ``<Name>Config.cmake`` +# or ``<Name>-config.cmake`` file for installing a project or library. It helps +# making the resulting package relocatable by avoiding hardcoded paths in the +# installed ``Config.cmake`` file. # -# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain -# configure_file() command when creating the <Name>Config.cmake or -# <Name>-config.cmake file for installing a project or library. It -# helps making the resulting package relocatable by avoiding hardcoded -# paths in the installed Config.cmake file. +# In a ``FooConfig.cmake`` file there may be code like this to make the install +# destinations know to the using project: # -# In a FooConfig.cmake file there may be code like this to make the -# install destinations know to the using project: -# -# :: +# .. code-block:: cmake # # set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) # set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) @@ -32,141 +40,154 @@ # ...logic to determine installedPrefix from the own location... # set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) # -# All 4 options shown above are not sufficient, since the first 3 -# hardcode the absolute directory locations, and the 4th case works only -# if the logic to determine the installedPrefix is correct, and if -# CONFIG_INSTALL_DIR contains a relative path, which in general cannot -# be guaranteed. This has the effect that the resulting FooConfig.cmake -# file would work poorly under Windows and OSX, where users are used to -# choose the install location of a binary package at install time, -# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time. -# -# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it -# makes the resulting FooConfig.cmake file relocatable. Usage: -# -# :: -# -# 1. write a FooConfig.cmake.in file as you are used to -# 2. insert a line containing only the string "@PACKAGE_INIT@" -# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") -# (this must be after the @PACKAGE_INIT@ line) -# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() -# -# -# -# The <input> and <output> arguments are the input and output file, the -# same way as in configure_file(). -# -# The <path> given to INSTALL_DESTINATION must be the destination where -# the FooConfig.cmake file will be installed to. This can either be a -# relative or absolute path, both work. -# -# The variables <var1> to <varN> given as PATH_VARS are the variables -# which contain install destinations. For each of them the macro will -# create a helper variable PACKAGE_<var...>. These helper variables -# must be used in the FooConfig.cmake.in file for setting the installed -# location. They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so -# that they are always relative to the installed location of the -# package. This works both for relative and also for absolute -# locations. For absolute locations it works only if the absolute -# location is a subdirectory of CMAKE_INSTALL_PREFIX. -# -# By default configure_package_config_file() also generates two helper -# macros, set_and_check() and check_required_components() into the -# FooConfig.cmake file. -# -# set_and_check() should be used instead of the normal set() command for -# setting directories and file locations. Additionally to setting the -# variable it also checks that the referenced file or directory actually -# exists and fails with a FATAL_ERROR otherwise. This makes sure that -# the created FooConfig.cmake file does not contain wrong references. -# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated -# into the FooConfig.cmake file. -# -# check_required_components(<package_name>) should be called at the end -# of the FooConfig.cmake file if the package supports components. This -# macro checks whether all requested, non-optional components have been -# found, and if this is not the case, sets the Foo_FOUND variable to -# FALSE, so that the package is considered to be not found. It does -# that by testing the Foo_<Component>_FOUND variables for all requested -# required components. When using the NO_CHECK_REQUIRED_COMPONENTS -# option, this macro is not generated into the FooConfig.cmake file. +# All 4 options shown above are not sufficient, since the first 3 hardcode the +# absolute directory locations, and the 4th case works only if the logic to +# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR`` +# contains a relative path, which in general cannot be guaranteed. This has the +# effect that the resulting ``FooConfig.cmake`` file would work poorly under +# Windows and OSX, where users are used to choose the install location of a +# binary package at install time, independent from how +# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time. +# +# Using ``configure_package_config_file`` helps. If used correctly, it makes +# the resulting ``FooConfig.cmake`` file relocatable. Usage: +# +# 1. write a ``FooConfig.cmake.in`` file as you are used to +# 2. insert a line containing only the string ``@PACKAGE_INIT@`` +# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use +# ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the +# ``@PACKAGE_INIT@`` line) +# 4. instead of using the normal :command:`configure_file()`, use +# ``configure_package_config_file()`` +# +# +# +# The ``<input>`` and ``<output>`` arguments are the input and output file, the +# same way as in :command:`configure_file()`. +# +# The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where +# the ``FooConfig.cmake`` file will be installed to. This path can either be +# absolute, or relative to the ``INSTALL_PREFIX`` path. +# +# The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the +# variables which contain install destinations. For each of them the macro will +# create a helper variable ``PACKAGE_<var...>``. These helper variables must be +# used in the ``FooConfig.cmake.in`` file for setting the installed location. +# They are calculated by ``configure_package_config_file`` so that they are +# always relative to the installed location of the package. This works both for +# relative and also for absolute locations. For absolute locations it works +# only if the absolute location is a subdirectory of ``INSTALL_PREFIX``. +# +# If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to +# calculate all the relative paths. The ``<path>`` argument must be an absolute +# path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX` +# variable will be used instead. The default value is good when generating a +# FooConfig.cmake file to use your package from the install tree. When +# generating a FooConfig.cmake file to use your package from the build tree this +# option should be used. +# +# By default ``configure_package_config_file`` also generates two helper macros, +# ``set_and_check()`` and ``check_required_components()`` into the +# ``FooConfig.cmake`` file. +# +# ``set_and_check()`` should be used instead of the normal ``set()`` command for +# setting directories and file locations. Additionally to setting the variable +# it also checks that the referenced file or directory actually exists and fails +# with a ``FATAL_ERROR`` otherwise. This makes sure that the created +# ``FooConfig.cmake`` file does not contain wrong references. +# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated +# into the ``FooConfig.cmake`` file. +# +# ``check_required_components(<package_name>)`` should be called at the end of +# the ``FooConfig.cmake`` file if the package supports components. This macro +# checks whether all requested, non-optional components have been found, and if +# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that +# the package is considered to be not found. It does that by testing the +# ``Foo_<Component>_FOUND`` variables for all requested required components. +# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is +# not generated into the ``FooConfig.cmake`` file. # # For an example see below the documentation for -# WRITE_BASIC_PACKAGE_VERSION_FILE(). -# -# -# -# :: -# -# WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) -# -# -# -# Writes a file for use as <package>ConfigVersion.cmake file to -# <filename>. See the documentation of find_package() for details on -# this. -# -# :: -# -# filename is the output filename, it should be in the build tree. -# major.minor.patch is the version number of the project to be installed -# -# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable -# is used. If this hasn't been set, it errors out. -# -# The COMPATIBILITY mode AnyNewerVersion means that the installed -# package version will be considered compatible if it is newer or -# exactly the same as the requested version. This mode should be used -# for packages which are fully backward compatible, also across major -# versions. If SameMajorVersion is used instead, then the behaviour -# differs from AnyNewerVersion in that the major version number must be -# the same as requested, e.g. version 2.0 will not be considered -# compatible if 1.0 is requested. This mode should be used for packages -# which guarantee backward compatibility within the same major version. -# If ExactVersion is used, then the package is only considered -# compatible if the requested version matches exactly its own version -# number (not considering the tweak version). For example, version -# 1.2.3 of a package is only considered compatible to requested version -# 1.2.3. This mode is for packages without compatibility guarantees. -# If your project has more elaborated version matching rules, you will -# need to write your own custom ConfigVersion.cmake file instead of -# using this macro. -# -# Internally, this macro executes configure_file() to create the -# resulting version file. Depending on the COMPATIBLITY, either the -# file BasicConfigVersion-SameMajorVersion.cmake.in or -# BasicConfigVersion-AnyNewerVersion.cmake.in is used. Please note that +# :command:`write_basic_package_version_file()`. +# +# Generating a Package Version File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# .. command:: write_basic_package_version_file +# +# Create a version file for a project:: +# +# write_basic_package_version_file(<filename> +# [VERSION <major.minor.patch>] +# COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> ) +# +# +# Writes a file for use as ``<package>ConfigVersion.cmake`` file to +# ``<filename>``. See the documentation of :command:`find_package()` for +# details on this. +# +# ``<filename>`` is the output filename, it should be in the build tree. +# ``<major.minor.patch>`` is the version number of the project to be installed. +# +# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used. +# If this hasn't been set, it errors out. +# +# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed +# package version will be considered compatible if it is newer or exactly the +# same as the requested version. This mode should be used for packages which +# are fully backward compatible, also across major versions. +# If ``SameMajorVersion`` is used instead, then the behaviour differs from +# ``AnyNewerVersion`` in that the major version number must be the same as +# requested, e.g. version 2.0 will not be considered compatible if 1.0 is +# requested. This mode should be used for packages which guarantee backward +# compatibility within the same major version. +# If ``ExactVersion`` is used, then the package is only considered compatible if +# the requested version matches exactly its own version number (not considering +# the tweak version). For example, version 1.2.3 of a package is only +# considered compatible to requested version 1.2.3. This mode is for packages +# without compatibility guarantees. +# If your project has more elaborated version matching rules, you will need to +# write your own custom ``ConfigVersion.cmake`` file instead of using this +# macro. +# +# Internally, this macro executes :command:`configure_file()` to create the +# resulting version file. Depending on the ``COMPATIBLITY``, either the file +# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or +# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that # these two files are internal to CMake and you should not call -# configure_file() on them yourself, but they can be used as starting -# point to create more sophisticted custom ConfigVersion.cmake files. +# :command:`configure_file()` on them yourself, but they can be used as starting +# point to create more sophisticted custom ``ConfigVersion.cmake`` files. # +# Example Generating Package Files +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # +# Example using both :command:`configure_package_config_file` and +# ``write_basic_package_version_file()``: # -# Example using both configure_package_config_file() and -# write_basic_package_version_file(): CMakeLists.txt: +# ``CMakeLists.txt``: # -# :: +# .. code-block:: cmake # # set(INCLUDE_INSTALL_DIR include/ ... CACHE ) # set(LIB_INSTALL_DIR lib/ ... CACHE ) # set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) # ... # include(CMakePackageConfigHelpers) -# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake -# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake -# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) -# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# VERSION 1.2.3 -# COMPATIBILITY SameMajorVersion ) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# configure_package_config_file(FooConfig.cmake.in +# ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) +# write_basic_package_version_file( +# ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# VERSION 1.2.3 +# COMPATIBILITY SameMajorVersion ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake # DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) # +# ``FooConfig.cmake.in``: # -# -# With a FooConfig.cmake.in: -# -# :: +# .. code-block:: cmake # # set(FOO_VERSION x.y.z) # ... @@ -175,10 +196,6 @@ # set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") # set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") # -# -# -# :: -# # check_required_components(Foo) @@ -203,11 +220,9 @@ macro(WRITE_BASIC_PACKAGE_VERSION_FILE) write_basic_config_version_file(${ARGN}) endmacro() -set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR}) - function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) - set(oneValueArgs INSTALL_DESTINATION ) + set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX) set(multiValueArgs PATH_VARS ) cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -220,20 +235,30 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") endif() + if(DEFINED CCF_INSTALL_PREFIX) + if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}") + set(installPrefix "${CCF_INSTALL_PREFIX}") + else() + message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path") + endif() + else() + set(installPrefix "${CMAKE_INSTALL_PREFIX}") + endif() + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") set(absInstallDir "${CCF_INSTALL_DESTINATION}") else() - set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") + set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}") endif() - file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" ) foreach(var ${CCF_PATH_VARS}) if(NOT DEFINED ${var}) message(FATAL_ERROR "Variable ${var} does not exist") else() if(IS_ABSOLUTE "${${var}}") - string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}" PACKAGE_${var} "${${var}}") else() set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") @@ -259,7 +284,7 @@ get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) get_filename_component(_realOrig \"${absInstallDir}\" REALPATH) if(_realCurr STREQUAL _realOrig) - set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\") + set(PACKAGE_PREFIX_DIR \"${installPrefix}\") endif() unset(_realOrig) unset(_realCurr) diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake index 4248176..8553f38 100644 --- a/Modules/CMakeParseArguments.cmake +++ b/Modules/CMakeParseArguments.cmake @@ -45,7 +45,8 @@ # set(options OPTIONAL FAST) # set(oneValueArgs DESTINATION RENAME) # set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" +# "${multiValueArgs}" ${ARGN} ) # ... # # diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake index ad3b0d5..474fa41 100644 --- a/Modules/CMakePrintHelpers.cmake +++ b/Modules/CMakePrintHelpers.cmake @@ -15,11 +15,10 @@ # # This macro prints the values of the properties of the given targets, # source files, directories, tests or cache entries. Exactly one of the -# scope keywords must be used. Example: +# scope keywords must be used. Example:: # -# :: -# -# cmake_print_properties(TARGETS foo bar PROPERTIES LOCATION INTERFACE_INCLUDE_DIRS) +# cmake_print_properties(TARGETS foo bar PROPERTIES +# LOCATION INTERFACE_INCLUDE_DIRS) # # This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for # both targets foo and bar. @@ -29,17 +28,13 @@ # CMAKE_PRINT_VARIABLES(var1 var2 .. varN) # # This macro will print the name of each variable followed by its value. -# Example: -# -# :: -# -# cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION THIS_ONE_DOES_NOT_EXIST) +# Example:: # -# Gives: +# cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST) # -# :: +# Gives:: # -# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; THIS_ONE_DOES_NOT_EXIST="" +# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST="" #============================================================================= # Copyright 2013 Alexander Neundorf, <neundorf@kde.org> diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 89547af..35259c4 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -418,35 +418,41 @@ if(NOT CPACK_GENERATOR) if(APPLE) option(CPACK_BINARY_BUNDLE "Enable to build OSX bundles" OFF) option(CPACK_BINARY_DRAGNDROP "Enable to build OSX Drag And Drop package" OFF) - option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF) option(CPACK_BINARY_OSXX11 "Enable to build OSX X11 packages" OFF) + option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF) else() option(CPACK_BINARY_TZ "Enable to build TZ packages" ON) endif() - option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON) - option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON) - option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF) option(CPACK_BINARY_DEB "Enable to build Debian packages" OFF) - option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF) option(CPACK_BINARY_NSIS "Enable to build NSIS packages" OFF) + option(CPACK_BINARY_RPM "Enable to build RPM packages" OFF) + option(CPACK_BINARY_STGZ "Enable to build STGZ packages" ON) + option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages" OFF) + option(CPACK_BINARY_TGZ "Enable to build TGZ packages" ON) + option(CPACK_BINARY_TXZ "Enable to build TXZ packages" OFF) endif() else() + option(CPACK_BINARY_7Z "Enable to build 7-Zip packages" OFF) option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON) option(CPACK_BINARY_WIX "Enable to build WiX packages" OFF) option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF) endif() + option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_7Z 7Z) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle) - cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop) - cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) - cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_CYGWIN CygwinBinary) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DEB DEB) - cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_DRAGNDROP DragNDrop) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_IFW IFW) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_NSIS NSIS) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_OSXX11 OSXX11) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PACKAGEMAKER PackageMaker) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ) - cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TGZ TGZ) + cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TXZ TXZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP) @@ -461,27 +467,51 @@ if(NOT CPACK_SOURCE_GENERATOR) else() option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON) option(CPACK_SOURCE_TGZ "Enable to build TGZ source packages" ON) + option(CPACK_SOURCE_TXZ "Enable to build TXZ source packages" ON) option(CPACK_SOURCE_TZ "Enable to build TZ source packages" ON) option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" OFF) endif() else() + option(CPACK_SOURCE_7Z "Enable to build 7-Zip source packages" ON) option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON) endif() + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_7Z 7Z) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_CYGWIN CygwinSource) - cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TBZ2 TBZ2) + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TGZ TGZ) + cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TXZ TXZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_TZ TZ) cpack_optional_append(CPACK_SOURCE_GENERATOR CPACK_SOURCE_ZIP ZIP) endif() # mark the above options as advanced -mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11 - CPACK_BINARY_STGZ CPACK_BINARY_TGZ CPACK_BINARY_TBZ2 - CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ - CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE - CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ - CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP) +mark_as_advanced( + CPACK_BINARY_7Z + CPACK_BINARY_BUNDLE + CPACK_BINARY_CYGWIN + CPACK_BINARY_DEB + CPACK_BINARY_DRAGNDROP + CPACK_BINARY_IFW + CPACK_BINARY_NSIS + CPACK_BINARY_OSXX11 + CPACK_BINARY_PACKAGEMAKER + CPACK_BINARY_RPM + CPACK_BINARY_STGZ + CPACK_BINARY_TBZ2 + CPACK_BINARY_TGZ + CPACK_BINARY_TXZ + CPACK_BINARY_TZ + CPACK_BINARY_WIX + CPACK_BINARY_ZIP + CPACK_SOURCE_7Z + CPACK_SOURCE_CYGWIN + CPACK_SOURCE_TBZ2 + CPACK_SOURCE_TGZ + CPACK_SOURCE_TXZ + CPACK_SOURCE_TZ + CPACK_SOURCE_ZIP + ) # Set some other variables cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 1433d9e..5524a3f 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -458,6 +458,9 @@ macro(cpack_add_component_group grpname) cpack_append_string_variable_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION CPACK_ADDGRP_STR) + cpack_append_string_variable_set_command( + CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_PARENT_GROUP + CPACK_ADDGRP_STR) cpack_append_option_set_command( CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED CPACK_ADDGRP_STR) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake new file mode 100644 index 0000000..4b8dc1e --- /dev/null +++ b/Modules/CPackIFW.cmake @@ -0,0 +1,517 @@ +#.rst: +# CPackIFW +# -------- +# +# .. _QtIFW: http://qt-project.org/doc/qtinstallerframework/index.html +# +# This module looks for the location of the command line utilities supplied with +# the Qt Installer Framework (QtIFW_). +# +# The module also defines several commands to control the behavior of the +# CPack ``IFW`` generator. +# +# +# Overview +# ^^^^^^^^ +# +# CPack ``IFW`` generator helps you create online and offline +# binary cross-platform installers with a graphical user interface. +# +# CPack IFW generator prepare project installation and generate configuration +# and meta information for QtIFW_ tools. +# +# The QtIFW_ provides a set of tools and utilities to create +# installers for the supported desktop Qt platforms: Linux, Microsoft Windows, +# and Mac OS X. +# +# To use CPack ``IFW`` generator you must also install QtIFW_. +# If you are not using the default path for the installation, please set +# the path to the variable ``QTIFWDIR``. +# +# Variables +# ^^^^^^^^^ +# +# You can use the following variables to change behavior of CPack ``IFW`` generator. +# +# Package +# """"""" +# +# .. variable:: CPACK_IFW_PACKAGE_TITLE +# +# Name of the installer as displayed on the title bar. +# By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` +# +# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER +# +# Publisher of the software (as shown in the Windows Control Panel). +# By default used :variable:`CPACK_PACKAGE_VENDOR` +# +# .. variable:: CPACK_IFW_PRODUCT_URL +# +# URL to a page that contains product information on your web site. +# +# .. variable:: CPACK_IFW_PACKAGE_ICON +# +# Filename for a custom installer icon. The actual file is '.icns' (Mac OS X), +# '.ico' (Windows). No functionality on Unix. +# +# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON +# +# Filename for a custom window icon in PNG format for the Installer application. +# +# .. variable:: CPACK_IFW_PACKAGE_LOGO +# +# Filename for a logo used as QWizard::LogoPixmap. +# +# .. variable:: CPACK_IFW_TARGET_DIRECTORY +# +# Default target directory for installation. +# By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`" +# +# You can use predefined variables. +# +# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY +# +# Default target directory for installation with administrator rights. +# +# You can use predefined variables. +# +# .. variable:: CPACK_IFW_PACKAGE_GROUP +# +# The group, which will be used to configure the root package +# +# .. variable:: CPACK_IFW_PACKAGE_NAME +# +# The root package name, which will be used if configuration group is not +# specified +# +# .. variable:: CPACK_IFW_REPOSITORIES_ALL +# +# The list of remote repositories. +# +# The default value of this variable is computed by CPack and contains +# all repositories added with command :command:`cpack_ifw_add_repository` +# +# .. variable:: CPACK_IFW_DOWNLOAD_ALL +# +# If this is ``ON`` all components will be downloaded. +# By default is ``OFF`` or used value +# from :variable:`CPACK_DOWNLOAD_ALL` if set +# +# Components +# """""""""" +# +# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES +# +# Resolve duplicate names when installing components with groups. +# +# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES +# +# Additional prepared packages dirs that will be used to resolve +# dependent components. +# +# Tools +# """""""" +# +# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE +# +# The path to "binarycreator" command line client. +# +# This variable is cached and can be configured user if need. +# +# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE +# +# The path to "repogen" command line client. +# +# This variable is cached and can be configured user if need. +# +# Commands +# ^^^^^^^^^ +# +# The module defines the following commands: +# +# -------------------------------------------------------------------------- +# +# .. command:: cpack_ifw_configure_component +# +# Sets the arguments specific to the CPack IFW generator. +# +# :: +# +# cpack_ifw_configure_component(<compname> [COMMON] +# [NAME <name>] +# [VERSION <version>] +# [SCRIPT <script>] +# [PRIORITY <priority>] +# [DEPENDS <com_id> ...] +# [LICENSES <display_name> <file_path> ...]) +# +# This command should be called after cpack_add_component command. +# +# ``COMMON`` if set, then the component will be packaged and installed as part +# of a group to which he belongs. +# +# ``VERSION`` is version of component. +# By default used :variable:`CPACK_PACKAGE_VERSION`. +# +# ``SCRIPT`` is relative or absolute path to operations script +# for this component. +# +# ``NAME`` is used to create domain-like identification for this component. +# By default used origin component name. +# +# ``PRIORITY`` is priority of the component in the tree. +# +# ``DEPENDS`` list of dependency component identifiers in QtIFW_ style. +# +# ``LICENSES`` pair of <display_name> and <file_path> of license text for this +# component. You can specify more then one license. +# +# -------------------------------------------------------------------------- +# +# .. command:: cpack_ifw_configure_component_group +# +# Sets the arguments specific to the CPack IFW generator. +# +# :: +# +# cpack_ifw_configure_component_group(<grpname> +# [VERSION <version>] +# [NAME <name>] +# [SCRIPT <script>] +# [PRIORITY <priority>] +# [LICENSES <display_name> <file_path> ...]) +# +# This command should be called after cpack_add_component_group command. +# +# ``VERSION`` is version of component group. +# By default used :variable:`CPACK_PACKAGE_VERSION`. +# +# ``NAME`` is used to create domain-like identification for this component group. +# By default used origin component group name. +# +# ``SCRIPT`` is relative or absolute path to operations script +# for this component group. +# +# ``PRIORITY`` is priority of the component group in the tree. +# +# ``LICENSES`` pair of <display_name> and <file_path> of license text for this +# component group. You can specify more then one license. +# +# -------------------------------------------------------------------------- +# +# .. command:: cpack_ifw_add_repository +# +# Add QtIFW_ specific remote repository. +# +# :: +# +# cpack_ifw_add_repository(<reponame> [DISABLED] +# URL <url> +# [USERNAME <username>] +# [PASSWORD <password>] +# [DISPLAY_NAME <display_name>]) +# +# This macro will also add the <reponame> repository +# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL` +# +# ``DISABLED`` if set, then the repository will be disabled by default. +# +# ``URL`` is points to a list of available components. +# +# ``USERNAME`` is used as user on a protected repository. +# +# ``PASSWORD`` is password to use on a protected repository. +# +# ``DISPLAY_NAME`` is string to display instead of the URL. +# +# Example usage +# ^^^^^^^^^^^^^ +# +# .. code-block:: cmake +# +# set(CPACK_PACKAGE_NAME "MyPackage") +# set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example") +# set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer +# +# include(CPack) +# include(CPackIFW) +# +# cpack_add_component(myapp +# DISPLAY_NAME "MyApp" +# DESCRIPTION "My Application") +# cpack_ifw_configure_component(myapp +# VERSION "1.2.3" # Version of component +# SCRIPT "operations.qs") +# cpack_add_component(mybigplugin +# DISPLAY_NAME "MyBigPlugin" +# DESCRIPTION "My Big Downloadable Plugin" +# DOWNLOADED) +# cpack_ifw_add_repository(myrepo +# URL "http://example.com/ifw/repo/myapp" +# DISPLAY_NAME "My Application Repository") +# +# +# Online installer +# ^^^^^^^^^^^^^^^^ +# +# By defaul CPack IFW generator make offline installer. This means that all +# components will be packaged into a binary file. +# +# To make a component downloaded, you must set the ``DOWNLOADED`` option in +# :command:`cpack_add_component`. +# +# Then you would use the command :command:`cpack_configure_downloads`. +# If you set ``ALL`` option all components will be downloaded. +# +# You also can use command :command:`cpack_ifw_add_repository` and +# variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration. +# +# CPack IFW generator create "repository" dir in current binary dir. You +# would copy content of this dir to specified ``site`` (``url``). +# +# See Also +# ^^^^^^^^ +# +# Qt Installer Framework Manual: +# +# Index page +# http://qt-project.org/doc/qtinstallerframework/index.html +# +# Component Scripting +# http://qt-project.org/doc/qtinstallerframework/scripting.html +# +# Predefined Variables +# http://qt-project.org/doc/qtinstallerframework/scripting.html#predefined-variables +# +# Download Qt Installer Framework for you platform from Qt Project site: +# http://download.qt-project.org/official_releases/qt-installer-framework/ +# + +#============================================================================= +# Copyright 2014 Kitware, Inc. +# Copyright 2014 Konstantin Podsvirov <konstantin@podsvirov.pro> +# +# 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.) + +#============================================================================= +# Search Qt Installer Framework tools +#============================================================================= + +# Default path + +set(_CPACK_IFW_PATHS + "${QTIFWDIR}" + "$ENV{QTIFWDIR}" + "${QTDIR}" + "$ENV{QTIFWDIR}") +if(WIN32) + list(APPEND _CPACK_IFW_PATHS + "$ENV{HOMEDRIVE}/Qt" + "C:/Qt") +else() + list(APPEND _CPACK_IFW_PATHS + "$ENV{HOME}/Qt" + "/opt/Qt") +endif() + +set(_CPACK_IFW_SUFFIXES + "bin" + "QtIFW-1.7.0/bin" + "QtIFW-1.6.0/bin" + "QtIFW-1.5.0/bin" + "QtIFW-1.4.0/bin" + "QtIFW-1.3.0/bin") + +# Look for 'binarycreator' + +find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE + NAMES binarycreator + PATHS ${_CPACK_IFW_PATHS} + PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES} + DOC "QtIFW binarycreator command line client") + +mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE) + +# Look for 'repogen' + +find_program(CPACK_IFW_REPOGEN_EXECUTABLE + NAMES repogen + PATHS ${_CPACK_IFW_PATHS} + PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES} + DOC "QtIFW repogen command line client" + ) +mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE) + +# +## Next code is included only once +# + +if(NOT CPackIFW_CMake_INCLUDED) +set(CPackIFW_CMake_INCLUDED 1) + +#============================================================================= +# Macro definition +#============================================================================= + +# Macro definition based on CPackComponent + +if(NOT CPackComponent_CMake_INCLUDED) + include(CPackComponent) +endif() + +if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED) + include(CMakeParseArguments) +endif() + +# Resolve full filename for script file +macro(_cpack_ifw_resolve_script _variable) + set(_ifw_script_macro ${_variable}) + set(_ifw_script_file ${${_ifw_script_macro}}) + if(DEFINED ${_ifw_script_macro}) + get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE) + set(_ifw_script_file ${${_ifw_script_macro}}) + if(NOT EXISTS ${_ifw_script_file}) + message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists") + set(${_ifw_script_macro}) + endif() + endif() +endmacro() + +# Resolve full path to lisense file +macro(_cpack_ifw_resolve_lisenses _variable) + if(${_variable}) + set(_ifw_license_file FALSE) + set(_ifw_licenses_fix) + foreach(_ifw_licenses_arg ${${_variable}}) + if(_ifw_license_file) + get_filename_component(_ifw_licenses_arg "${_ifw_licenses_arg}" ABSOLUTE) + set(_ifw_license_file FALSE) + else() + set(_ifw_license_file TRUE) + endif() + list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}") + endforeach(_ifw_licenses_arg) + set(${_variable} "${_ifw_licenses_fix}") + endif() +endmacro() + +# Macro for configure component +macro(cpack_ifw_configure_component compname) + + string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME) + + set(_IFW_OPT COMMON) + set(_IFW_ARGS VERSION SCRIPT NAME PRIORITY) + set(_IFW_MULTI_ARGS DEPENDS LICENSES) + cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) + + _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) + _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES) + + set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n") + + foreach(_IFW_ARG_NAME ${_IFW_OPT}) + cpack_append_option_set_command( + CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWCOMP_STR) + endforeach() + + foreach(_IFW_ARG_NAME ${_IFW_ARGS}) + cpack_append_string_variable_set_command( + CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWCOMP_STR) + endforeach() + + foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) + cpack_append_variable_set_command( + CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWCOMP_STR) + endforeach() + + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWCOMP_STR}") + endif() + +endmacro() + +# Macro for configure group +macro(cpack_ifw_configure_component_group grpname) + + string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME) + + set(_IFW_OPT) + set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY) + set(_IFW_MULTI_ARGS LICENSES) + cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) + + _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT) + _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES) + + set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n") + + foreach(_IFW_ARG_NAME ${_IFW_ARGS}) + cpack_append_string_variable_set_command( + CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWGRP_STR) + endforeach() + + foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) + cpack_append_variable_set_command( + CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWGRP_STR) + endforeach() + + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWGRP_STR}") + endif() +endmacro() + +# Macro for adding repository +macro(cpack_ifw_add_repository reponame) + + string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME) + + set(_IFW_OPT DISABLED) + set(_IFW_ARGS URL USERNAME PASSWORD DISPLAY_NAME) + set(_IFW_MULTI_ARGS) + cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) + + set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\"\n") + + foreach(_IFW_ARG_NAME ${_IFW_OPT}) + cpack_append_option_set_command( + CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWREPO_STR) + endforeach() + + foreach(_IFW_ARG_NAME ${_IFW_ARGS}) + cpack_append_string_variable_set_command( + CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWREPO_STR) + endforeach() + + foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) + cpack_append_variable_set_command( + CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME} + _CPACK_IFWREPO_STR) + endforeach() + + list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame}) + set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n") + + if(CPack_CMake_INCLUDED) + file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}") + endif() + +endmacro() + +endif() # NOT CPackIFW_CMake_INCLUDED diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index efdac20..53f3454 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -10,6 +10,7 @@ # # <flag> - the compiler flag # <var> - variable to store the result +# Will be created as an internal cache variable. # # This internally calls the check_c_source_compiles macro and sets # CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 8721d55..6e80fb5 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -10,6 +10,7 @@ # # <code> - source code to try to compile, must define 'main' # <var> - variable to store whether the source code compiled +# Will be created as an internal cache variable. # <fail-regex> - fail if test output matches this regex # # The following variables may be set before calling this macro to modify @@ -39,7 +40,7 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") + if(NOT DEFINED "${VAR}") set(_FAIL_REGEX) set(_key) foreach(arg ${ARGN}) diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index a4fa57e..0ce423c 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -11,6 +11,7 @@ # <code> - source code to try to compile # <var> - variable to store the result # (1 for success, empty for failure) +# Will be created as an internal cache variable. # # The following variables may be set before calling this macro to modify # the way the check is run: @@ -39,7 +40,7 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") + if(NOT DEFINED "${VAR}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") if(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index 6ce64a1..6d52ec6 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -10,6 +10,7 @@ # # <code> - source code to try to compile, must define 'main' # <var> - variable to store whether the source code compiled +# Will be created as an internal cache variable. # <fail-regex> - fail if test output matches this regex # # The following variables may be set before calling this macro to modify @@ -39,7 +40,7 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") + if(NOT DEFINED "${VAR}") set(_FAIL_REGEX) set(_key) foreach(arg ${ARGN}) diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index c655863..3c06d75 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -11,6 +11,7 @@ # <code> - source code to try to compile # <var> - variable to store the result # (1 for success, empty for failure) +# Will be created as an internal cache variable. # # The following variables may be set before calling this macro to modify # the way the check is run: @@ -39,7 +40,7 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") + if(NOT DEFINED "${VAR}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") if(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake index 0b12289..bd52f61 100644 --- a/Modules/CheckFortranFunctionExists.cmake +++ b/Modules/CheckFortranFunctionExists.cmake @@ -10,6 +10,7 @@ # # FUNCTION - the name of the Fortran function # VARIABLE - variable to store the result +# Will be created as an internal cache variable. # # # diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake new file mode 100644 index 0000000..f90d05b --- /dev/null +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -0,0 +1,111 @@ +#.rst: +# CheckFortranSourceCompiles +# -------------------------- +# +# Check if given Fortran source compiles and links into an executable:: +# +# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>]) +# +# The arguments are: +# +# ``<code>`` +# Source code to try to compile. It must define a PROGRAM entry point. +# ``<var>`` +# Variable to store whether the source code compiled. +# Will be created as an internal cache variable. +# ``<fail-regex>`` +# Fail if test output matches this regex. +# +# The following variables may be set before calling this macro to modify +# the way the check is run:: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + + +macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) + if(NOT DEFINED "${VAR}") + set(_FAIL_REGEX) + set(_key) + foreach(arg ${ARGN}) + if("${arg}" MATCHES "^(FAIL_REGEX)$") + set(_key "${arg}") + elseif(_key) + list(APPEND _${_key} "${arg}") + else() + message(FATAL_ERROR "Unknown argument:\n ${arg}\n") + endif() + endforeach() + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F" + "${SOURCE}\n") + + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() + try_compile(${VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + + foreach(_regex ${_FAIL_REGEX}) + if("${OUTPUT}" MATCHES "${_regex}") + set(${VAR} 0) + endif() + endforeach() + + if(${VAR}) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + 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" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + endif() + endif() +endmacro() diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index bfd1836..d277c32 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -10,6 +10,7 @@ # store the result in a <variable>. This does not verify that any # system header file declares the function, only that it can be found at # link time (consider using CheckSymbolExists). +# <variable> will be created as an internal cache variable. # # The following variables may be set before calling this macro to modify # the way the check is run: @@ -38,7 +39,7 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") if(NOT CMAKE_REQUIRED_QUIET) diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index ea73267..402b37c 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -10,6 +10,7 @@ # # INCLUDE - name of include file # VARIABLE - variable to return result +# Will be created as an internal cache variable. # # # @@ -40,7 +41,7 @@ # License text for the above reference.) macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}") if(CMAKE_REQUIRED_INCLUDES) set(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") else() diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index 39abeff..eae1730 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -14,6 +14,7 @@ # # INCLUDE - name of include file # VARIABLE - variable to return result +# Will be created as an internal cache variable. # # # @@ -44,7 +45,7 @@ # License text for the above reference.) macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") if(CMAKE_REQUIRED_INCLUDES) set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") else() diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 6aa0f2b..2494862 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -12,6 +12,7 @@ # # INCLUDE - list of files to include # VARIABLE - variable to return result +# Will be created as an internal cache variable. # # # @@ -39,7 +40,7 @@ # License text for the above reference.) macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}") set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") if(CMAKE_REQUIRED_INCLUDES) set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}") @@ -53,7 +54,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n") endforeach() set(CMAKE_CONFIGURABLE_FILE_CONTENT - "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n") + "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(void){return 0;}\n") configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 2b41379..95c595a 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -12,6 +12,7 @@ # FUNCTION - the name of the function # LOCATION - location where the library should be found # VARIABLE - variable to store the result +# Will be created as an internal cache variable. # # # @@ -41,7 +42,7 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}") set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") if(NOT CMAKE_REQUIRED_QUIET) diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index fe00074..e203d4c 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -13,6 +13,7 @@ # RETURN - The return value of the function. # HEADER - The header files required. # VARIABLE - The variable to store the result. +# Will be created as an internal cache variable. # # Example: # @@ -56,7 +57,7 @@ get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) - if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$") + if (NOT DEFINED ${_VARIABLE}) set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n") set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS}) diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 880a688..c8949cf 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -70,7 +70,7 @@ ${_INCLUDE_FILES} int main() { ${_STRUCT}* tmp; - tmp->${_MEMBER}; + (void) tmp->${_MEMBER}; return 0; } ") diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index bf2e797..79c5ba7 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -9,6 +9,7 @@ # Check that the <symbol> is available after including given header # <files> and store the result in a <variable>. Specify the list of # files in one argument as a semicolon-separated list. +# <variable> will be created as an internal cache variable. # # If the header files define the symbol as a macro it is considered # available and assumed to work. If the header files declare the symbol @@ -50,7 +51,7 @@ macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) endmacro() macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) if(CMAKE_REQUIRED_LIBRARIES) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 8ce6b88..73ad86e 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -19,6 +19,9 @@ # "0" = type has arch-dependent size (see below) # "" = type does not exist # +# Both ``HAVE_${VARIABLE}`` and ``${VARIABLE}`` will be created as internal +# cache variables. +# # Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor code # to define the macro "${VARIABLE}" to the size of the type, or leave # the macro undefined if the type does not exist. diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 3a7ef13..f3e05e4 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -14,7 +14,7 @@ # # VAR - the name of the variable # VARIABLE - variable to store the result -# +# Will be created as an internal cache variable. # # # This macro is only for C variables. @@ -45,7 +45,7 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) - if("${VARIABLE}" MATCHES "^${VARIABLE}$") + if(NOT DEFINED "${VARIABLE}") set(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") if(NOT CMAKE_REQUIRED_QUIET) diff --git a/Modules/Compiler/ADSP-DetermineCompiler.cmake b/Modules/Compiler/ADSP-DetermineCompiler.cmake index 0b5af0d..0340f69 100644 --- a/Modules/Compiler/ADSP-DetermineCompiler.cmake +++ b/Modules/Compiler/ADSP-DetermineCompiler.cmake @@ -4,7 +4,7 @@ set(_compiler_id_pp_test "defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFI set(_compiler_id_version_compute " #if defined(__VISUALDSPVERSION__) /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8 & 0xFF) #endif") diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake index d293b7b..397f95c 100644 --- a/Modules/Compiler/AppleClang-DetermineCompiler.cmake +++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__) include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake") set(_compiler_id_version_compute "${_compiler_id_version_compute} -# define @PREFIX@COMPILER_VERSION_TWEAK DEC(__apple_build_version__)") +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)") diff --git a/Modules/Compiler/Borland-DetermineCompiler.cmake b/Modules/Compiler/Borland-DetermineCompiler.cmake index 2e8a948..ef3083b 100644 --- a/Modules/Compiler/Borland-DetermineCompiler.cmake +++ b/Modules/Compiler/Borland-DetermineCompiler.cmake @@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__BORLANDC__)") set(_compiler_id_version_compute " /* __BORLANDC__ = 0xVRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__BORLANDC__>>8) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__BORLANDC__ & 0xFF)") diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index bdb6d69..5dd7b4a 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -23,9 +23,12 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++1y") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++1y") +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") +elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() set(CMAKE_CXX_STANDARD_DEFAULT 98) diff --git a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake index 9a37a63..08c1230 100644 --- a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake +++ b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake @@ -1,11 +1,15 @@ set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__clang_major__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__clang_minor__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__clang_major__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__clang_minor__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__clang_patchlevel__) # if defined(_MSC_VER) -# define @PREFIX@SIMULATE_ID \"MSVC\" /* _MSC_VER = VVRR */ -# define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) +# endif") + +set(_compiler_id_simulate " +# if defined(_MSC_VER) +# define @PREFIX@SIMULATE_ID \"MSVC\" # endif") diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake index e4def4d..2265e5e 100644 --- a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake @@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__COMO__)") set(_compiler_id_version_compute " /* __COMO_VERSION__ = VRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)") diff --git a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake index 56fedb1..02e99dc 100644 --- a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake +++ b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__DECC)") set(_compiler_id_version_compute " /* __DECC_VER = VVRRTPPPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECC_VER/10000000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECC_VER/100000 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECC_VER % 10000)") diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake index 5855c24..c7d0565 100644 --- a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__DECCXX)") set(_compiler_id_version_compute " /* __DECCXX_VER = VVRRTPPPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECCXX_VER/10000000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECCXX_VER/100000 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECCXX_VER % 10000)") diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake index 6e4eaf9..881b82c 100644 --- a/Modules/Compiler/Cray-DetermineCompiler.cmake +++ b/Modules/Compiler/Cray-DetermineCompiler.cmake @@ -2,5 +2,5 @@ set(_compiler_id_pp_test "defined(_CRAYC)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_RELEASE) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)") diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index f52d79b..2feedac 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -2,6 +2,6 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)") +# 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)") diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake new file mode 100644 index 0000000..73ee38c --- /dev/null +++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake @@ -0,0 +1,2 @@ + +set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)") diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake index f0c25dd..261f148 100644 --- a/Modules/Compiler/GNU-DetermineCompiler.cmake +++ b/Modules/Compiler/GNU-DetermineCompiler.cmake @@ -2,8 +2,8 @@ set(_compiler_id_pp_test "defined(__GNUC__)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__GNUC__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__) # if defined(__GNUC_PATCHLEVEL__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/HP-C-DetermineCompiler.cmake b/Modules/Compiler/HP-C-DetermineCompiler.cmake index 024a658..4269799 100644 --- a/Modules/Compiler/HP-C-DetermineCompiler.cmake +++ b/Modules/Compiler/HP-C-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__HP_cc)") set(_compiler_id_version_compute " /* __HP_cc = VVRRPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__HP_cc % 100)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_cc/10000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_cc/100 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_cc % 100)") diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake index 6999492..3d4d7e4 100644 --- a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__HP_aCC)") set(_compiler_id_version_compute " /* __HP_aCC = VVRRPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_aCC/10000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_aCC/100 % 100) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_aCC % 100)") diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake index 6169ab4..899e284 100644 --- a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake +++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake @@ -1,6 +1,6 @@ set(_compiler_id_version_compute " /* __IBMC__ = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__IBMC__/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)") diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake index f673d72..73aa2b4 100644 --- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake +++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake @@ -1,6 +1,6 @@ set(_compiler_id_version_compute " /* __IBMCPP__ = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)") diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake index 6fada1c..d7e4532 100644 --- a/Modules/Compiler/Intel-DetermineCompiler.cmake +++ b/Modules/Compiler/Intel-DetermineCompiler.cmake @@ -3,20 +3,24 @@ set(_compiler_id_pp_test "defined(__INTEL_COMPILER) || defined(__ICC)") set(_compiler_id_version_compute " /* __INTEL_COMPILER = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10) # if defined(__INTEL_COMPILER_UPDATE) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE) # else -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER % 10) # endif # if defined(__INTEL_COMPILER_BUILD_DATE) /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ -# define @PREFIX@COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_COMPILER_BUILD_DATE) # endif # if defined(_MSC_VER) -# define @PREFIX@SIMULATE_ID \"MSVC\" /* _MSC_VER = VVRR */ -# define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) -# define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) +# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) +# endif") + +set(_compiler_id_simulate " +# if defined(_MSC_VER) +# define @PREFIX@SIMULATE_ID \"MSVC\" # endif") diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake index 31eb345..9e48553 100644 --- a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake +++ b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake @@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VE set(_compiler_id_version_compute " # if defined(_SGI_COMPILER_VERSION) /* _SGI_COMPILER_VERSION = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10) # else /* _COMPILER_VERSION = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10) # endif") diff --git a/Modules/Compiler/MSVC-DetermineCompiler.cmake b/Modules/Compiler/MSVC-DetermineCompiler.cmake index d462d07..313de89 100644 --- a/Modules/Compiler/MSVC-DetermineCompiler.cmake +++ b/Modules/Compiler/MSVC-DetermineCompiler.cmake @@ -3,17 +3,17 @@ set(_compiler_id_pp_test "defined(_MSC_VER)") set(_compiler_id_version_compute " /* _MSC_VER = VVRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100) # if defined(_MSC_FULL_VER) # if _MSC_VER >= 1400 /* _MSC_FULL_VER = VVRRPPPPP */ -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 100000) # else /* _MSC_FULL_VER = VVRRPPPP */ -# define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 10000) # endif # endif # if defined(_MSC_BUILD) -# define @PREFIX@COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(_MSC_BUILD) # endif") diff --git a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake index 6d416c1..2ed116c 100644 --- a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake +++ b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake @@ -3,8 +3,8 @@ set(_compiler_id_pp_test "defined(__WATCOMC__)") set(_compiler_id_version_compute " /* __WATCOMC__ = VVRP + 1100 */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__WATCOMC__ - 1100) / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10) # if (__WATCOMC__ % 10) > 0 -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10) # endif") diff --git a/Modules/Compiler/PGI-DetermineCompiler.cmake b/Modules/Compiler/PGI-DetermineCompiler.cmake index 8e68bd6..8d3dc9c 100644 --- a/Modules/Compiler/PGI-DetermineCompiler.cmake +++ b/Modules/Compiler/PGI-DetermineCompiler.cmake @@ -2,8 +2,8 @@ set(_compiler_id_pp_test "defined(__PGI)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__PGIC__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PGIC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PGIC_MINOR__) # if defined(__PGIC_PATCHLEVEL__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PGIC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/PathScale-DetermineCompiler.cmake b/Modules/Compiler/PathScale-DetermineCompiler.cmake index 3335e26..4eb81de 100644 --- a/Modules/Compiler/PathScale-DetermineCompiler.cmake +++ b/Modules/Compiler/PathScale-DetermineCompiler.cmake @@ -2,8 +2,8 @@ set(_compiler_id_pp_test "defined(__PATHCC__)") set(_compiler_id_version_compute " -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__PATHCC__) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PATHCC__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PATHCC_MINOR__) # if defined(__PATHCC_PATCHLEVEL__) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PATHCC_PATCHLEVEL__) # endif") diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake new file mode 100644 index 0000000..ae4a2f4 --- /dev/null +++ b/Modules/Compiler/QCC-C.cmake @@ -0,0 +1,2 @@ +include(Compiler/QCC) +__compiler_qcc(C) diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake new file mode 100644 index 0000000..a676bbe --- /dev/null +++ b/Modules/Compiler/QCC-CXX.cmake @@ -0,0 +1,12 @@ +include(Compiler/QCC) +__compiler_qcc(CXX) + +# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the +# default for the driver is not c++. +set(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") + +set(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> -lang-c++ <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + +set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden") diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake new file mode 100644 index 0000000..76477e4 --- /dev/null +++ b/Modules/Compiler/QCC.cmake @@ -0,0 +1,24 @@ + +#============================================================================= +# Copyright 2002-2014 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.) +include(Compiler/GNU) + +macro(__compiler_qcc lang) + __compiler_gnu(${lang}) + + # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples + set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") + + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>") +endmacro() diff --git a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake index 8fe60d9..1d7dd78 100644 --- a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake +++ b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake @@ -5,6 +5,6 @@ set(_compiler_id_pp_test "defined(SDCC)") set(_compiler_id_version_compute " /* SDCC = VRP */ -# define COMPILER_VERSION_MAJOR DEC(SDCC/100) -# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) -# define COMPILER_VERSION_PATCH DEC(SDCC % 10)") +# define COMPILER_VERSION_MAJOR @MACRO_DEC@(SDCC/100) +# define COMPILER_VERSION_MINOR @MACRO_DEC@(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH @MACRO_DEC@(SDCC % 10)") diff --git a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake index 7db1a97..e9d7457 100644 --- a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake +++ b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake @@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(__SUNPRO_C)") set(_compiler_id_version_compute " # if __SUNPRO_C >= 0x5100 /* __SUNPRO_C = 0xVRRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>12) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xFF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF) # else /* __SUNPRO_CC = 0xVRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>8) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C & 0xF) # endif") diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake index 0a48cc6..5c23a95 100644 --- a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake @@ -4,12 +4,12 @@ set(_compiler_id_pp_test "defined(__SUNPRO_CC)") set(_compiler_id_version_compute " # if __SUNPRO_CC >= 0x5100 /* __SUNPRO_CC = 0xVRRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>12) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xFF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF) # else /* __SUNPRO_CC = 0xVRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) -# define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) -# define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>8) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xF) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC & 0xF) # endif") diff --git a/Modules/Compiler/TI-DetermineCompiler.cmake b/Modules/Compiler/TI-DetermineCompiler.cmake index 1856c9b..19aa9e3 100644 --- a/Modules/Compiler/TI-DetermineCompiler.cmake +++ b/Modules/Compiler/TI-DetermineCompiler.cmake @@ -3,6 +3,6 @@ set(_compiler_id_pp_test "defined(__TI_COMPILER_VERSION__)") set(_compiler_id_version_compute " /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) -# define @PREFIX@COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)") +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000000) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000 % 1000) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__TI_COMPILER_VERSION__ % 1000)") diff --git a/Modules/Compiler/Watcom-DetermineCompiler.cmake b/Modules/Compiler/Watcom-DetermineCompiler.cmake index cc59abf..153e350 100644 --- a/Modules/Compiler/Watcom-DetermineCompiler.cmake +++ b/Modules/Compiler/Watcom-DetermineCompiler.cmake @@ -3,8 +3,8 @@ set(_compiler_id_pp_test "defined(__WATCOMC__) && __WATCOMC__ < 1200") set(_compiler_id_version_compute " /* __WATCOMC__ = VVRR */ -# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define @PREFIX@COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__WATCOMC__ / 100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10) # if (__WATCOMC__ % 10) > 0 -# define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10) # endif") diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index 1a7a539..a17d03d 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -10,6 +10,9 @@ <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid> <RootNamespace>CompilerId@id_lang@</RootNamespace> <Keyword>Win32Proj</Keyword> + @id_system@ + @id_system_version@ + @id_WindowsSDKDesktopARMSupport@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration"> diff --git a/Modules/CompilerId/VS-NsightTegra.vcxproj.in b/Modules/CompilerId/VS-NsightTegra.vcxproj.in new file mode 100644 index 0000000..b7389eb --- /dev/null +++ b/Modules/CompilerId/VS-NsightTegra.vcxproj.in @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="NsightTegraProject"> + <NsightTegraProjectRevisionNumber>6</NsightTegraProjectRevisionNumber> + </PropertyGroup> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|@id_platform@"> + <Configuration>Debug</Configuration> + <Platform>@id_platform@</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid> + <RootNamespace>CompilerId@id_lang@</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + @id_toolset@ + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">.\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'"> + <ClCompile> + <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + </Link> + <PostBuildEvent> + <Command> +if "$(ToolchainName)"=="gcc" ( + for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_gcc@.exe) do ( + @echo CMAKE_@id_lang@_COMPILER=%%i + goto :done + ) +) +if "$(ToolchainName)"=="clang" ( + for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_clang@.exe) do ( + @echo CMAKE_@id_lang@_COMPILER=%%i + goto :done + ) +) +:done +</Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="@id_src@" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> +</Project> diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index eabfc6b..aebae27 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -29,7 +29,7 @@ ); name = CompilerId@id_lang@; productName = CompilerId@id_lang@; - productType = "com.apple.product-type.tool"; + productType = "@id_product_type@"; }; 08FB7793FE84155DC02AAC07 = { isa = PBXProject; @@ -81,6 +81,7 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ONLY_ACTIVE_ARCH = YES; + @id_code_sign_identity@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; SYMROOT = .; @id_toolset@ diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 68fadf6..37a0a40 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -37,6 +37,9 @@ ConfigureCommand: "@CMAKE_COMMAND@" "@PROJECT_SOURCE_DIR@" MakeCommand: @MAKECOMMAND@ DefaultCTestConfigurationType: @DEFAULT_CTEST_CONFIGURATION_TYPE@ +# version control +UpdateVersionOnly: @CTEST_UPDATE_VERSION_ONLY@ + # CVS options # Default is "-d -P -A" CVSCommand: @CVSCOMMAND@ @@ -71,6 +74,8 @@ Compiler: @CMAKE_CXX_COMPILER@ PurifyCommand: @PURIFYCOMMAND@ ValgrindCommand: @VALGRIND_COMMAND@ ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@ +MemoryCheckType: @MEMORYCHECK_TYPE@ +MemoryCheckSanitizerOptions: @MEMORYCHECK_SANITIZER_OPTIONS@ MemoryCheckCommand: @MEMORYCHECK_COMMAND@ MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@ MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@ diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index 9b31567..b1a2370 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -37,7 +37,8 @@ # # :: # -# FIXUP_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>]) +# FIXUP_QT4_EXECUTABLE(<executable> +# [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>]) # # Copies Qt plugins, writes a Qt configuration file (if needed) and # fixes up a Qt4 executable using BundleUtilities so it is standalone @@ -63,7 +64,8 @@ # # :: # -# INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var <plugins_dir> <component> <configurations>) +# INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var +# <plugins_dir> <component> <configurations>) # # Install (or copy) a resolved <plugin> to the default plugins directory # (or <plugins_dir>) relative to <executable> and store the result in @@ -77,7 +79,8 @@ # # :: # -# INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var <plugins_dir> <component>) +# INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var +# <plugins_dir> <component>) # # Install (or copy) an unresolved <plugin> to the default plugins # directory (or <plugins_dir>) relative to <executable> and store the @@ -86,7 +89,8 @@ # # :: # -# INSTALL_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>]) +# INSTALL_QT4_EXECUTABLE(<executable> +# [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>]) # # Installs Qt plugins, writes a Qt configuration file (if needed) and # fixes up a Qt4 executable using BundleUtilities so it is standalone diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 73a4990..79bb064 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -76,7 +76,7 @@ # SHA512 .sha512 US Secure Hash Algorithms, RFC 4634 # # Note that the hashes are used only for unique data identification and -# download verification. This is not security software. +# download verification. # # Example usage: # diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0d35cca..d6a6b72 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -26,7 +26,7 @@ # [CVS_MODULE mod] # Module to checkout from CVS repo # [CVS_TAG tag] # Tag to checkout from CVS repo # [SVN_REPOSITORY url] # URL of Subversion repo -# [SVN_REVISION rev] # Revision to checkout from Subversion repo +# [SVN_REVISION -r<rev>] # Revision to checkout from Subversion repo # [SVN_USERNAME john ] # Username for Subversion checkout and update # [SVN_PASSWORD doe ] # Password for Subversion checkout and update # [SVN_TRUST_CERT 1 ] # Trust the Subversion server site certificate @@ -49,6 +49,7 @@ # [CONFIGURE_COMMAND cmd...] # Build tree configuration command # [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable # [CMAKE_GENERATOR gen] # Specify generator for native build +# [CMAKE_GENERATOR_PLATFORM p] # Generator-specific platform name # [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name # [CMAKE_ARGS args...] # Arguments to CMake command line # [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on @@ -239,7 +240,7 @@ function(_ep_parse_arguments f name ns args) set(is_value 1) if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND - NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND + NOT (("x${arg}x" STREQUAL "x${key}x") AND ("x${key}x" STREQUAL "xCOMMANDx")) AND NOT arg MATCHES "^(TRUE|FALSE)$") if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}") set(is_value 0) @@ -627,11 +628,6 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p set(show_progress "SHOW_PROGRESS") endif() - if("${hash}" MATCHES "${_ep_hash_regex}") - set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) - else() - set(hash_args "# no EXPECTED_HASH") - endif() # check for curl globals in the project if(DEFINED CMAKE_TLS_VERIFY) set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") @@ -667,7 +663,6 @@ file(DOWNLOAD \"${remote}\" \"${local}\" ${show_progress} - ${hash_args} ${timeout_args} STATUS status LOG log) @@ -711,6 +706,7 @@ Retrying download. file(REMOVE \"\${file}\") execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\") endif() + math(EXPR attempt \"\${attempt} + 1\") endwhile() if(\${succeeded}) @@ -737,7 +733,7 @@ endfunction() function(_ep_write_extractfile_script script_filename name filename directory) set(args "") - if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$") + if(filename MATCHES "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") set(args xfz) endif() @@ -746,7 +742,7 @@ function(_ep_write_extractfile_script script_filename name filename directory) endif() if(args STREQUAL "") - message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip") + message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip") return() endif() @@ -1540,11 +1536,11 @@ function(_ep_add_download_command name) if("x${fname}" STREQUAL "x") string(REGEX MATCH "[^/\\?]*$" fname "${url}") endif() - if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") - string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}") + if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") + string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}") set(fname "${CMAKE_MATCH_1}") endif() - if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") + if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() string(REPLACE ";" "-" fname "${fname}") @@ -1757,9 +1753,13 @@ function(_ep_add_configure_command name) endif() get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) + get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM) get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET) if(cmake_generator) list(APPEND cmd "-G${cmake_generator}") + if(cmake_generator_platform) + list(APPEND cmd "-A${cmake_generator_platform}") + endif() if(cmake_generator_toolset) list(APPEND cmd "-T${cmake_generator_toolset}") endif() @@ -1769,6 +1769,12 @@ function(_ep_add_configure_command name) else() list(APPEND cmd "-G${CMAKE_GENERATOR}") endif() + if(cmake_generator_platform) + message(FATAL_ERROR "Option CMAKE_GENERATOR_PLATFORM not allowed without CMAKE_GENERATOR.") + endif() + if(CMAKE_GENERATOR_PLATFORM) + list(APPEND cmd "-A${CMAKE_GENERATOR_PLATFORM}") + endif() if(cmake_generator_toolset) message(FATAL_ERROR "Option CMAKE_GENERATOR_TOOLSET not allowed without CMAKE_GENERATOR.") endif() diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 12ea384..37bc6b5 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -55,21 +55,32 @@ # The WHAT option is the only mandatory option. Here you specify what # information will be printed: # -# :: -# -# ALL: print everything -# ENABLED_FEATURES: the list of all features which are enabled -# DISABLED_FEATURES: the list of all features which are disabled -# PACKAGES_FOUND: the list of all packages which have been found -# PACKAGES_NOT_FOUND: the list of all packages which have not been found -# OPTIONAL_PACKAGES_FOUND: only those packages which have been found which have the type OPTIONAL -# OPTIONAL_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type OPTIONAL -# RECOMMENDED_PACKAGES_FOUND: only those packages which have been found which have the type RECOMMENDED -# RECOMMENDED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RECOMMENDED -# REQUIRED_PACKAGES_FOUND: only those packages which have been found which have the type REQUIRED -# REQUIRED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type REQUIRED -# RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME -# RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME +# ``ALL`` +# print everything +# ``ENABLED_FEATURES`` +# the list of all features which are enabled +# ``DISABLED_FEATURES`` +# the list of all features which are disabled +# ``PACKAGES_FOUND`` +# the list of all packages which have been found +# ``PACKAGES_NOT_FOUND`` +# the list of all packages which have not been found +# ``OPTIONAL_PACKAGES_FOUND`` +# only those packages which have been found which have the type OPTIONAL +# ``OPTIONAL_PACKAGES_NOT_FOUND`` +# only those packages which have not been found which have the type OPTIONAL +# ``RECOMMENDED_PACKAGES_FOUND`` +# only those packages which have been found which have the type RECOMMENDED +# ``RECOMMENDED_PACKAGES_NOT_FOUND`` +# only those packages which have not been found which have the type RECOMMENDED +# ``REQUIRED_PACKAGES_FOUND`` +# only those packages which have been found which have the type REQUIRED +# ``REQUIRED_PACKAGES_NOT_FOUND`` +# only those packages which have not been found which have the type REQUIRED +# ``RUNTIME_PACKAGES_FOUND`` +# only those packages which have been found which have the type RUNTIME +# ``RUNTIME_PACKAGES_NOT_FOUND`` +# only those packages which have not been found which have the type RUNTIME # # With the exception of the ``ALL`` value, these values can be combined # in order to customize the output. For example: @@ -118,10 +129,11 @@ # # :: # -# SET_PACKAGE_PROPERTIES(<name> PROPERTIES [ URL <url> ] -# [ DESCRIPTION <description> ] -# [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ] -# [ PURPOSE <purpose> ] +# SET_PACKAGE_PROPERTIES(<name> PROPERTIES +# [ URL <url> ] +# [ DESCRIPTION <description> ] +# [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ] +# [ PURPOSE <purpose> ] # ) # # @@ -171,26 +183,30 @@ # :: # # find_package(LibXml2) -# set_package_properties(LibXml2 PROPERTIES DESCRIPTION "A XML processing library." -# URL "http://xmlsoft.org/") +# set_package_properties(LibXml2 PROPERTIES +# DESCRIPTION "A XML processing library." +# URL "http://xmlsoft.org/") # # # # :: # -# set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED -# PURPOSE "Enables HTML-import in MyWordProcessor") +# set_package_properties(LibXml2 PROPERTIES +# TYPE RECOMMENDED +# PURPOSE "Enables HTML-import in MyWordProcessor") # ... -# set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL -# PURPOSE "Enables odt-export in MyWordProcessor") +# set_package_properties(LibXml2 PROPERTIES +# TYPE OPTIONAL +# PURPOSE "Enables odt-export in MyWordProcessor") # # # # :: # # find_package(DBUS) -# set_package_properties(DBUS PROPERTIES TYPE RUNTIME -# PURPOSE "Necessary to disable the screensaver during a presentation" ) +# set_package_properties(DBUS PROPERTIES +# TYPE RUNTIME +# PURPOSE "Necessary to disable the screensaver during a presentation" ) # # # diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake index 5620661..cb4f60a 100644 --- a/Modules/FindBacktrace.cmake +++ b/Modules/FindBacktrace.cmake @@ -5,18 +5,24 @@ # Find provider for backtrace(3). # # Checks if OS supports backtrace(3) via either libc or custom library. -# This module defines the following variables:: +# This module defines the following variables: # -# Backtrace_HEADER - The header file needed for backtrace(3). Cached. -# Could be forcibly set by user. -# Backtrace_INCLUDE_DIRS - The include directories needed to use backtrace(3) header. -# Backtrace_LIBRARIES - The libraries (linker flags) needed to use backtrace(3), if any. -# Backtrace_FOUND - Is set if and only if backtrace(3) support detected. +# ``Backtrace_HEADER`` +# The header file needed for backtrace(3). Cached. +# Could be forcibly set by user. +# ``Backtrace_INCLUDE_DIRS`` +# The include directories needed to use backtrace(3) header. +# ``Backtrace_LIBRARIES`` +# The libraries (linker flags) needed to use backtrace(3), if any. +# ``Backtrace_FOUND`` +# Is set if and only if backtrace(3) support detected. # -# The following cache variables are also available to set or use:: +# The following cache variables are also available to set or use: # -# Backtrace_LIBRARY - The external library providing backtrace, if any. -# Backtrace_INCLUDE_DIR - The directory holding the backtrace(3) header. +# ``Backtrace_LIBRARY`` +# The external library providing backtrace, if any. +# ``Backtrace_INCLUDE_DIR`` +# The directory holding the backtrace(3) header. # # Typical usage is to generate of header file using configure_file() with the # contents like the following:: @@ -44,7 +50,7 @@ include(CMakePushCheckState) include(CheckSymbolExists) -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) # List of variables to be provided to find_package_handle_standard_args() set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index dfd4460..3642b3e 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -375,14 +375,16 @@ endfunction() # Guesses Boost's compiler prefix used in built library names # Returns the guess by setting the variable pointed to by _ret function(_Boost_GUESS_COMPILER_PREFIX _ret) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" + OR CMAKE_CXX_COMPILER MATCHES "icl" + OR CMAKE_CXX_COMPILER MATCHES "icpc") if(WIN32) set (_boost_COMPILER "-iw") else() set (_boost_COMPILER "-il") endif() + elseif (MSVC14) + set(_boost_COMPILER "-vc140") elseif (MSVC12) set(_boost_COMPILER "-vc120") elseif (MSVC11) @@ -401,7 +403,7 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) set(_boost_COMPILER "-vc6") # yes, this is correct elseif (BORLAND) set(_boost_COMPILER "-bcb") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") set(_boost_COMPILER "-sw") elseif (MINGW) if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index d9809ad..3dd975c 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -452,7 +452,17 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") if(CMAKE_GENERATOR MATCHES "Visual Studio") set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") else() - set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") + # Using cc which is symlink to clang may let NVCC think it is GCC and issue + # unhandled -dumpspecs option to clang. Also in case neither + # CMAKE_C_COMPILER is defined (project does not use C language) nor + # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let + # nvcc use its own default C compiler. + if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER) + get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH) + else() + set(c_compiler_realpath "") + endif() + set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC") endif() # Propagate the host flags to the host compiler via -Xcompiler @@ -693,18 +703,6 @@ if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) else() set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) endif() -if(APPLE) - # We need to add the path to cudart to the linker using rpath, since the - # library name for the cuda libraries is prepended with @rpath. - if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY) - get_filename_component(_cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH) - else() - get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH) - endif() - if(_cuda_path_to_cudart) - list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}") - endif() -endif() # 1.1 toolkit on linux doesn't appear to have a separate library on # some platforms. @@ -884,15 +882,15 @@ macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options) set( ${_options} ) set( _found_options FALSE ) foreach(arg ${ARGN}) - if(arg STREQUAL "OPTIONS") + if("x${arg}" STREQUAL "xOPTIONS") set( _found_options TRUE ) elseif( - arg STREQUAL "WIN32" OR - arg STREQUAL "MACOSX_BUNDLE" OR - arg STREQUAL "EXCLUDE_FROM_ALL" OR - arg STREQUAL "STATIC" OR - arg STREQUAL "SHARED" OR - arg STREQUAL "MODULE" + "x${arg}" STREQUAL "xWIN32" OR + "x${arg}" STREQUAL "xMACOSX_BUNDLE" OR + "x${arg}" STREQUAL "xEXCLUDE_FROM_ALL" OR + "x${arg}" STREQUAL "xSTATIC" OR + "x${arg}" STREQUAL "xSHARED" OR + "x${arg}" STREQUAL "xMODULE" ) list(APPEND ${_cmake_options} ${arg}) else() @@ -1422,7 +1420,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options # If -ccbin, --compiler-bindir has been specified, don't do anything. Otherwise add it here. list( FIND nvcc_flags "-ccbin" ccbin_found0 ) list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 ) - if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) + if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER ) list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"") endif() # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index f0aac84..abdd307 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -62,7 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path set(CUDA_make2cmake "@CUDA_make2cmake@") # path set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path set(build_cubin @build_cubin@) # bool -set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool +set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path # We won't actually use these variables for now, but we need to set this, in # order to force this file to be run again if it changes. set(generated_file_path "@generated_file_path@") # path @@ -106,7 +106,7 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) # Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) -if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) +if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER ) if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) set(CCBIN -ccbin "${CCBIN}") else() @@ -126,7 +126,7 @@ endif() # and other return variables are present after executing the process. macro(cuda_execute_process status command) set(_command ${command}) - if(NOT _command STREQUAL "COMMAND") + if(NOT "x${_command}" STREQUAL "xCOMMAND") message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})") endif() if(verbose) diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 9b633c7..0184c39 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -2,28 +2,43 @@ # FindCurses # ---------- # -# Find the curses include file and library +# Find the curses or ncurses include file and library. # +# Result Variables +# ^^^^^^^^^^^^^^^^ # +# This module defines the following variables: # -# :: +# ``CURSES_FOUND`` +# True if Curses is found. +# ``CURSES_INCLUDE_DIRS`` +# The include directories needed to use Curses. +# ``CURSES_LIBRARIES`` +# The libraries needed to use Curses. +# ``CURSES_HAVE_CURSES_H`` +# True if curses.h is available. +# ``CURSES_HAVE_NCURSES_H`` +# True if ncurses.h is available. +# ``CURSES_HAVE_NCURSES_NCURSES_H`` +# True if ``ncurses/ncurses.h`` is available. +# ``CURSES_HAVE_NCURSES_CURSES_H`` +# True if ``ncurses/curses.h`` is available. # -# CURSES_FOUND - system has Curses -# CURSES_INCLUDE_DIR - the Curses include directory -# CURSES_LIBRARIES - The libraries needed to use Curses -# CURSES_HAVE_CURSES_H - true if curses.h is available -# CURSES_HAVE_NCURSES_H - true if ncurses.h is available -# CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available -# CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available -# CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake +# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the +# ``find_package(Curses)`` call if NCurses functionality is required. # +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # +# The following variable are provided for backward compatibility: # -# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if -# NCurses functionality is required. +# ``CURSES_INCLUDE_DIR`` +# Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead. +# ``CURSES_LIBRARY`` +# Path to Curses library. Use ``CURSES_LIBRARIES`` instead. #============================================================================= -# Copyright 2001-2009 Kitware, Inc. +# Copyright 2001-2014 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -84,59 +99,27 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) endif() - -if(NOT CURSES_USE_NCURSES) - find_file(CURSES_HAVE_CURSES_H curses.h ) - find_path(CURSES_CURSES_H_PATH curses.h ) - get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) - get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - - # for compatibility with older FindCurses.cmake this has to be in the cache - # FORCE must not be used since this would break builds which preload a cache wqith these variables set - set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}" - CACHE FILEPATH "The curses include path") - set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}" - CACHE FILEPATH "The curses library") -else() -# we need to find ncurses +if(CURSES_USE_NCURSES) get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH) get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) - find_file(CURSES_HAVE_NCURSES_H ncurses.h) - find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h) - find_file(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h) - find_file(CURSES_HAVE_CURSES_H curses.h - HINTS "${_cursesParentDir}/include") - - find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h - ncurses/curses.h) - find_path(CURSES_NCURSES_INCLUDE_PATH curses.h - HINTS "${_cursesParentDir}/include") - - # for compatibility with older FindCurses.cmake this has to be in the cache - # FORCE must not be used since this would break builds which preload - # however if the value of the variable has NOTFOUND in it, then - # it is OK to force, and we need to force in order to have it work. - # a cache wqith these variables set - # only put ncurses include and library into - # variables if they are found - if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H) - get_filename_component(CURSES_NCURSES_INCLUDE_PATH - "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH) + # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility. + if(CURSES_NCURSES_INCLUDE_PATH) + find_path(CURSES_INCLUDE_PATH + NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h + PATHS ${CURSES_NCURSES_INCLUDE_PATH} + NO_DEFAULT_PATH + ) endif() - if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY) - set( FORCE_IT ) - if(CURSES_INCLUDE_PATH MATCHES NOTFOUND) - set(FORCE_IT FORCE) - endif() - set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}" - CACHE FILEPATH "The curses include path" ${FORCE_IT}) - set( FORCE_IT) - if(CURSES_LIBRARY MATCHES NOTFOUND) - set(FORCE_IT FORCE) - endif() - set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}" - CACHE FILEPATH "The curses library" ${FORCE_IT}) + + find_path(CURSES_INCLUDE_PATH + NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h + HINTS "${_cursesParentDir}/include" + ) + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}") endif() CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}" @@ -147,6 +130,52 @@ else() CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}" cbreak "" CURSES_TINFO_HAS_CBREAK) endif() +else() + get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH) + get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH) + + find_path(CURSES_INCLUDE_PATH + NAMES curses.h + HINTS "${_cursesParentDir}/include" + ) + + # Previous versions of FindCurses provided these values. + if(NOT DEFINED CURSES_CURSES_H_PATH) + set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}") + endif() + if(NOT DEFINED CURSES_LIBRARY) + set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}") + endif() +endif() + +# Report whether each possible header name exists in the include directory. +if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") + set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h") + else() + set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h") + set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h") + else() + set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_NCURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h") + set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h") + else() + set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND") + endif() +endif() +if(NOT DEFINED CURSES_HAVE_CURSES_H) + if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h") + set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h") + else() + set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND") + endif() endif() if (NOT CURSES_TINFO_HAS_CBREAK) @@ -157,11 +186,10 @@ endif() find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}") find_library(CURSES_FORM_LIBRARY form ) -# for compatibility with older FindCurses.cmake this has to be in the cache -# FORCE must not be used since this would break builds which preload a cache -# qith these variables set -set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}" - CACHE FILEPATH "The curses form library") +# Previous versions of FindCurses provided these values. +if(NOT DEFINED FORM_LIBRARY) + set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}") +endif() # Need to provide the *_LIBRARIES set(CURSES_LIBRARIES ${CURSES_LIBRARY}) @@ -174,8 +202,9 @@ if(CURSES_FORM_LIBRARY) set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY}) endif() -# Proper name is *_INCLUDE_DIR -set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) +# Provide the *_INCLUDE_DIRS result. +set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH}) +set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if # all listed variables are TRUE @@ -185,18 +214,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG mark_as_advanced( CURSES_INCLUDE_PATH - CURSES_LIBRARY - CURSES_CURSES_INCLUDE_PATH CURSES_CURSES_LIBRARY - CURSES_NCURSES_INCLUDE_PATH CURSES_NCURSES_LIBRARY CURSES_EXTRA_LIBRARY - FORM_LIBRARY - CURSES_LIBRARIES - CURSES_INCLUDE_DIR - CURSES_CURSES_HAS_WSYNCUP - CURSES_NCURSES_HAS_WSYNCUP - CURSES_NCURSES_HAS_CBREAK - CURSES_TINFO_HAS_CBREAK ) - diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake index 497a80c..f42182f 100644 --- a/Modules/FindGLEW.cmake +++ b/Modules/FindGLEW.cmake @@ -4,6 +4,15 @@ # # Find the OpenGL Extension Wrangler Library (GLEW) # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``, +# if GLEW has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# # This module defines the following variables: # # :: @@ -35,4 +44,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) +if(GLEW_FOUND AND NOT TARGET GLEW::GLEW) + add_library(GLEW::GLEW UNKNOWN IMPORTED) + set_target_properties(GLEW::GLEW PROPERTIES + IMPORTED_LOCATION "${GLEW_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}") +endif() + mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake index be7c0cd..c9f7597 100644 --- a/Modules/FindGLUT.cmake +++ b/Modules/FindGLUT.cmake @@ -2,7 +2,20 @@ # FindGLUT # -------- # -# try to find glut library and include files +# try to find glut library and include files. +# +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the :prop_tgt:`IMPORTED` targets: +# +# ``GLUT::GLUT`` +# Defined if the system has GLUT. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module sets the following variables: # # :: # @@ -42,13 +55,21 @@ if (WIN32) else () if (APPLE) - # These values for Apple could probably do with improvement. - find_path( GLUT_INCLUDE_DIR glut.h - /System/Library/Frameworks/GLUT.framework/Versions/A/Headers - ${OPENGL_LIBRARY_DIR} - ) - set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") - set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX") + find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR}) + find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX") + find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX") + + if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa) + add_library(GLUT::Cocoa UNKNOWN IMPORTED) + # Cocoa should always be a Framework, but we check to make sure. + if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(GLUT::Cocoa PROPERTIES + IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(GLUT::Cocoa PROPERTIES + IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}") + endif() + endif() else () if (BEOS) @@ -66,6 +87,18 @@ else () /usr/openwin/lib ) + if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi) + add_library(GLUT::Xi UNKNOWN IMPORTED) + set_target_properties(GLUT::Xi PROPERTIES + IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}") + endif() + + if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu) + add_library(GLUT::Xmu UNKNOWN IMPORTED) + set_target_properties(GLUT::Xmu PROPERTIES + IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}") + endif() + endif () find_path( GLUT_INCLUDE_DIR GL/glut.h @@ -102,6 +135,34 @@ if (GLUT_FOUND) ${GLUT_cocoa_LIBRARY} ) + if(NOT TARGET GLUT::GLUT) + add_library(GLUT::GLUT UNKNOWN IMPORTED) + set_target_properties(GLUT::GLUT PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}") + if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$") + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}") + else() + set_target_properties(GLUT::GLUT PROPERTIES + IMPORTED_LOCATION "${GLUT_glut_LIBRARY}") + endif() + + if(TARGET GLUT::Xmu) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu) + endif() + + if(TARGET GLUT::Xi) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi) + endif() + + if(TARGET GLUT::Cocoa) + set_property(TARGET GLUT::GLUT APPEND + PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa) + endif() + endif() + #The following deprecated settings are for backwards compatibility with CMake1.4 set (GLUT_LIBRARY ${GLUT_LIBRARIES}) set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index eaa5e55..72bb8eb 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -527,7 +527,7 @@ function(_GTK2_ADD_TARGET _var) set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") endif() - if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR") + if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}") set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") endif() @@ -540,7 +540,11 @@ function(_GTK2_ADD_TARGET _var) endif() if(_${_var}_OPTIONAL_INCLUDES) - _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_OPTIONAL_INCLUDES}) + foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) + if(_D) + _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) + endif() + endforeach() endif() if(GTK2_USE_IMPORTED_TARGETS) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 7ab867b..16478cb 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -26,7 +26,7 @@ # ALL option is used, the translations will also be created when # building the default target. # -# GETTEXT_PROCESS_POT( <potfile> [ALL] [INSTALL_DESTINATION <destdir>] +# GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>] # LANGUAGES <lang1> <lang2> ... ) # # :: diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake index c418afd..34d763e 100644 --- a/Modules/FindHg.cmake +++ b/Modules/FindHg.cmake @@ -66,7 +66,11 @@ if(HG_EXECUTABLE) execute_process(COMMAND ${HG_EXECUTABLE} --version OUTPUT_VARIABLE hg_version ERROR_QUIET + RESULT_VARIABLE hg_result OUTPUT_STRIP_TRAILING_WHITESPACE) + if(hg_result MATCHES "is not a valid Win32 application") + set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND") + endif() if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)") set(HG_VERSION_STRING "${CMAKE_MATCH_1}") endif() diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake deleted file mode 100644 index c9d39eb..0000000 --- a/Modules/FindITK.cmake +++ /dev/null @@ -1,61 +0,0 @@ -#.rst: -# FindITK -# ------- -# -# Find an ITK installation or build tree. - -# When ITK is found, the ITKConfig.cmake file is sourced to setup the -# location and configuration of ITK. Please read this file, or -# ITKConfig.cmake.in from the ITK source tree for the full list of -# definitions. Of particular interest is ITK_USE_FILE, a CMake source file -# that can be included to set the include directories, library directories, -# and preprocessor macros. In addition to the variables read from -# ITKConfig.cmake, this find module also defines -# ITK_DIR - The directory containing ITKConfig.cmake. -# This is either the root of the build tree, -# or the lib/InsightToolkit directory. -# This is the only cache entry. -# -# ITK_FOUND - Whether ITK was found. If this is true, -# ITK_DIR is okay. -# -# USE_ITK_FILE - The full path to the UseITK.cmake file. -# This is provided for backward -# compatibility. Use ITK_USE_FILE -# instead. - -#============================================================================= -# Copyright 2001-2010 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# Use the Config mode of the find_package() command to find ITKConfig. -# If this succeeds (possibly because ITK_DIR is already set), the -# command will have already loaded ITKConfig.cmake and set ITK_FOUND. -if(NOT ITK_FOUND) - set(_ITK_REQUIRED "") - if(ITK_FIND_REQUIRED) - set(_ITK_REQUIRED REQUIRED) - endif() - set(_ITK_QUIET "") - if(ITK_FIND_QUIETLY) - set(_ITK_QUIET QUIET) - endif() - find_package(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE - NAMES ITK InsightToolkit - CONFIGS ITKConfig.cmake - ) -endif() - -if(ITK_FOUND) - # Set USE_ITK_FILE for backward-compatibility. - set(USE_ITK_FILE ${ITK_USE_FILE}) -endif() diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake new file mode 100644 index 0000000..55528b8 --- /dev/null +++ b/Modules/FindIce.cmake @@ -0,0 +1,393 @@ +#.rst: +# FindIce +# ------- +# +# Find the ZeroC Internet Communication Engine (ICE) programs, +# libraries and datafiles. +# +# This module supports multiple components. +# Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``, +# ``IceBox``, ``IceDB``, ``IceGrid``, ``IcePatch``, ``IceSSL``, +# ``IceStorm``, ``IceUtil``, ``IceXML``, or ``Slice``. +# +# This module reports information about the Ice installation in +# several variables. General variables:: +# +# Ice_VERSION - Ice release version +# Ice_FOUND - true if the main programs and libraries were found +# Ice_LIBRARIES - component libraries to be linked +# Ice_INCLUDE_DIRS - the directories containing the Ice headers +# Ice_SLICE_DIRS - the directories containing the Ice slice interface +# definitions +# +# Ice programs are reported in:: +# +# Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable +# Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable +# Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable +# Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable +# Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable +# Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable +# Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable +# Ice_SLICE2PY_EXECUTABLE - path to slice2py executable +# Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable +# +# Ice component libraries are reported in:: +# +# Ice_<C>_FOUND - ON if component was found +# Ice_<C>_LIBRARIES - libraries for component +# +# Note that ``<C>`` is the uppercased name of the component. +# +# This module reads hints about search results from:: +# +# Ice_HOME - the root of the Ice installation +# +# The environment variable :envvar:`ICE_HOME` may also be used; the +# Ice_HOME variable takes precedence. +# +# The following cache variables may also be set:: +# +# Ice_<P>_EXECUTABLE - the path to executable <P> +# Ice_INCLUDE_DIR - the directory containing the Ice headers +# Ice_SLICE_DIR - the directory containing the Ice slice interface +# definitions +# Ice_<C>_LIBRARY - the library for component <C> +# +# .. note:: +# +# In most cases none of the above variables will require setting, +# unless multiple Ice versions are available and a specific version +# is required. On Windows, the most recent version of Ice will be +# found through the registry. On Unix, the programs, headers and +# libraries will usually be in standard locations, but Ice_SLICE_DIRS +# might not be automatically detected (commonly known locations are +# searched). All the other variables are defaulted using Ice_HOME, +# if set. It's possible to set Ice_HOME and selectively specify +# alternative locations for the other components; this might be +# required for e.g. newer versions of Visual Studio if the +# heuristics are not sufficient to identify the correct programs and +# libraries for the specific Visual Studio version. +# +# Other variables one may set to control this module are:: +# +# Ice_DEBUG - Set to ON to enable debug output from FindIce. + +# Written by Roger Leigh <rleigh@codelibre.net> + +#============================================================================= +# Copyright 2014 University of Dundee +# +# 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.) + +# The Ice checks are contained in a function due to the large number +# of temporary variables needed. +function(_Ice_FIND) + # Released versions of Ice, including generic short forms + set(ice_versions + 3 + 3.5 + 3.5.1 + 3.5.0 + 3.4 + 3.4.2 + 3.4.1 + 3.4.0 + 3.3 + 3.3.1 + 3.3.0) + + # Set up search paths, taking compiler into account. Search Ice_HOME, + # with ICE_HOME in the environment as a fallback if unset. + if(Ice_HOME) + list(APPEND ice_roots "${Ice_HOME}") + else() + if(NOT "$ENV{ICE_HOME}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{ICE_HOME}" NATIVE_PATH) + list(APPEND ice_roots "${NATIVE_PATH}") + set(Ice_HOME "${NATIVE_PATH}" + CACHE PATH "Location of the Ice installation" FORCE) + endif() + endif() + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + # 64-bit path suffix + set(_x64 "/x64") + # 64-bit library directory + set(_lib64 "lib64") + endif() + + if(MSVC_VERSION) + # VS 8.0 + if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) + set(vcver "vc80") + set(vcyear "2005") + # VS 9.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) + set(vcver "vc90") + set(vcyear "2008") + # VS 10.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) + set(vcver "vc100") + # VS 11.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) + set(vcver "vc110") + # VS 12.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) + set(vcver "vc120") + # VS 14.0 + elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 2000) + set(vcver "vc140") + endif() + endif() + + # For compatibility with ZeroC Windows builds. + if(vcver) + # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check. + list(APPEND ice_binary_suffixes "bin/${vcver}${_x64}" "bin/${vcver}") + list(APPEND ice_library_suffixes "lib/${vcver}${_x64}" "lib/${vcver}") + endif() + # Generic 64-bit and 32-bit directories + list(APPEND ice_binary_suffixes "bin${_x64}" "bin") + list(APPEND ice_library_suffixes "${_lib64}" "lib${_x64}" "lib") + list(APPEND ice_include_suffixes "include") + list(APPEND ice_slice_suffixes "slice") + + # On Windows, look in the registry for install locations. Different + # versions of Ice install support different compiler versions. + if(vcver) + foreach(ice_version ${ice_versions}) + # Ice 3.3 releases use a Visual Studio year suffix and value is + # enclosed in double quotes, though only the leading quote is + # returned by get_filename_component. + unset(ice_location) + if(vcyear) + get_filename_component(ice_location + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version} for Visual Studio ${vcyear};InstallDir]" + PATH) + if(ice_location AND NOT ("${ice_location}" STREQUAL "/registry" OR "${ice_location}" STREQUAL "/")) + string(REGEX REPLACE "^\"(.*)\"?$" "\\1" ice_location "${ice_location}") + get_filename_component(ice_location "${ice_location}" ABSOLUTE) + else() + unset(ice_location) + endif() + endif() + # Ice 3.4+ releases don't use a suffix + if(NOT ice_location OR "${ice_location}" STREQUAL "/registry") + get_filename_component(ice_location + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version};InstallDir]" + ABSOLUTE) + endif() + + if(ice_location AND NOT "${ice_location}" STREQUAL "/registry") + list(APPEND ice_roots "${ice_location}") + endif() + endforeach() + else() + foreach(ice_version ${ice_versions}) + # Prefer 64-bit variants if present (and using a 64-bit compiler) + list(APPEND ice_roots "/opt/Ice-${ice_version}") + endforeach() + endif() + + set(ice_programs + slice2cpp + slice2cs + slice2freezej + slice2freeze + slice2html + slice2java + slice2php + slice2py + slice2rb) + + # Find all Ice programs + foreach(program ${ice_programs}) + string(TOUPPER "${program}" program_upcase) + set(cache_var "Ice_${program_upcase}_EXECUTABLE") + set(program_var "Ice_${program_upcase}_EXECUTABLE") + find_program("${cache_var}" "${program}" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_binary_suffixes} + DOC "Ice ${program} executable") + mark_as_advanced(cache_var) + set("${program_var}" "${${cache_var}}" PARENT_SCOPE) + endforeach() + + # Get version. + if(Ice_SLICE2CPP_EXECUTABLE) + # Execute in C locale for safety + set(_Ice_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) + + execute_process(COMMAND ${Ice_SLICE2CPP_EXECUTABLE} --version + ERROR_VARIABLE Ice_VERSION_SLICE2CPP_FULL + ERROR_STRIP_TRAILING_WHITESPACE) + + # restore the previous LC_ALL + set(ENV{LC_ALL} ${_Ice_SAVED_LC_ALL}) + + # Make short version + string(REGEX REPLACE "^(.*)\\.[^.]*$" "\\1" Ice_VERSION_SLICE2CPP_SHORT "${Ice_VERSION_SLICE2CPP_FULL}") + set(Ice_VERSION "${Ice_VERSION_SLICE2CPP_FULL}" PARENT_SCOPE) + endif() + + if(NOT Ice_FIND_QUIETLY) + message(STATUS "Ice version: ${Ice_VERSION_SLICE2CPP_FULL}") + endif() + + # Find include directory + find_path(Ice_INCLUDE_DIR + NAMES "Ice/Ice.h" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_include_suffixes} + DOC "Ice include directory") + set(Ice_INCLUDE_DIR "${Ice_INCLUDE_DIR}" PARENT_SCOPE) + + # In common use on Linux, MacOS X (homebrew) and FreeBSD; prefer + # version-specific dir + list(APPEND ice_slice_paths + /usr/local/share /usr/share) + list(APPEND ice_slice_suffixes + "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice" + "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice" + Ice) + + # Find slice directory + find_path(Ice_SLICE_DIR + NAMES "Ice/Connection.ice" + HINTS ${ice_roots} + ${ice_slice_paths} + PATH_SUFFIXES ${ice_slice_suffixes} + NO_DEFAULT_PATH + DOC "Ice slice directory") + set(Ice_SLICE_DIR "${Ice_SLICE_DIR}" PARENT_SCOPE) + + # Find all Ice libraries + set(Ice_REQUIRED_LIBS_FOUND ON) + foreach(component ${Ice_FIND_COMPONENTS}) + string(TOUPPER "${component}" component_upcase) + set(component_cache "Ice_${component_upcase}_LIBRARY") + set(component_found "${component_upcase}_FOUND") + find_library("${component_cache}" "${component}" + HINTS ${ice_roots} + PATH_SUFFIXES ${ice_library_suffixes} + DOC "Ice ${component} library") + mark_as_advanced("${component_cache}") + if("${component_cache}") + set("${component_found}" ON) + list(APPEND Ice_LIBRARY "${${component_cache}}") + endif() + mark_as_advanced("${component_found}") + set("${component_cache}" "${${component_cache}}" PARENT_SCOPE) + set("${component_found}" "${${component_found}}" PARENT_SCOPE) + if("${component_found}") + if ("Ice_FIND_REQUIRED_${component}") + list(APPEND Ice_LIBS_FOUND "${component} (required)") + else() + list(APPEND Ice_LIBS_FOUND "${component} (optional)") + endif() + else() + if ("Ice_FIND_REQUIRED_${component}") + set(Ice_REQUIRED_LIBS_FOUND OFF) + list(APPEND Ice_LIBS_NOTFOUND "${component} (required)") + else() + list(APPEND Ice_LIBS_NOTFOUND "${component} (optional)") + endif() + endif() + endforeach() + set(_Ice_REQUIRED_LIBS_FOUND "${Ice_REQUIRED_LIBS_FOUND}" PARENT_SCOPE) + set(Ice_LIBRARY "${Ice_LIBRARY}" PARENT_SCOPE) + + if(NOT Ice_FIND_QUIETLY) + if(Ice_LIBS_FOUND) + message(STATUS "Found the following Ice libraries:") + foreach(found ${Ice_LIBS_FOUND}) + message(STATUS " ${found}") + endforeach() + endif() + if(Ice_LIBS_NOTFOUND) + message(STATUS "The following Ice libraries were not found:") + foreach(notfound ${Ice_LIBS_NOTFOUND}) + message(STATUS " ${notfound}") + endforeach() + endif() + endif() + + if(Ice_DEBUG) + message(STATUS "--------FindIce.cmake search debug--------") + message(STATUS "ICE binary path search order: ${ice_roots}") + message(STATUS "ICE include path search order: ${ice_roots}") + message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}") + message(STATUS "ICE library path search order: ${ice_roots}") + message(STATUS "----------------") + endif() +endfunction() + +_Ice_FIND() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice + FOUND_VAR Ice_FOUND + REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE + Ice_INCLUDE_DIR + Ice_SLICE_DIR + Ice_LIBRARY + _Ice_REQUIRED_LIBS_FOUND + VERSION_VAR Ice_VERSION + FAIL_MESSAGE "Failed to find all Ice components") + +unset(_Ice_REQUIRED_LIBS_FOUND) + +if(Ice_FOUND) + set(Ice_INCLUDE_DIRS "${Ice_INCLUDE_DIR}") + set(Ice_SLICE_DIRS "${Ice_SLICE_DIR}") + set(Ice_LIBRARIES "${Ice_LIBRARY}") + foreach(_Ice_component ${Ice_FIND_COMPONENTS}) + string(TOUPPER "${_Ice_component}" _Ice_component_upcase) + set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY") + set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES") + set(_Ice_component_found "${_Ice_component_upcase}_FOUND") + if("${_Ice_component_found}") + set("${_Ice_component_lib}" "${${_Ice_component_cache}}") + endif() + unset(_Ice_component_upcase) + unset(_Ice_component_cache) + unset(_Ice_component_lib) + unset(_Ice_component_found) + endforeach() +endif() + +if(Ice_DEBUG) + message(STATUS "--------FindIce.cmake results debug--------") + message(STATUS "Ice_VERSION number: ${Ice_VERSION}") + message(STATUS "Ice_HOME directory: ${Ice_HOME}") + message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}") + message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}") + message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}") + message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}") + message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}") + message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}") + message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}") + message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}") + message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}") + message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") + message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") + message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") + foreach(component ${Ice_FIND_COMPONENTS}) + string(TOUPPER "${component}" component_upcase) + set(component_lib "Ice_${component_upcase}_LIBRARIES") + set(component_found "${component_upcase}_FOUND") + message(STATUS "${component} library found: ${${component_found}}") + message(STATUS "${component} library: ${${component_lib}}") + endforeach() + message(STATUS "----------------") +endif() diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 4f0e687..65458b7 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -95,34 +95,68 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +find_package(PkgConfig QUIET) + #--------------------------------------------------------------------- # Helper functions #--------------------------------------------------------------------- function(FIND_IMAGEMAGICK_API component header) set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) + pkg_check_modules(PC_${component} QUIET ${component}) + find_path(ImageMagick_${component}_INCLUDE_DIR NAMES ${header} + HINTS + ${PC_${component}_INCLUDEDIR} + ${PC_${component}_INCLUDE_DIRS} + PATHS + ${ImageMagick_INCLUDE_DIRS} + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" + PATH_SUFFIXES + ImageMagick ImageMagick-6 + DOC "Path to the ImageMagick arch-independent include dir." + ) + find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR + NAMES magick/magick-baseconfig.h + HINTS + ${PC_${component}_INCLUDEDIR} + ${PC_${component}_INCLUDE_DIRS} PATHS ${ImageMagick_INCLUDE_DIRS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" PATH_SUFFIXES ImageMagick ImageMagick-6 - DOC "Path to the ImageMagick include dir." + DOC "Path to the ImageMagick arch-specific include dir." ) find_library(ImageMagick_${component}_LIBRARY NAMES ${ARGN} + HINTS + ${PC_${component}_LIBDIR} + ${PC_${component}_LIB_DIRS} PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib" DOC "Path to the ImageMagick Magick++ library." ) + # old version have only indep dir if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) - list(APPEND ImageMagick_INCLUDE_DIRS + # Construct per-component include directories. + set(ImageMagick_${component}_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIR} ) + if(ImageMagick_${component}_ARCH_INCLUDE_DIR) + list(APPEND ImageMagick_${component}_INCLUDE_DIRS + ${ImageMagick_${component}_ARCH_INCLUDE_DIR}) + endif() + list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS) + set(ImageMagick_${component}_INCLUDE_DIRS + ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE) + + # Add the per-component include directories to the full include dirs. + list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS}) list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 6a496af..3dcb0d0 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -55,7 +55,7 @@ macro(java_append_library_directories _var) # endianess of the underlying system. set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") - set(_java_libarch "ppc64le") + set(_java_libarch "ppc64" "ppc64le") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") set(_java_libarch "ppc64" "ppc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 90e4485..86bb6e5 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -33,7 +33,7 @@ find_path(JPEG_INCLUDE_DIR jpeglib.h) -set(JPEG_NAMES ${JPEG_NAMES} jpeg) +set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg) find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index ea898a6..dda4530 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -8,29 +8,29 @@ # # This module defines the following variables: # -# :: -# -# KDE3_DEFINITIONS - compiler definitions required for compiling KDE software -# KDE3_INCLUDE_DIR - the KDE include directory -# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with include_directories() -# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with link_directories() -# QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library -# KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable -# KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable -# KDE3_KCFGC_EXECUTABLE - the kconfig_compiler executable -# KDE3_FOUND - set to TRUE if all of the above has been found -# -# +# ``KDE3_DEFINITIONS`` +# compiler definitions required for compiling KDE software +# ``KDE3_INCLUDE_DIR`` +# the KDE include directory +# ``KDE3_INCLUDE_DIRS`` +# the KDE and the Qt include directory, for use with include_directories() +# ``KDE3_LIB_DIR`` +# the directory where the KDE libraries are installed, for use with link_directories() +# ``QT_AND_KDECORE_LIBS`` +# this contains both the Qt and the kdecore library +# ``KDE3_DCOPIDL_EXECUTABLE`` +# the dcopidl executable +# ``KDE3_DCOPIDL2CPP_EXECUTABLE`` +# the dcopidl2cpp executable +# ``KDE3_KCFGC_EXECUTABLE`` +# the kconfig_compiler executable +# ``KDE3_FOUND`` +# set to TRUE if all of the above has been found # # The following user adjustable options are provided: # -# :: -# -# KDE3_BUILD_TESTS - enable this to build KDE testcases -# -# -# -# +# ``KDE3_BUILD_TESTS`` +# enable this to build KDE testcases # # It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is # always the variable which contains the list of source files for your @@ -101,7 +101,8 @@ # # :: # -# Currently identical to add_executable(), may provide some advanced features in the future. +# Currently identical to add_executable(), may provide some advanced +# features in the future. # # # @@ -110,7 +111,8 @@ # :: # # Create a KDE plugin (KPart, kioslave, etc.) from the given source files. -# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't. +# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", +# otherwise it won't. # It creates and installs an appropriate libtool la-file. # # @@ -120,7 +122,8 @@ # :: # # Create a KDE application in the form of a module loadable via kdeinit. -# A library named kdeinit_<name> will be created and a small executable which links to it. +# A library named kdeinit_<name> will be created and a small executable +# which links to it. # # # diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index 62eedd6..e353d38 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -104,7 +104,7 @@ find_program(DVIPDF_CONVERTER if (WIN32) find_program(PS2PDF_CONVERTER - NAMES ps2pdf14.bat ps2pdf + NAMES ps2pdf14.bat ps2pdf14 ps2pdf PATHS ${GHOSTSCRIPT_LIBRARY_PATH} ${MIKTEX_BINARY_PATH} ) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index cc35e54..731f5f2 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -56,7 +56,7 @@ function(set_lua_version_vars) if (Lua_FIND_VERSION_EXACT) if (Lua_FIND_VERSION_COUNT GREATER 1) - set(lua_append_versions ${Lua_FIND_VERSION_MAJOR} ${Lua_FIND_VERSION_MINOR}) + set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) endif () elseif (Lua_FIND_VERSION) # once there is a different major version supported this should become a loop diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 6e15f3b..3be5e3c 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -522,6 +522,7 @@ endfunction() # Most mpi distros have some form of mpiexec which gives us something we can reliably look for. find_program(MPIEXEC NAMES ${_MPI_EXEC_NAMES} + HINTS ${MPI_HOME} $ENV{MPI_HOME} PATHS ${_MPI_PREFIX_PATH} PATH_SUFFIXES bin DOC "Executable for running MPI programs.") @@ -584,7 +585,9 @@ foreach (lang C CXX Fortran) find_program(MPI_${lang}_COMPILER NAMES ${_MPI_${lang}_COMPILER_NAMES} - PATHS "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH}) + HINTS ${_MPI_BASE_DIR}/bin + PATHS ${_MPI_PREFIX_PATH} + ) interrogate_mpi_compiler(${lang} ${try_libs}) mark_as_advanced(MPI_${lang}_COMPILER) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index b5eed9a..4d3ed84 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -70,14 +70,15 @@ endfunction() find_path(OpenCL_INCLUDE_DIR NAMES CL/cl.h OpenCL/cl.h - PATHS ENV - "PROGRAMFILES(X86)" - AMDAPPSDKROOT - INTELOCLSDKROOT - NVSDKCOMPUTE_ROOT - CUDA_PATH - ATISTREAMSDKROOT + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV NVSDKCOMPUTE_ROOT + ENV CUDA_PATH + ENV ATISTREAMSDKROOT PATH_SUFFIXES + include OpenCL/common/inc "AMD APP/include") @@ -87,13 +88,13 @@ if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 4) find_library(OpenCL_LIBRARY NAMES OpenCL - PATHS ENV - "PROGRAMFILES(X86)" - AMDAPPSDKROOT - INTELOCLSDKROOT - CUDA_PATH - NVSDKCOMPUTE_ROOT - ATISTREAMSDKROOT + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV CUDA_PATH + ENV NVSDKCOMPUTE_ROOT + ENV ATISTREAMSDKROOT PATH_SUFFIXES "AMD APP/lib/x86" lib/x86 @@ -102,13 +103,13 @@ if(WIN32) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) find_library(OpenCL_LIBRARY NAMES OpenCL - PATHS ENV - "PROGRAMFILES(X86)" - AMDAPPSDKROOT - INTELOCLSDKROOT - CUDA_PATH - NVSDKCOMPUTE_ROOT - ATISTREAMSDKROOT + PATHS + ENV "PROGRAMFILES(X86)" + ENV AMDAPPSDKROOT + ENV INTELOCLSDKROOT + ENV CUDA_PATH + ENV NVSDKCOMPUTE_ROOT + ENV ATISTREAMSDKROOT PATH_SUFFIXES "AMD APP/lib/x86_64" lib/x86_64 diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 30972ae..801b4f8 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -16,6 +16,7 @@ # # OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support # OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support +# OpenMP_Fortran_FLAGS - flags to add to the Fortran compiler for OpenMP support # OPENMP_FOUND - true if openmp is detected # # @@ -27,6 +28,7 @@ # Copyright 2009 Kitware, Inc. # Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no> # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de> +# Copyright 2014 Nicolas Bock <nicolasbock@gmail.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -68,8 +70,11 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") - else() + elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND + "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528") set(OMP_FLAG_Intel "-openmp") + else() + set(OMP_FLAG_Intel "-qopenmp") endif() set(OMP_FLAG_MIPSpro "-mp") set(OMP_FLAG_MSVC "/openmp") @@ -103,6 +108,17 @@ int main() { } ") +# same in Fortran +set(OpenMP_Fortran_TEST_SOURCE + " +program test +use omp_lib +integer :: n +n = omp_get_num_threads() +end program test + " + ) + # check c compiler if(CMAKE_C_COMPILER_LOADED) # if these are set then do not try to find them again, @@ -173,6 +189,40 @@ if(CMAKE_CXX_COMPILER_LOADED) unset(OpenMP_CXX_TEST_SOURCE) endif() +# check Fortran compiler +if(CMAKE_Fortran_COMPILER_LOADED) + # if these are set then do not try to find them again, + # by avoiding any try_compiles for the flags + if(OpenMP_Fortran_FLAGS) + unset(OpenMP_Fortran_FLAG_CANDIDATES) + else() + _OPENMP_FLAG_CANDIDATES("Fortran") + include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranSourceCompiles.cmake) + endif() + + foreach(FLAG IN LISTS OpenMP_Fortran_FLAG_CANDIDATES) + set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${FLAG}") + unset(OpenMP_FLAG_DETECTED CACHE) + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP Fortran flag = [${FLAG}]") + endif() + check_fortran_source_compiles("${OpenMP_Fortran_TEST_SOURCE}" OpenMP_FLAG_DETECTED) + set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + if(OpenMP_FLAG_DETECTED) + set(OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}") + break() + endif() + endforeach() + + set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}" + CACHE STRING "Fortran compiler flags for OpenMP parallization") + + list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS) + unset(OpenMP_Fortran_FLAG_CANDIDATES) + unset(OpenMP_Fortran_TEST_SOURCE) +endif() + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) if(_OPENMP_REQUIRED_VARS) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 7bbd753..5a800e4 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -40,13 +40,14 @@ # OSG and it's various components. CMAKE_PREFIX_PATH can also be used # for this (see find_library() CMake documentation). # -# :: -# -# <MODULE>_DIR (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file) -# OSG_DIR -# OSGDIR -# OSG_ROOT -# +# ``<MODULE>_DIR`` +# (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file) +# ``OSG_DIR`` +# .. +# ``OSGDIR`` +# .. +# ``OSG_ROOT`` +# .. # # # [CMake 2.8.10]: The CMake variable OSG_DIR can now be used as well to @@ -203,8 +204,11 @@ foreach(_osg_module ${_osg_modules_to_process}) find_package(${_osg_module} ${_osg_quiet}) string(TOUPPER ${_osg_module} _osg_module_UC) - list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR}) - list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES}) + # append to list if module was found OR is required + if( ${_osg_module_UC}_FOUND OR OpenSceneGraph_FIND_REQUIRED ) + list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR}) + list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES}) + endif() if(OpenSceneGraph_MARK_AS_ADVANCED) OSG_MARK_AS_ADVANCED(${_osg_module}) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index fa04bf0..7cf3f22 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -10,19 +10,22 @@ # # It defines the following variables # -# :: -# -# PNG_INCLUDE_DIRS, where to find png.h, etc. -# PNG_LIBRARIES, the libraries to link against to use PNG. -# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files. -# PNG_FOUND, If false, do not try to use PNG. -# PNG_VERSION_STRING - the version of the PNG library found (since CMake 2.8.8) +# ``PNG_INCLUDE_DIRS`` +# where to find png.h, etc. +# ``PNG_LIBRARIES`` +# the libraries to link against to use PNG. +# ``PNG_DEFINITIONS`` +# You should add_definitons(${PNG_DEFINITIONS}) before compiling code +# that includes png library files. +# ``PNG_FOUND`` +# If false, do not try to use PNG. +# ``PNG_VERSION_STRING`` +# the version of the PNG library found (since CMake 2.8.8) # # Also defined, but not for general use are # -# :: -# -# PNG_LIBRARY, where to find the PNG library. +# ``PNG_LIBRARY`` +# where to find the PNG library. # # For backward compatiblity the variable PNG_INCLUDE_DIR is also set. # It has the same value as PNG_INCLUDE_DIRS. diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index d030418..6bcf1e7 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -20,7 +20,8 @@ # # :: # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> +# (DEFAULT_MSG|"Custom failure message") <var1>...<varN> ) # # If the variables <var1> to <varN> are all valid, then # <UPPERCASED_NAME>_FOUND will be set to TRUE. If DEFAULT_MSG is given @@ -32,14 +33,13 @@ # # :: # -# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR <resultVar>] -# [REQUIRED_VARS <var1>...<varN>] -# [VERSION_VAR <versionvar>] -# [HANDLE_COMPONENTS] -# [CONFIG_MODE] -# [FAIL_MESSAGE "Custom failure message"] ) -# -# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME +# [FOUND_VAR <resultVar>] +# [REQUIRED_VARS <var1>...<varN>] +# [VERSION_VAR <versionvar>] +# [HANDLE_COMPONENTS] +# [CONFIG_MODE] +# [FAIL_MESSAGE "Custom failure message"] ) # # In this mode, the name of the result-variable can be set either to # either <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the @@ -75,7 +75,8 @@ # # :: # -# find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# find_package_handle_standard_args(LibXml2 DEFAULT_MSG +# LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) # # # @@ -90,9 +91,10 @@ # # :: # -# find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND -# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS -# VERSION_VAR LibXslt_VERSION_STRING) +# find_package_handle_standard_args(LibXslt +# FOUND_VAR LibXslt_FOUND +# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS +# VERSION_VAR LibXslt_VERSION_STRING) # # In this case, LibXslt is considered to be found if the variable(s) # listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and @@ -201,7 +203,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # now that we collected all arguments, process them - if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") endif() @@ -284,18 +286,47 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # version handling: set(VERSION_MSG "") set(VERSION_OK TRUE) - set(VERSION ${${FPHSA_VERSION_VAR}} ) - if (${_NAME}_FIND_VERSION) + set(VERSION ${${FPHSA_VERSION_VAR}}) - if(VERSION) + # check with DEFINED here as the requested or found version may be "0" + if (DEFINED ${_NAME}_FIND_VERSION) + if(DEFINED ${FPHSA_VERSION_VAR}) if(${_NAME}_FIND_VERSION_EXACT) # exact version required - if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - set(VERSION_OK FALSE) + # count the dots in the version string + string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}") + # add one dot because there is one dot more than there are components + string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) + if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) + # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT + # is at most 4 here. Therefore a simple lookup table is used. + if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) + set(_VERSION_REGEX "[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) + set(_VERSION_REGEX "[^.]*\\.[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") + else () + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") + endif () + string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}") + unset(_VERSION_REGEX) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + endif () + unset(_VERSION_HEAD) else () - set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + endif () endif () + unset(_VERSION_DOTS) else() # minimum version specified: if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index f13dea8..97666c8 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -145,12 +145,22 @@ find_library( PostgreSQL_LIBRARY ) get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) -if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h") - file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str - REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") - - string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1" - PostgreSQL_VERSION_STRING "${pgsql_version_str}") +if (PostgreSQL_INCLUDE_DIR) + # Some platforms include multiple pg_config.hs for multi-lib configurations + # This is a temporary workaround. A better solution would be to compile + # a dummy c file and extract the value of the symbol. + file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h") + foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS}) + if(EXISTS "${_PG_CONFIG_HEADER}") + file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str + REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") + if(pgsql_version_str) + string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" + "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}") + break() + endif() + endif() + endforeach() unset(pgsql_version_str) endif() diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 9b120a6..72ca6ed 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -183,7 +183,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} COMMENT "Running C++ protocol buffer compiler on ${FIL}" VERBATIM ) endforeach() diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index c930042..2c39de5 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -111,12 +111,14 @@ # # :: # -# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname]) +# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname +# [basename] [classname]) # create a dbus adaptor (header and implementation file) from the xml file # describing the interface, and add it to the list of sources. The adaptor # forwards the calls to a parent class, defined in parentheader and named # parentclassname. The name of the generated files will be -# <basename>adaptor.{cpp,h} where basename defaults to the basename of the xml file. +# <basename>adaptor.{cpp,h} where basename defaults to the basename of the +# xml file. # If <classname> is provided, then it will be used as the classname of the # adaptor itself. # @@ -128,7 +130,8 @@ # If the optional argument interfacename is omitted, the name of the # interface file is constructed from the basename of the header with # the suffix .xml appended. -# Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help" +# Options may be given to qdbuscpp2xml, such as those found when +# executing "qdbuscpp2xml --help" # # # :: @@ -170,10 +173,11 @@ # want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert # #include "foo.moc" # in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the -# scan all listed files at cmake-time for such included moc files and if it finds -# them cause a rule to be generated to run moc at build time on the +# scan all listed files at cmake-time for such included moc files and if it +# finds them cause a rule to be generated to run moc at build time on the # accompanying header file foo.h. -# If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro. +# If a source file has the SKIP_AUTOMOC property set it will be ignored by +# this macro. # If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and # INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc. # @@ -181,16 +185,17 @@ # :: # # function QT4_USE_MODULES( target [link_type] modules...) -# This function is obsolete. Use target_link_libraries with IMPORTED targets instead. +# This function is obsolete. Use target_link_libraries with IMPORTED targets +# instead. # Make <target> use the <modules> from Qt. Using a Qt module means # to link to the library, add the relevant include directories for the module, # and add the relevant compiler defines for using the module. # Modules are roughly equivalent to components of Qt4, so usage would be # something like: # qt4_use_modules(myexe Core Gui Declarative) -# to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument can -# be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the same argument -# to the target_link_libraries call. +# to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument +# can be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the +# same argument to the target_link_libraries call. # # # IMPORTED Targets @@ -518,7 +523,8 @@ set(QT4_INSTALLED_VERSION_TOO_OLD FALSE) set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac) _qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION) -if (QT_QMAKE_EXECUTABLE AND QTVERSION) +if (QT_QMAKE_EXECUTABLE AND + QTVERSION VERSION_GREATER 3 AND QTVERSION VERSION_LESS 5) if (Qt5Core_FOUND) # Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5 @@ -1192,14 +1198,14 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers ) set( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets ) - set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer ) + set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer ) set( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs ) set( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows ) set( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin ) set( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb ) set( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem ) set( QT_ICONENGINES_PLUGINS qsvgicon ) - set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff ) + set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga ) set( QT_INPUTMETHODS_PLUGINS qimsw_multi ) set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler ) if(APPLE) @@ -1213,7 +1219,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} ) set( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets ) set( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} ) - set( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} ) + set( QT_QTGUI_PLUGINS qtaccessiblewidgets ${QT_IMAGEFORMATS_PLUGINS} ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} ) set( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} ) set( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} ) set( QT_QTSVG_PLUGINS qsvg qsvgicon ) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index aafdc09..b5ac703 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -14,19 +14,21 @@ # It also determines what the name of the library is. This code sets # the following variables: # -# :: +# ``RUBY_EXECUTABLE`` +# full path to the ruby binary +# ``RUBY_INCLUDE_DIRS`` +# include dirs to be used when using the ruby library +# ``RUBY_LIBRARY`` +# full path to the ruby library +# ``RUBY_VERSION`` +# the version of ruby which was found, e.g. "1.8.7" +# ``RUBY_FOUND`` +# set to true if ruby ws found successfully # -# RUBY_EXECUTABLE = full path to the ruby binary -# RUBY_INCLUDE_DIRS = include dirs to be used when using the ruby library -# RUBY_LIBRARY = full path to the ruby library -# RUBY_VERSION = the version of ruby which was found, e.g. "1.8.7" -# RUBY_FOUND = set to true if ruby ws found successfully +# Also: # -# -# -# :: -# -# RUBY_INCLUDE_PATH = same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it +# ``RUBY_INCLUDE_PATH`` +# same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it #============================================================================= # Copyright 2004-2009 Kitware, Inc. diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 8bd4048..818d1f2 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -25,6 +25,7 @@ #============================================================================= # Copyright 2004-2009 Kitware, Inc. # Copyright 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com> +# Copyright 2014 Sylvain Joubert <joubert.sy@gmail.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -36,7 +37,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(SWIG_EXECUTABLE NAMES swig2.0 swig) +find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig) if(SWIG_EXECUTABLE) execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 4076521..4fdecb4 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -21,7 +21,8 @@ # # :: # -# SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc) +# SQUISH_INSTALL_DIR The Squish installation directory +# (containing bin, lib, etc) # SQUISH_SERVER_EXECUTABLE The squishserver executable # SQUISH_CLIENT_EXECUTABLE The squishrunner executable # @@ -47,21 +48,26 @@ # # The arguments have the following meaning: # -# :: -# -# cmakeTestName: this will be used as the first argument for add_test() -# AUT targetName: the name of the cmake target which will be used as AUT, i.e. the -# executable which will be tested. -# SUITE suiteName: this is either the full path to the squish suite, or just the -# last directory of the suite, i.e. the suite name. In this case -# the CMakeLists.txt which calls squish_add_test() must be located -# in the parent directory of the suite directory. -# TEST squishTestName: the name of the squish test, i.e. the name of the subdirectory -# of the test inside the suite directory. -# SETTINGSGROUP group: if specified, the given settings group will be used for executing the test. -# If not specified, the groupname will be "CTest_<username>" -# PRE_COMMAND command: if specified, the given command will be executed before starting the squish test. -# POST_COMMAND command: same as PRE_COMMAND, but after the squish test has been executed. +# ``cmakeTestName`` +# this will be used as the first argument for add_test() +# ``AUT targetName`` +# the name of the cmake target which will be used as AUT, i.e. the +# executable which will be tested. +# ``SUITE suiteName`` +# this is either the full path to the squish suite, or just the +# last directory of the suite, i.e. the suite name. In this case +# the CMakeLists.txt which calls squish_add_test() must be located +# in the parent directory of the suite directory. +# ``TEST squishTestName`` +# the name of the squish test, i.e. the name of the subdirectory +# of the test inside the suite directory. +# ``SETTINGSGROUP group`` +# if specified, the given settings group will be used for executing the test. +# If not specified, the groupname will be "CTest_<username>" +# ``PRE_COMMAND command`` +# if specified, the given command will be executed before starting the squish test. +# ``POST_COMMAND command`` +# same as PRE_COMMAND, but after the squish test has been executed. # # # @@ -70,7 +76,12 @@ # enable_testing() # find_package(Squish 4.0) # if (SQUISH_FOUND) -# squish_v4_add_test(myTestName AUT myApp SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite TEST someSquishTest SETTINGSGROUP myGroup ) +# squish_v4_add_test(myTestName +# AUT myApp +# SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite +# TEST someSquishTest +# SETTINGSGROUP myGroup +# ) # endif () # # @@ -201,7 +212,7 @@ else() endif() # record if Squish was found -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(Squish REQUIRED_VARS SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE VERSION_VAR SQUISH_VERSION ) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 6050dcd..a0bc4d1 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -14,14 +14,32 @@ # CMAKE_USE_PTHREADS_INIT - are we using pthreads # CMAKE_HP_PTHREADS_INIT - are we using hp pthreads # +# The following import target is created +# +# :: +# +# Threads::Threads +# # For systems with multiple thread libraries, caller can set # # :: # # CMAKE_THREAD_PREFER_PTHREAD +# +# If the use of the -pthread compiler and linker flag is prefered then the +# caller can set +# +# :: +# +# THREADS_PREFER_PTHREAD_FLAG +# +# Please note that the compiler flag can only be used with the imported +# target. Use of both the imported target as well as this switch is highly +# recommended for new code. #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2011-2014 Rolf Eike Beer <eike@sf-mail.de> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -45,6 +63,58 @@ if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) endif() +# Internal helper macro. +# Do NOT even think about using it outside of this file! +macro(_check_threads_lib LIBNAME FUNCNAME VARNAME) + if(NOT Threads_FOUND) + CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME}) + if(${VARNAME}) + set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() + endif () +endmacro() + +# Internal helper macro. +# Do NOT even think about using it outside of this file! +macro(_check_pthreads_flag) + if(NOT Threads_FOUND) + # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread + if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG) + message(STATUS "Check if compiler accepts -pthread") + try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c + CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread + COMPILE_OUTPUT_VARIABLE OUTPUT) + + if(THREADS_HAVE_PTHREAD_ARG) + if(THREADS_PTHREAD_ARG STREQUAL "2") + set(Threads_FOUND TRUE) + message(STATUS "Check if compiler accepts -pthread - yes") + else() + message(STATUS "Check if compiler accepts -pthread - no") + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n") + endif() + else() + message(STATUS "Check if compiler accepts -pthread - no") + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n") + endif() + + endif() + + if(THREADS_HAVE_PTHREAD_ARG) + set(Threads_FOUND TRUE) + set(CMAKE_THREAD_LIBS_INIT "-pthread") + endif() + endif() +endmacro() + if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) # We have sproc set(CMAKE_USE_SPROC_INIT 1) @@ -67,69 +137,23 @@ else() set(Threads_FOUND TRUE) else() - # Do we have -lpthreads - CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) - if(CMAKE_HAVE_PTHREADS_CREATE) - set(CMAKE_THREAD_LIBS_INIT "-lpthreads") - set(CMAKE_HAVE_THREADS_LIBRARY 1) - set(Threads_FOUND TRUE) - else() - - # Ok, how about -lpthread - CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) - if(CMAKE_HAVE_PTHREAD_CREATE) - set(CMAKE_THREAD_LIBS_INIT "-lpthread") - set(CMAKE_HAVE_THREADS_LIBRARY 1) - set(Threads_FOUND TRUE) + # Check for -pthread first if enabled. This is the recommended + # way, but not backwards compatible as one must also pass -pthread + # as compiler flag then. + if (THREADS_PREFER_PTHREAD_FLAG) + _check_pthreads_flag() + endif () - elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") + _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) + _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) + if(CMAKE_SYSTEM_NAME MATCHES "SunOS") # On sun also check for -lthread - CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) - if(CMAKE_HAVE_THR_CREATE) - set(CMAKE_THREAD_LIBS_INIT "-lthread") - set(CMAKE_HAVE_THREADS_LIBRARY 1) - set(Threads_FOUND TRUE) - endif() - endif() + _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE) endif() endif() endif() - if(NOT CMAKE_HAVE_THREADS_LIBRARY) - # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread - if("x${THREADS_HAVE_PTHREAD_ARG}" STREQUAL "x") - message(STATUS "Check if compiler accepts -pthread") - try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG - ${CMAKE_BINARY_DIR} - ${CMAKE_ROOT}/Modules/CheckForPthreads.c - CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread - COMPILE_OUTPUT_VARIABLE OUTPUT) - - if(THREADS_HAVE_PTHREAD_ARG) - if(THREADS_PTHREAD_ARG STREQUAL "2") - set(Threads_FOUND TRUE) - message(STATUS "Check if compiler accepts -pthread - yes") - else() - message(STATUS "Check if compiler accepts -pthread - no") - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n") - endif() - else() - message(STATUS "Check if compiler accepts -pthread - no") - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n") - endif() - - endif() - - if(THREADS_HAVE_PTHREAD_ARG) - set(Threads_FOUND TRUE) - set(CMAKE_THREAD_LIBS_INIT "-pthread") - endif() - - endif() + _check_pthreads_flag() endif() endif() @@ -178,3 +202,15 @@ endif() set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) + +if(THREADS_FOUND AND NOT TARGET Threads::Threads) + add_library(Threads::Threads INTERFACE IMPORTED) + + if(THREADS_HAVE_PTHREAD_ARG) + set_property(TARGET Threads::Threads PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread") + endif() + + if(CMAKE_THREAD_LIBS_INIT) + set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") + endif() +endif() diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake deleted file mode 100644 index bcc7f87..0000000 --- a/Modules/FindVTK.cmake +++ /dev/null @@ -1,156 +0,0 @@ -#.rst: -# FindVTK -# ------- -# -# Find a VTK installation or build tree. -# -# The following variables are set if VTK is found. If VTK is not found, -# VTK_FOUND is set to false. -# -# :: -# -# VTK_FOUND - Set to true when VTK is found. -# VTK_USE_FILE - CMake file to use VTK. -# VTK_MAJOR_VERSION - The VTK major version number. -# VTK_MINOR_VERSION - The VTK minor version number -# (odd non-release). -# VTK_BUILD_VERSION - The VTK patch level -# (meaningless for odd minor). -# VTK_INCLUDE_DIRS - Include directories for VTK -# VTK_LIBRARY_DIRS - Link directories for VTK libraries -# VTK_KITS - List of VTK kits, in CAPS -# (COMMON,IO,) etc. -# VTK_LANGUAGES - List of wrapped languages, in CAPS -# (TCL, PYHTON,) etc. -# -# The following cache entries must be set by the user to locate VTK: -# -# :: -# -# VTK_DIR - The directory containing VTKConfig.cmake. -# This is either the root of the build tree, -# or the lib/vtk directory. This is the -# only cache entry. -# -# The following variables are set for backward compatibility and should -# not be used in new code: -# -# :: -# -# USE_VTK_FILE - The full path to the UseVTK.cmake file. -# This is provided for backward -# compatibility. Use VTK_USE_FILE -# instead. - -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# Assume not found. -set(VTK_FOUND 0) - -# VTK 4.0 did not provide VTKConfig.cmake. -if("${VTK_FIND_VERSION}" VERSION_LESS 4.1) - set(_VTK_40_ALLOW 1) - if(VTK_FIND_VERSION) - set(_VTK_40_ONLY 1) - endif() -endif() - -# Construct consistent error messages for use below. -set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") -if(_VTK_40_ALLOW) - set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") -endif() -set(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") - -# Check whether VTK 4.0 has already been found. -if(_VTK_40_ALLOW AND VTK_DIR) - if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - set(VTK_FOUND 1) - include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. - endif() -endif() - -# Use the Config mode of the find_package() command to find VTKConfig. -# If this succeeds (possibly because VTK_DIR is already set), the -# command will have already loaded VTKConfig.cmake and set VTK_FOUND. -if(NOT _VTK_40_ONLY AND NOT VTK_FOUND) - find_package(VTK QUIET NO_MODULE) -endif() - -# Special search for VTK 4.0. -if(_VTK_40_ALLOW AND NOT VTK_DIR) - # Old scripts may set these directories in the CMakeCache.txt file. - # They can tell us where to find VTKConfig.cmake. - set(VTK_DIR_SEARCH_LEGACY "") - if(VTK_BINARY_PATH AND USE_BUILT_VTK) - set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) - endif() - if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} - ${VTK_INSTALL_PATH}/lib/vtk) - endif() - - # Look for UseVTK.cmake in build trees or under <prefix>/include/vtk. - find_path(VTK_DIR - NAMES UseVTK.cmake - PATH_SUFFIXES vtk-4.0 vtk - HINTS ENV VTK_DIR - - PATHS - - # Support legacy cache files. - ${VTK_DIR_SEARCH_LEGACY} - - # Read from the CMakeSetup registry entries. It is likely that - # VTK will have been recently built. - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] - - # Help the user find it if we cannot. - DOC "The ${VTK_DIR_DESCRIPTION}" - ) - - if(VTK_DIR) - if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - set(VTK_FOUND 1) - include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings. - else() - # We found the wrong version. Pretend we did not find it. - set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) - endif() - endif() -endif() - -#----------------------------------------------------------------------------- -if(VTK_FOUND) - # Set USE_VTK_FILE for backward-compatibility. - set(USE_VTK_FILE ${VTK_USE_FILE}) -else() - # VTK not found, explain to the user how to specify its location. - if(VTK_FIND_REQUIRED) - message(FATAL_ERROR ${VTK_DIR_MESSAGE}) - else() - if(NOT VTK_FIND_QUIETLY) - message(STATUS ${VTK_DIR_MESSAGE}) - endif() - endif() -endif() diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 3a31cf0..90c1499 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -4,7 +4,7 @@ # # Find X11 installation # -# Try to find X11 on UNIX systems. The following values are defined +# Try to find X11 on UNIX systems. The following values are defined # # :: # @@ -12,47 +12,44 @@ # X11_INCLUDE_DIR - include directories to use X11 # X11_LIBRARIES - link against these to use X11 # -# -# -# and also the following more fine grained variables: Include paths: -# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# and also the following more fine grained variables: # # :: # -# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND -# X11_X11_INCLUDE_PATH, X11_X11_LIB -# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND -# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND -# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND -# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND -# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND -# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND -# X11_Xext_LIB, X11_Xext_FOUND -# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND -# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND -# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND -# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND -# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND -# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND -# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND -# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND -# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND -# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND -# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND -# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND -# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND -# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND -# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND -# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND -# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND -# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND -# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND -# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND -# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND -# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND - +# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND +# X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND +# X11_X11_INCLUDE_PATH, X11_X11_LIB +# X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND +# X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND +# X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND +# X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND +# X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND +# X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND +# X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND +# X11_Xext_LIB, X11_Xext_FOUND +# X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND +# X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND +# X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND +# X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND +# X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND +# X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND +# X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND +# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND +# X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND +# X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND +# X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND +# X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND +# X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND +# X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND +# X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND +# X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND +# X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND +# X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND +# X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND +# X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND +# X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND +# X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND +# X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND #============================================================================= # Copyright 2001-2009 Kitware, Inc. diff --git a/Modules/FindXerces.cmake b/Modules/FindXerces.cmake new file mode 100644 index 0000000..6c6007a --- /dev/null +++ b/Modules/FindXerces.cmake @@ -0,0 +1,85 @@ +#.rst: +# FindXerces +# ---------- +# +# Find the Apache Xerces-C++ validating XML parser headers and libraries. +# +# This module reports information about the Xerces installation in +# several variables. General variables:: +# +# Xerces_FOUND - true if the Xerces headers and libraries were found +# Xerces_VERSION - Xerces release version +# Xerces_INCLUDE_DIRS - the directory containing the Xerces headers +# Xerces_LIBRARIES - Xerces libraries to be linked +# +# The following cache variables may also be set:: +# +# Xerces_INCLUDE_DIR - the directory containing the Xerces headers +# Xerces_LIBRARY - the Xerces library + +# Written by Roger Leigh <rleigh@codelibre.net> + +#============================================================================= +# Copyright 2014 University of Dundee +# +# 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(_Xerces_GET_VERSION version_hdr) + file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XERCES_VERSION_.*") + if(_contents) + string(REGEX REPLACE ".*#define XERCES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" Xerces_MAJOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" Xerces_MINOR "${_contents}") + string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" Xerces_PATCH "${_contents}") + + if(NOT Xerces_MAJOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!") + endif() + if(NOT Xerces_MINOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!") + endif() + if(NOT Xerces_PATCH MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!") + endif() + + set(Xerces_VERSION "${Xerces_MAJOR}.${Xerces_MINOR}.${Xerces_PATCH}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") + endif() +endfunction() + +# Find include directory +find_path(Xerces_INCLUDE_DIR + NAMES "xercesc/util/PlatformUtils.hpp" + DOC "Xerces-C++ include directory") +mark_as_advanced(Xerces_INCLUDE_DIR) + +# Find all Xerces libraries +find_library(Xerces_LIBRARY "xerces-c" + DOC "Xerces-C++ libraries") +mark_as_advanced(Xerces_LIBRARY) + +if(Xerces_INCLUDE_DIR) + _Xerces_GET_VERSION("${Xerces_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xerces + FOUND_VAR Xerces_FOUND + REQUIRED_VARS Xerces_LIBRARY + Xerces_INCLUDE_DIR + Xerces_VERSION + VERSION_VAR Xerces_VERSION + FAIL_MESSAGE "Failed to find Xerces") + +if(Xerces_FOUND) + set(Xerces_INCLUDE_DIRS "${Xerces_INCLUDE_DIR}") + set(Xerces_LIBRARIES "${Xerces_LIBRARY}") +endif() diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 8cc382c..d4a27d5 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -2,9 +2,18 @@ # FindZLIB # -------- # -# Find zlib +# Find the native ZLIB includes and library. # -# Find the native ZLIB includes and library. Once done this will define +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if +# ZLIB has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: # # :: # @@ -12,8 +21,6 @@ # ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_FOUND - True if zlib found. # -# -# # :: # # ZLIB_VERSION_STRING - The version of zlib found (x.y.z) @@ -22,7 +29,8 @@ # ZLIB_VERSION_PATCH - The patch version of zlib # ZLIB_VERSION_TWEAK - The tweak version of zlib # -# +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # # The following variable are provided for backward compatibility # @@ -32,9 +40,10 @@ # ZLIB_MINOR_VERSION - The minor version of zlib # ZLIB_PATCH_VERSION - The patch version of zlib # +# Hints +# ^^^^^ # -# -# An includer may set ZLIB_ROOT to a zlib installation root to tell this +# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this # module where to look. #============================================================================= @@ -104,5 +113,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_D if(ZLIB_FOUND) set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) set(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) -endif() + if(NOT TARGET ZLIB::ZLIB) + add_library(ZLIB::ZLIB UNKNOWN IMPORTED) + set_target_properties(ZLIB::ZLIB PROPERTIES + IMPORTED_LOCATION "${ZLIB_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") + endif() +endif() diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 45596a0..7ef06a8 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -229,13 +229,12 @@ else() endif() #===================================================================== +# Determine whether unix or win32 paths should be used #===================================================================== -if(WIN32 AND NOT CYGWIN AND NOT MSYS) +if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING) set(wxWidgets_FIND_STYLE "win32") else() - if(UNIX OR MSYS) - set(wxWidgets_FIND_STYLE "unix") - endif() + set(wxWidgets_FIND_STYLE "unix") endif() #===================================================================== diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index ceb1db4..bee7dae 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -67,7 +67,7 @@ endif() set(FortranCInterface_SYMBOLS) if(FortranCInterface_EXE) file(STRINGS "${FortranCInterface_EXE}" _info_strings - LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[") + LIMIT_COUNT 8 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]") foreach(info ${_info_strings}) if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]") list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1}) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index eac553d..c61e7e9 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -6,36 +6,47 @@ # # Provides install directory variables as defined for GNU software: # -# :: -# # http://www.gnu.org/prep/standards/html_node/Directory-Variables.html # # Inclusion of this module defines the following variables: # -# :: -# -# CMAKE_INSTALL_<dir> - destination for files of a given type -# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path +# ``CMAKE_INSTALL_<dir>`` +# destination for files of a given type +# ``CMAKE_INSTALL_FULL_<dir>`` +# corresponding absolute path # # where <dir> is one of: # -# :: -# -# BINDIR - user executables (bin) -# SBINDIR - system admin executables (sbin) -# LIBEXECDIR - program executables (libexec) -# SYSCONFDIR - read-only single-machine data (etc) -# SHAREDSTATEDIR - modifiable architecture-independent data (com) -# LOCALSTATEDIR - modifiable single-machine data (var) -# LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian) -# INCLUDEDIR - C header files (include) -# OLDINCLUDEDIR - C header files for non-gcc (/usr/include) -# DATAROOTDIR - read-only architecture-independent data root (share) -# DATADIR - read-only architecture-independent data (DATAROOTDIR) -# INFODIR - info documentation (DATAROOTDIR/info) -# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale) -# MANDIR - man documentation (DATAROOTDIR/man) -# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME) +# ``BINDIR`` +# user executables (bin) +# ``SBINDIR`` +# system admin executables (sbin) +# ``LIBEXECDIR`` +# program executables (libexec) +# ``SYSCONFDIR`` +# read-only single-machine data (etc) +# ``SHAREDSTATEDIR`` +# modifiable architecture-independent data (com) +# ``LOCALSTATEDIR`` +# modifiable single-machine data (var) +# ``LIBDIR`` +# object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian) +# ``INCLUDEDIR`` +# C header files (include) +# ``OLDINCLUDEDIR`` +# C header files for non-gcc (/usr/include) +# ``DATAROOTDIR`` +# read-only architecture-independent data root (share) +# ``DATADIR`` +# read-only architecture-independent data (DATAROOTDIR) +# ``INFODIR`` +# info documentation (DATAROOTDIR/info) +# ``LOCALEDIR`` +# locale-dependent data (DATAROOTDIR/locale) +# ``MANDIR`` +# man documentation (DATAROOTDIR/man) +# ``DOCDIR`` +# documentation root (DATAROOTDIR/doc/PROJECT_NAME) # # Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION # options of install() commands for the corresponding file type. If the @@ -198,7 +209,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") set(CMAKE_INSTALL_INFODIR "info") endif() - if(NOT CMAKE_INSTALL_MANDDIR) + if(NOT CMAKE_INSTALL_MANDIR) set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (man)") set(CMAKE_INSTALL_MANDIR "man") endif() @@ -208,7 +219,7 @@ else() set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info") endif() - if(NOT CMAKE_INSTALL_MANDDIR) + if(NOT CMAKE_INSTALL_MANDIR) set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)") set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man") endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f83f992..0c6256c 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -213,14 +213,13 @@ macro(_test_compiler_hidden_visibility) # Exclude XL here because it misinterprets -fvisibility=hidden even though # the check_cxx_compiler_flag passes - # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259 if(NOT GCC_TOO_OLD AND NOT _INTEL_TOO_OLD AND NOT WIN32 AND NOT CYGWIN - AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES XL - AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI - AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom) + AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL + AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI + AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom) check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) check_cxx_compiler_flag(-fvisibility-inlines-hidden COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) @@ -231,11 +230,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) - if("${CMAKE_CXX_COMPILER_ID}" MATCHES Borland - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES HP + if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES HP OR GCC_TOO_OLD - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom) + OR CMAKE_CXX_COMPILER_ID MATCHES PGI + OR CMAKE_CXX_COMPILER_ID MATCHES Watcom) set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL "Compiler support for a deprecated attribute") else() @@ -364,6 +363,7 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL "SHARED_LIBRARY" + AND NOT ${type} STREQUAL "OBJECT_LIBRARY" AND NOT ${type} STREQUAL "MODULE_LIBRARY") message(WARNING "This macro can only be used with libraries") return() diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 05c2edb..9963517 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -41,7 +41,7 @@ # :: # # GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse> -# <exepath> <dirs>) +# <exepath> <dirs> [<rpaths>]) # # Get the list of shared library files required by <target>. The list # in the variable named <prerequisites_var> should be empty on first @@ -113,7 +113,8 @@ # # :: # -# GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>) +# GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var> +# [<rpaths>]) # # Resolve an item into an existing full path file. # @@ -122,7 +123,8 @@ # # :: # -# GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>) +# GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var> +# [<rpaths>]) # # Return the type of <file> with respect to <original_file>. String # describing type of prerequisite is returned in variable named @@ -321,6 +323,7 @@ endfunction() function(gp_resolve_item context item exepath dirs resolved_item_var) set(resolved 0) set(resolved_item "${item}") + set(rpaths "${ARGV5}") # Is it already resolved? # @@ -329,7 +332,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) endif() if(NOT resolved) - if(item MATCHES "@executable_path") + if(item MATCHES "^@executable_path") # # @executable_path references are assumed relative to exepath # @@ -347,7 +350,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) endif() if(NOT resolved) - if(item MATCHES "@loader_path") + if(item MATCHES "^@loader_path") # # @loader_path references are assumed relative to the # PATH of the given "context" (presumably another library) @@ -367,7 +370,7 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) endif() if(NOT resolved) - if(item MATCHES "@rpath") + if(item MATCHES "^@rpath") # # @rpath references are relative to the paths built into the binaries with -rpath # We handle this case like we do for other Unixes @@ -375,9 +378,9 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) string(REPLACE "@rpath/" "" norpath_item "${item}") set(ri "ri-NOTFOUND") - find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH) + find_file(ri "${norpath_item}" ${exepath} ${dirs} ${rpaths} NO_DEFAULT_PATH) if(ri) - #message(STATUS "info: 'find_file' in exepath/dirs (${ri})") + #message(STATUS "info: 'find_file' in exepath/dirs/rpaths (${ri})") set(resolved 1) set(resolved_item "${ri}") set(ri "ri-NOTFOUND") @@ -471,6 +474,7 @@ endfunction() function(gp_resolved_file_type original_file file exepath dirs type_var) + set(rpaths "${ARGV5}") #message(STATUS "**") if(NOT IS_ABSOLUTE "${original_file}") @@ -489,7 +493,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(NOT is_embedded) if(NOT IS_ABSOLUTE "${file}") - gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file) + gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file "${rpaths}") endif() string(TOLOWER "${original_file}" original_lower) @@ -612,6 +616,7 @@ endfunction() function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs) set(verbose 0) set(eol_char "E") + set(rpaths "${ARGV6}") if(NOT IS_ABSOLUTE "${target}") message("warning: target '${target}' is not absolute...") @@ -834,7 +839,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(add_item AND ${exclude_system}) set(type "") - gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type) + gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type "${rpaths}") if("${type}" STREQUAL "system") set(add_item 0) @@ -855,7 +860,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # that the analysis tools can simply accept it as input. # if(NOT list_length_before_append EQUAL list_length_after_append) - gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item) + gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}") set(unseen_prereqs ${unseen_prereqs} "${resolved_item}") endif() endif() @@ -874,7 +879,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(${recurse}) set(more_inputs ${unseen_prereqs}) foreach(input ${more_inputs}) - get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}") + get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}" "${rpaths}") endforeach() endif() diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 5c439e9..5afb517 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -19,6 +19,8 @@ # libraries are installed when both debug and release are available. If # CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time libraries are # installed as well as the CRT run time libraries. If +# CMAKE_INSTALL_OPENMP_LIBRARIES is set then the OpenMP run time libraries +# are installed as well. If # CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are # installed to that directory rather than the default. If # CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this @@ -94,6 +96,8 @@ if(MSVC) "${MSVC80_CRT_DIR}/msvcp80.dll" "${MSVC80_CRT_DIR}/msvcr80.dll" ) + else() + set(__install__libs) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) @@ -132,6 +136,8 @@ if(MSVC) "${MSVC90_CRT_DIR}/msvcp90.dll" "${MSVC90_CRT_DIR}/msvcr90.dll" ) + else() + set(__install__libs) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) @@ -168,6 +174,8 @@ if(MSVC) "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll" "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll" ) + else() + set(__install__libs) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) @@ -192,6 +200,10 @@ if(MSVC) MSVCRT_FILES_FOR_VERSION(12) endif() + if(MSVC14) + MSVCRT_FILES_FOR_VERSION(14) + endif() + if(CMAKE_INSTALL_MFC_LIBRARIES) if(MSVC70) set(__install__libs ${__install__libs} @@ -361,6 +373,44 @@ if(MSVC) if(MSVC12) MFC_FILES_FOR_VERSION(12) endif() + + if(MSVC14) + MFC_FILES_FOR_VERSION(14) + endif() + endif() + + # MSVC 8 was the first version with OpenMP + # Furthermore, there is no debug version of this + if(CMAKE_INSTALL_OPENMP_LIBRARIES) + macro(OPENMP_FILES_FOR_VERSION version_a version_b) + set(va "${version_a}") + set(vb "${version_b}") + set(MSVC${va}_OPENMP_DIR "${MSVC${va}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vb}.OPENMP") + + if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + set(__install__libs ${__install__libs} + "${MSVC${va}_OPENMP_DIR}/vcomp${vb}.dll") + endif() + endmacro() + + if(MSVC80) + OPENMP_FILES_FOR_VERSION(80 80) + endif() + if(MSVC90) + OPENMP_FILES_FOR_VERSION(90 90) + endif() + if(MSVC10) + OPENMP_FILES_FOR_VERSION(10 100) + endif() + if(MSVC11) + OPENMP_FILES_FOR_VERSION(11 110) + endif() + if(MSVC12) + OPENMP_FILES_FOR_VERSION(12 120) + endif() + if(MSVC14) + OPENMP_FILES_FOR_VERSION(14 140) + endif() endif() foreach(lib diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake new file mode 100644 index 0000000..1bdad04 --- /dev/null +++ b/Modules/Platform/Android.cmake @@ -0,0 +1,15 @@ +include(Platform/Linux) + +# Android has soname, but binary names must end in ".so" so we cannot append +# a version number. Also we cannot portably represent symlinks on the host. +set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1) + +# Android reportedly ignores RPATH, and we cannot predict the install +# location anyway. +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") + +# Nsight Tegra Visual Studio Edition takes care of +# prefixing library names with '-l'. +if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(CMAKE_LINK_LIBRARY_FLAG "") +endif() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index e25df1e..e5c5f36 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -70,6 +70,8 @@ if(CMAKE_OSX_DEPLOYMENT_TARGET) set(_sdk_ver "${CMAKE_MATCH_1}") elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") set(_sdk_ver "${CMAKE_MATCH_1}") + elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/") + set(_sdk_ver "${_CURRENT_OSX_VERSION}") else() message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake deleted file mode 100644 index e5721a7..0000000 --- a/Modules/Platform/QNX-QCC-C.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(C) diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake deleted file mode 100644 index e490bbe..0000000 --- a/Modules/Platform/QNX-QCC-CXX.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -include(Platform/QNX) - -__compiler_qcc(CXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index cc551bd..ebc4609 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,5 +1,8 @@ set(QNXNTO 1) +include(Platform/GNU) +unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) + set(CMAKE_DL_LIBS "") # Shared libraries with no builtin soname may not be linked safely by @@ -14,22 +17,3 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic") set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic") endforeach() - -include(Platform/GNU) -unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX) - -macro(__compiler_qcc lang) - # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples - set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") - - set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") - set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>") - - if (lang STREQUAL CXX) - # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the - # default for the driver is not c++. - set(CMAKE_CXX_COMPILE_OBJECT - "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") - endif() - -endmacro() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 5732170..a72f946 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -36,15 +36,14 @@ else() set(CMAKE_CL_NOLOGO "/nologo") endif() -set(WIN32 1) - -if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") - set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup") - set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup") - set(WINCE 1) +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") + set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") + set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") + set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") else() set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") + set(_PLATFORM_LINK_FLAGS "") endif() if(CMAKE_GENERATOR MATCHES "Visual Studio 6") @@ -85,6 +84,7 @@ if(NOT MSVC_VERSION) set(MSVC10) set(MSVC11) set(MSVC12) + set(MSVC14) set(MSVC60) set(MSVC70) set(MSVC71) @@ -92,7 +92,9 @@ if(NOT MSVC_VERSION) set(MSVC90) set(CMAKE_COMPILER_2005) set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) - if(NOT "${_compiler_version}" VERSION_LESS 18) + if(NOT "${_compiler_version}" VERSION_LESS 19) + set(MSVC14 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 18) set(MSVC12 1) elseif(NOT "${_compiler_version}" VERSION_LESS 17) set(MSVC11 1) @@ -160,10 +162,23 @@ if(WINCE) if (MSVC_VERSION LESS 1600) set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib") endif () +elseif(WINDOWS_PHONE OR WINDOWS_STORE) + set(_PLATFORM_DEFINES "/DWIN32") + set(_FLAGS_C " /DUNICODE /D_UNICODE") + set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") + if(WINDOWS_PHONE) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") + elseif(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") + else() + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() else() set(_PLATFORM_DEFINES "/DWIN32") - if(MSVC_VERSION GREATER 1310) + if(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") + elseif(MSVC_VERSION GREATER 1310) set(_RTC1 "/RTC1") set(_FLAGS_CXX " /GR /EHsc") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") @@ -197,10 +212,12 @@ unset(_MACHINE_ARCH_FLAG) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it set( MSVC_INCREMENTAL_YES_FLAG "") -if(NOT MSVC_INCREMENTAL_DEFAULT) - set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") -else() - set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) +if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE) + if(NOT MSVC_INCREMENTAL_DEFAULT) + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") + else() + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) + endif() endif() if (CMAKE_COMPILER_SUPPORTS_PDBTYPE) @@ -235,7 +252,7 @@ macro(__windows_compiler_msvc lang) set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ") endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") @@ -249,11 +266,12 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE - "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") 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) endmacro() diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index 8dfb610..211cc9d 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -26,7 +26,6 @@ set(CMAKE_Fortran_COMPILE_OBJECT set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") -set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link") set(CMAKE_Fortran_LINK_EXECUTABLE "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index b158a9d..9a937a7 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -1,5 +1,13 @@ set(WIN32 1) +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") + set(WINCE 1) +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(WINDOWS_PHONE 1) +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(WINDOWS_STORE 1) +endif() + set(CMAKE_STATIC_LIBRARY_PREFIX "") set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake deleted file mode 100644 index d28b4ab..0000000 --- a/Modules/Platform/WindowsCE-MSVC.cmake +++ /dev/null @@ -1 +0,0 @@ -include(Platform/Windows-MSVC) diff --git a/Modules/Platform/WindowsPhone-MSVC-C.cmake b/Modules/Platform/WindowsPhone-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsPhone-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsPhone.cmake b/Modules/Platform/WindowsPhone.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsPhone.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/WindowsStore-MSVC-C.cmake b/Modules/Platform/WindowsStore-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsStore-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/WindowsStore-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsStore-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsStore.cmake b/Modules/Platform/WindowsStore.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsStore.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index e034a28..8f21adf 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -103,6 +103,10 @@ function(ProcessorCount var) OUTPUT_VARIABLE machinfo_output) string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}") set(count "${CMAKE_MATCH_1}") + if(NOT count) + string(REGEX MATCHALL "([0-9]+) logical processors" procs "${machinfo_output}") + set(count "${CMAKE_MATCH_1}") + endif() #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'") else() find_program(ProcessorCount_cmd_mpsched mpsched) diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake index 6f32b08..fcb41ab 100644 --- a/Modules/TestBigEndian.cmake +++ b/Modules/TestBigEndian.cmake @@ -25,7 +25,7 @@ # License text for the above reference.) macro(TEST_BIG_ENDIAN VARIABLE) - if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + if(NOT DEFINED HAVE_${VARIABLE}) message(STATUS "Check if the system is big endian") message(STATUS "Searching 16 bit integer") diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake index de4b1f1..78fff9f 100644 --- a/Modules/TestForANSIForScope.cmake +++ b/Modules/TestForANSIForScope.cmake @@ -24,7 +24,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$") +if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE) message(STATUS "Check for ANSI scope") try_compile(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake index 8977583..fe18ea2 100644 --- a/Modules/TestForSSTREAM.cmake +++ b/Modules/TestForSSTREAM.cmake @@ -23,7 +23,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -if("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") +if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM) message(STATUS "Check for sstream") try_compile(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake index e43b75d..0d90774 100644 --- a/Modules/TestForSTDNamespace.cmake +++ b/Modules/TestForSTDNamespace.cmake @@ -23,7 +23,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -if("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$") +if(NOT DEFINED CMAKE_STD_NAMESPACE) message(STATUS "Check for STD namespace") try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 918e2ec..31ab48d 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -73,7 +73,7 @@ macro(SWIG_MODULE_INITIALIZE name language) set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}") set(SWIG_MODULE_${name}_REAL_NAME "${name}") - if (CMAKE_SWIG_FLAGS MATCHES "-noproxy") + if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;") set (SWIG_MODULE_${name}_NOPROXY TRUE) endif () if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN") diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index f2f260d..b3633a6 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -88,8 +88,11 @@ if (wxWidgets_FOUND) endif() if (wxWidgets_CXX_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}") - MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") + # Flags are expected to be a string here, not a list. + string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS_str}") + MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}") + unset(wxWidgets_CXX_FLAGS_str) endif() # DEPRECATED JW diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake index 7d28e95..bf55eb9 100644 --- a/Modules/WriteBasicConfigVersionFile.cmake +++ b/Modules/WriteBasicConfigVersionFile.cmake @@ -6,7 +6,10 @@ # # :: # -# WRITE_BASIC_CONFIG_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion) ) +# WRITE_BASIC_CONFIG_VERSION_FILE( filename +# [VERSION major.minor.patch] +# COMPATIBILITY (AnyNewerVersion|SameMajorVersion) +# ) # # # diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 6e64cd2..86137e2 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -52,7 +52,15 @@ # Feature Test Macros # =================== # -# For each compiler, a preprocessor test of the compiler version is generated +# For each compiler, a preprocessor macro is generated matching +# ``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0`` +# or ``1``, depending on the compiler in use. Preprocessor macros for +# compiler version components are generated matching +# ``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR`` +# and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values +# for the corresponding compiler version components, if defined. +# +# A preprocessor test is generated based on the compiler version # denoting whether each feature is enabled. A preprocessor macro # matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the # upper-case ``<feature>`` name, is generated to contain the value @@ -91,14 +99,14 @@ # # .. code-block:: c++ # -# class MyClass ClimbingStats_DECL_CXX_FINAL +# class MyClass ClimbingStats_FINAL # { -# ClimbingStats_DECL_CXX_CONSTEXPR int someInterface() { return 42; } +# ClimbingStats_CONSTEXPR int someInterface() { return 42; } # }; # -# The ``ClimbingStats_DECL_CXX_FINAL`` macro will expand to ``final`` if the +# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the # compiler (and its flags) support the ``cxx_final`` feature, and the -# ``ClimbingStats_DECL_CXX_CONSTEXPR`` macro will expand to ``constexpr`` +# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr`` # if ``cxx_constexpr`` is supported. # # The following features generate corresponding symbol defines: @@ -138,6 +146,16 @@ # ``[[deprecated]]`` attribute or a compiler-specific decorator such # as ``__attribute__((__deprecated__))`` used by GNU compilers. # +# The ``cxx_alignas`` feature provides a macro definition +# ``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas`` +# decorator or a compiler-specific decorator such as +# ``__attribute__ ((__aligned__))`` used by GNU compilers. +# +# The ``cxx_alignof`` feature provides a macro definition +# ``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof`` +# decorator or a compiler-specific decorator such as ``__alignof__`` +# used by GNU compilers. +# # ============================= ================================ ===================== # Feature Define Symbol # ============================= ================================ ===================== @@ -187,6 +205,8 @@ function(_load_compiler_variables CompilerId lang) foreach(feature ${ARGN}) set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE) endforeach() + include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL) + set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE) endfunction() function(write_compiler_detection_header @@ -215,22 +235,44 @@ function(write_compiler_detection_header message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}") endif() + if (prefix_arg STREQUAL "") + message(FATAL_ERROR "A prefix must be specified") + endif() + string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix) + if (NOT prefix_arg STREQUAL cleaned_prefix) + message(FATAL_ERROR "The prefix must be a valid C identifier.") + endif() + if(NOT _WCD_VERSION) set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) endif() - if (_WCD_VERSION VERSION_LESS 3.1.0) # Version which introduced this function - message(FATAL_ERROR "VERSION parameter too low.") + set(_min_version 3.1.0) # Version which introduced this function + if (_WCD_VERSION VERSION_LESS _min_version) + set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.") + set(err "${err} It must be set to at least ${_min_version}. ") + set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update") + set(err "${err} your minimum required CMake version with the cmake_minimum_required command.") + message(FATAL_ERROR "${err}") endif() set(compilers GNU Clang ) + + set(_hex_compilers ADSP Borland Embarcadero SunPro) + foreach(_comp ${_WCD_COMPILERS}) list(FIND compilers ${_comp} idx) if (idx EQUAL -1) message(FATAL_ERROR "Unsupported compiler ${_comp}.") endif() + if (NOT _need_hex_conversion) + list(FIND _hex_compilers ${_comp} idx) + if (NOT idx EQUAL -1) + set(_need_hex_conversion TRUE) + endif() + endif() endforeach() set(file_content " @@ -244,6 +286,21 @@ function(write_compiler_detection_header set(file_content "${file_content}\n${_WCD_PROLOG}\n") endif() + if (_need_hex_conversion) + set(file_content "${file_content} +#define ${prefix_arg}_DEC(X) (X) +#define ${prefix_arg}_HEX(X) ( \\ + ((X)>>28 & 0xF) * 10000000 + \\ + ((X)>>24 & 0xF) * 1000000 + \\ + ((X)>>20 & 0xF) * 100000 + \\ + ((X)>>16 & 0xF) * 10000 + \\ + ((X)>>12 & 0xF) * 1000 + \\ + ((X)>>8 & 0xF) * 100 + \\ + ((X)>>4 & 0xF) * 10 + \\ + ((X) & 0xF) \\ + )\n") + endif() + foreach(feature ${_WCD_FEATURES}) if (feature MATCHES "^cxx_") list(APPEND _langs CXX) @@ -287,6 +344,21 @@ function(write_compiler_detection_header # if !(${_cmake_oldestSupported_${compiler}}) # error Unsupported compiler version # endif\n") + + set(PREFIX ${prefix_arg}_) + if (_need_hex_conversion) + set(MACRO_DEC ${prefix_arg}_DEC) + set(MACRO_HEX ${prefix_arg}_HEX) + else() + set(MACRO_DEC) + set(MACRO_HEX) + endif() + string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY) + set(file_content "${file_content}${VERSION_BLOCK}\n") + set(PREFIX) + set(MACRO_DEC) + set(MACRO_HEX) + set(pp_if "elif") foreach(feature ${${_lang}_features}) string(TOUPPER ${feature} feature_upper) @@ -322,7 +394,7 @@ function(write_compiler_detection_header \n") endif() if (feature STREQUAL cxx_constexpr) - set(def_value "${prefix_arg}_DECL_${feature_upper}") + set(def_value "${prefix_arg}_CONSTEXPR") set(file_content "${file_content} # if ${def_name} # define ${def_value} constexpr @@ -332,7 +404,7 @@ function(write_compiler_detection_header \n") endif() if (feature STREQUAL cxx_final) - set(def_value "${prefix_arg}_DECL_${feature_upper}") + set(def_value "${prefix_arg}_FINAL") set(file_content "${file_content} # if ${def_name} # define ${def_value} final @@ -342,7 +414,7 @@ function(write_compiler_detection_header \n") endif() if (feature STREQUAL cxx_override) - set(def_value "${prefix_arg}_DECL_${feature_upper}") + set(def_value "${prefix_arg}_OVERRIDE") set(file_content "${file_content} # if ${def_name} # define ${def_value} override @@ -364,7 +436,7 @@ function(write_compiler_detection_header set(file_content "${file_content} # if ${def_name} # define ${def_value} alignas(X) -# elif ${prefix_arg}_COMPILER_IS_GNU +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang # define ${def_value} __attribute__ ((__aligned__(X))) # else # define ${def_value} @@ -376,7 +448,7 @@ function(write_compiler_detection_header set(file_content "${file_content} # if ${def_name} # define ${def_value} alignof(X) -# elif ${prefix_arg}_COMPILER_IS_GNU +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang # define ${def_value} __alignof__(X) # endif \n") @@ -431,10 +503,10 @@ function(write_compiler_detection_header # if ${def_name} # define ${def_value} [[deprecated]] # define ${def_value}_MSG(MSG) [[deprecated(MSG)]] -# elif defined(__GNUC__) || defined(__clang__) +# elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang # define ${def_value} __attribute__((__deprecated__)) # define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG))) -# elif defined(_MSC_VER) +# elif ${prefix_arg}_COMPILER_IS_MSVC # define ${def_value} __declspec(deprecated) # define ${def_value}_MSG(MSG) __declspec(deprecated(MSG)) # else |