diff options
Diffstat (limited to 'Modules')
30 files changed, 566 insertions, 484 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index e55b83f..fd1d5fb 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -89,16 +89,18 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) endif() # Parse implicit include directory for this language, if available. - set (implicit_incdirs "") if(CMAKE_${lang}_VERBOSE_FLAG) + set (implicit_incdirs "") cmake_parse_implicit_include_info("${OUTPUT}" "${lang}" implicit_incdirs log rv) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Parsed ${lang} implicit include dir info from above output: rv=${rv}\n${log}\n\n") - if("${rv}" STREQUAL "done") # update parent if parse completed ok - set(CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "${implicit_incdirs}" PARENT_SCOPE) + if("${rv}" STREQUAL "done") + # We parsed implicit include directories, so override the default initializer. + set(_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT "${implicit_incdirs}") endif() endif() + set(CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "${_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT}" PARENT_SCOPE) # Parse implicit linker information for this language, if available. set(implicit_dirs "") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 5eb7ac9..2f84c8e 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -332,6 +332,8 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} if("${lang}" STREQUAL "Swift") if(CMAKE_Swift_LANGUAGE_VERSION) set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};") + elseif(XCODE_VERSION VERSION_GREATER_EQUAL 10.2) + set(id_lang_version "SWIFT_VERSION = 4.0;") elseif(XCODE_VERSION VERSION_GREATER_EQUAL 8.3) set(id_lang_version "SWIFT_VERSION = 3.0;") else() diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 211406d..21e24b7 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -27,9 +27,52 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endif() + # PGI compiler + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "PGI") + # pgc++ verbose output differs + if(("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "Fortran") AND + "${line}" MATCHES "^/" AND + "${line}" MATCHES "/pgc |/pgf901 |/pgftnc " AND + "${line}" MATCHES " -cmdline ") + # cmdline has unparsed cmdline, remove it + string(REGEX REPLACE "-cmdline .*" "" line "${line}") + if("${line}" MATCHES " -nostdinc ") + set(rv "") # defined, but empty + else() + string(REGEX MATCHALL " -stdinc ([^ ]*)" incs "${line}") + foreach(inc IN LISTS incs) + string(REGEX REPLACE " -stdinc ([^ ]*)" "\\1" idir "${inc}") + string(REPLACE ":" ";" idir "${idir}") + list(APPEND rv ${idir}) + endforeach() + endif() + if(DEFINED rv) + string(APPEND log " got implicit includes via PGI C/F parser!\n") + else() + string(APPEND log " warning: PGI C/F parse failed!\n") + endif() + elseif("${lang}" STREQUAL "CXX" AND "${line}" MATCHES "^/" AND + "${line}" MATCHES "/pggpp1 " AND "${line}" MATCHES " -I") + # oddly, -Mnostdinc does not get rid of system -I's, at least in + # PGI 18.10.1 ... + string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") + if(NOT "${idir}" STREQUAL "-") # filter out "-I-" + list(APPEND rv "${idir}") + endif() + endforeach() + if(DEFINED rv) + string(APPEND log " got implicit includes via PGI CXX parser!\n") + else() + string(APPEND log " warning: PGI CXX parse failed!\n") + endif() + endif() + endif() + # SunPro compiler if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "SunPro" AND - "${line}" MATCHES "-D__SUNPRO_C") + ("${line}" MATCHES "-D__SUNPRO_C" OR "${line}" MATCHES "-D__SUNPRO_F") ) string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") foreach(inc IN LISTS incs) string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") @@ -38,8 +81,10 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endforeach() if(rv) - # /usr/include appears to be hardwired in - list(APPEND rv "/usr/include") + if ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") + # /usr/include appears to be hardwired in + list(APPEND rv "/usr/include") + endif() string(APPEND log " got implicit includes via sunpro parser!\n") else() string(APPEND log " warning: sunpro parse failed!\n") diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake index d34154c..b3c96ee 100644 --- a/Modules/Compiler/Cray-C.cmake +++ b/Modules/Compiler/Cray-C.cmake @@ -8,13 +8,13 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) - set(CMAKE_C90_STANDARD_COMPILE_OPTION -h noc99,conform) - set(CMAKE_C90_EXTENSION_COMPILE_OPTION -h noc99,gnu) - set(CMAKE_C99_STANDARD_COMPILE_OPTION -h c99,conform) - set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-h noc99,conform") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-h noc99,gnu") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-h c99,conform") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-h c99,gnu") if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5) - set(CMAKE_C11_STANDARD_COMPILE_OPTION -h std=c11,conform) - set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-h std=c11,conform") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-h std=c11,gnu") endif () endif () diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake index ff97e92..bbb5718 100644 --- a/Modules/Compiler/Cray-CXX.cmake +++ b/Modules/Compiler/Cray-CXX.cmake @@ -2,21 +2,21 @@ # file Copyright.txt or https://cmake.org/licensing for details. include(Compiler/Cray) -__compiler_cray(C) +__compiler_cray(CXX) string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG") string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform) - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-h conform") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-h gnu") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11) - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-h std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-h std=c++11,gnu") endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6) - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14) - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-h std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-h std=c++14,gnu") endif () endif () diff --git a/Modules/Compiler/CrayPrgEnv-C.cmake b/Modules/Compiler/CrayPrgEnv-C.cmake index 6b461ce..76aa93b 100644 --- a/Modules/Compiler/CrayPrgEnv-C.cmake +++ b/Modules/Compiler/CrayPrgEnv-C.cmake @@ -4,8 +4,4 @@ endif() set(__craylinux_crayprgenv_c 1) include(Compiler/CrayPrgEnv) -macro(__CrayPrgEnv_setup_C compiler_cmd link_cmd) - __CrayPrgEnv_setup(C - ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c - ${compiler_cmd} ${link_cmd}) -endmacro() +__CrayPrgEnv_setup(C) diff --git a/Modules/Compiler/CrayPrgEnv-CXX.cmake b/Modules/Compiler/CrayPrgEnv-CXX.cmake index aad85b6..442370e 100644 --- a/Modules/Compiler/CrayPrgEnv-CXX.cmake +++ b/Modules/Compiler/CrayPrgEnv-CXX.cmake @@ -4,8 +4,4 @@ endif() set(__craylinux_crayprgenv_cxx 1) include(Compiler/CrayPrgEnv) -macro(__CrayPrgEnv_setup_CXX compiler_cmd link_cmd) - __CrayPrgEnv_setup(CXX - ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp - ${compiler_cmd} ${link_cmd}) -endmacro() +__CrayPrgEnv_setup(CXX) diff --git a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake deleted file mode 100644 index 547a4b4..0000000 --- a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_cray_c) - return() -endif() -set(__craylinux_crayprgenv_cray_c 1) - -include(Compiler/CrayPrgEnv-C) -__CrayPrgEnv_setup_C("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake deleted file mode 100644 index df8452c..0000000 --- a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_cray_cxx) - return() -endif() -set(__craylinux_crayprgenv_cray_cxx 1) - -include(Compiler/CrayPrgEnv-CXX) -__CrayPrgEnv_setup_CXX("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake deleted file mode 100644 index 9f46a04..0000000 --- a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_cray_fortran) - return() -endif() -set(__craylinux_crayprgenv_cray_fortran 1) - -include(Compiler/CrayPrgEnv-Fortran) -__CrayPrgEnv_setup_Fortran("/opt/cray/cce/.*/ftnfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Fortran.cmake index 9c4d269..85f82d3 100644 --- a/Modules/Compiler/CrayPrgEnv-Fortran.cmake +++ b/Modules/Compiler/CrayPrgEnv-Fortran.cmake @@ -4,8 +4,4 @@ endif() set(__craylinux_crayprgenv_fortran 1) include(Compiler/CrayPrgEnv) -macro(__CrayPrgEnv_setup_Fortran compiler_cmd link_cmd) - __CrayPrgEnv_setup(Fortran - ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F - ${compiler_cmd} ${link_cmd}) -endmacro() +__CrayPrgEnv_setup(Fortran) diff --git a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake deleted file mode 100644 index 248081b..0000000 --- a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_gnu_c) - return() -endif() -set(__craylinux_crayprgenv_gnu_c 1) - -include(Compiler/CrayPrgEnv-C) -__CrayPrgEnv_setup_C("/opt/gcc/.*/cc1" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake deleted file mode 100644 index be4eb6d..0000000 --- a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_gnu_cxx) - return() -endif() -set(__craylinux_crayprgenv_gnu_cxx 1) - -include(Compiler/CrayPrgEnv-CXX) -__CrayPrgEnv_setup_CXX("/opt/gcc/.*/cc1plus" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake deleted file mode 100644 index 8bd23ff..0000000 --- a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_gnu_fortran) - return() -endif() -set(__craylinux_crayprgenv_gnu_fortran 1) - -include(Compiler/CrayPrgEnv-Fortran) -__CrayPrgEnv_setup_Fortran("/opt/gcc/.*/f951" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake deleted file mode 100644 index 83c4e38..0000000 --- a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_intel_c) - return() -endif() -set(__craylinux_crayprgenv_intel_c 1) - -include(Compiler/CrayPrgEnv-C) -__CrayPrgEnv_setup_C("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake deleted file mode 100644 index 3c3c3e6..0000000 --- a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_intel_cxx) - return() -endif() -set(__craylinux_crayprgenv_intel_cxx 1) - -include(Compiler/CrayPrgEnv-CXX) -__CrayPrgEnv_setup_CXX("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake deleted file mode 100644 index 08a316d..0000000 --- a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_intel_fortran) - return() -endif() -set(__craylinux_crayprgenv_intel_fortran 1) - -include(Compiler/CrayPrgEnv-Fortran) -__CrayPrgEnv_setup_Fortran("/opt/intel/.*/fortcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake deleted file mode 100644 index f45767c..0000000 --- a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_pgi_c) - return() -endif() -set(__craylinux_crayprgenv_pgi_c 1) - -include(Compiler/CrayPrgEnv-C) -__CrayPrgEnv_setup_C("/opt/pgi/[^ ]*/pgc" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake deleted file mode 100644 index a2a286f..0000000 --- a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_pgi_cxx) - return() -endif() -set(__craylinux_crayprgenv_pgi_cxx 1) - -include(Compiler/CrayPrgEnv-CXX) -__CrayPrgEnv_setup_CXX("/opt/pgi/[^ ]*/pgcpp" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake deleted file mode 100644 index f6ba7c0..0000000 --- a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(__craylinux_crayprgenv_pgi_fortran) - return() -endif() -set(__craylinux_crayprgenv_pgi_fortran 1) - -include(Compiler/CrayPrgEnv-Fortran) -__CrayPrgEnv_setup_Fortran("/opt/pgi/[^ ]*/pgf" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index 05e3fc7..6c1c770 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -4,54 +4,7 @@ if(__craylinux_crayprgenv) endif() set(__craylinux_crayprgenv 1) -macro(__cray_extract_args cmd tag_regex out_var make_absolute) - string(REGEX MATCHALL "${tag_regex}" args "${cmd}") - foreach(arg IN LISTS args) - string(REGEX REPLACE "^${tag_regex}$" "\\2" param "${arg}") - if(make_absolute) - get_filename_component(param "${param}" ABSOLUTE) - endif() - list(APPEND ${out_var} ${param}) - endforeach() -endmacro() - -function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var link_dirs_var link_libs_var) - set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CrayExtractImplicit_${lang}.bin") - execute_process( - COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_VERBOSE_FLAG} -o ${BIN} - RESULT_VARIABLE result - OUTPUT_VARIABLE output - ERROR_VARIABLE error - ) - if(EXISTS "${BIN}") - file(REMOVE "${BIN}") - endif() - set(include_dirs) - set(link_dirs) - set(link_libs) - string(REGEX REPLACE "\r?\n" ";" output_lines "${output}\n${error}") - foreach(line IN LISTS output_lines) - if("${line}" MATCHES "${compiler_cmd}") - __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs 1) - set(processed_include 1) - endif() - if("${line}" MATCHES "${link_cmd}") - __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs 1) - __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs 0) - set(processed_link 1) - endif() - if(processed_include AND processed_link) - break() - endif() - endforeach() - - set(${include_dirs_var} "${include_dirs}" PARENT_SCOPE) - set(${link_dirs_var} "${link_dirs}" PARENT_SCOPE) - set(${link_libs_var} "${link_libs}" PARENT_SCOPE) - set(CRAY_${lang}_EXTRACTED_IMPLICIT 1 CACHE INTERNAL "" FORCE) -endfunction() - -macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) +macro(__CrayPrgEnv_setup lang) if(DEFINED ENV{CRAYPE_VERSION}) message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}") elseif(DEFINED ENV{ASYNCPE_VERSION}) @@ -81,12 +34,4 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_LINK_SEARCH_START_STATIC TRUE) endif() - if(NOT CRAY_${lang}_EXTRACTED_IMPLICIT) - __cray_extract_implicit( - ${test_src} ${compiler_cmd} ${link_cmd} ${lang} - CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES - CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES - CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES - ) - endif() endmacro() diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index c65ae9e..5716b01 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -20,9 +20,12 @@ configure step to use the content in commands like :command:`add_subdirectory`, :command:`include` or :command:`file` operations. Content population details would normally be defined separately from the -command that performs the actual population. Projects should also -check whether the content has already been populated somewhere else in the -project hierarchy. Typical usage would look something like this: +command that performs the actual population. This separation ensures that +all of the dependency details are defined before anything may try to use those +details to populate content. This is particularly important in more complex +project hierarchies where dependencies may be shared between multiple projects. + +The following shows a typical example of declaring content details: .. code-block:: cmake @@ -32,21 +35,37 @@ project hierarchy. Typical usage would look something like this: GIT_TAG release-1.8.0 ) +For most typical cases, populating the content can then be done with a single +command like so: + +.. code-block:: cmake + + FetchContent_MakeAvailable(googletest) + +The above command not only populates the content, it also adds it to the main +build (if possible) so that the main build can use the populated project's +targets, etc. In some cases, the main project may need to have more precise +control over the population or may be required to explicitly define the +population steps (e.g. if CMake versions earlier than 3.14 need to be +supported). The typical pattern of such custom steps looks like this: + +.. code-block:: cmake + FetchContent_GetProperties(googletest) if(NOT googletest_POPULATED) FetchContent_Populate(googletest) add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) endif() -When using the above pattern with a hierarchical project arrangement, -projects at higher levels in the hierarchy are able to define or override -the population details of content specified anywhere lower in the project -hierarchy. The ability to detect whether content has already been -populated ensures that even if multiple child projects want certain content -to be available, the first one to populate it wins. The other child project -can simply make use of the already available content instead of repeating -the population for itself. See the -:ref:`Examples <fetch-content-examples>` section which demonstrates +Regardless of which population method is used, when using the +declare-populate pattern with a hierarchical project arrangement, projects at +higher levels in the hierarchy are able to override the population details of +content specified anywhere lower in the project hierarchy. The ability to +detect whether content has already been populated ensures that even if +multiple child projects want certain content to be available, the first one +to populate it wins. The other child project can simply make use of the +already available content instead of repeating the population for itself. +See the :ref:`Examples <fetch-content-examples>` section which demonstrates this scenario. The ``FetchContent`` module also supports defining and populating @@ -113,6 +132,38 @@ Declaring Content Details Populating The Content ^^^^^^^^^^^^^^^^^^^^^^ +For most common scenarios, population means making content available to the +main build according to previously declared details for that dependency. +There are two main patterns for populating content, one based on calling +:command:`FetchContent_GetProperties` and +:command:`FetchContent_Populate` for more precise control and the other on +calling :command:`FetchContent_MakeAvailable` for a simpler, more automated +approach. The former generally follows this canonical pattern: + +.. _`fetch-content-canonical-pattern`: + +.. code-block:: cmake + + # Check if population has already been performed + FetchContent_GetProperties(<name>) + string(TOLOWER "<name>" lcName) + if(NOT ${lcName}_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(<name>) + + # Set custom variables, policies, etc. + # ... + + # Bring the populated content into the build + add_subdirectory(${${lcName}_SOURCE_DIR} ${${lcName}_BINARY_DIR}) + endif() + +The above is such a common pattern that, where no custom steps are needed +between the calls to :command:`FetchContent_Populate` and +:command:`add_subdirectory`, equivalent logic can be obtained by calling +:command:`FetchContent_MakeAvailable` instead (and should be preferred where +it meets the needs of the project). + .. command:: FetchContent_Populate .. code-block:: cmake @@ -309,9 +360,6 @@ Populating The Content on the command line invoking the script. -Retrieve Population Properties -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - .. command:: FetchContent_GetProperties When using saved content details, a call to :command:`FetchContent_Populate` @@ -343,28 +391,65 @@ Retrieve Population Properties FetchContent_GetProperties(foobar) if(NOT foobar_POPULATED) FetchContent_Populate(foobar) - - # Set any custom variables, etc. here, then - # populate the content as part of this build - - add_subdirectory(${foobar_SOURCE_DIR} ${foobar_BINARY_DIR}) + ... endif() The above pattern allows other parts of the overall project hierarchy to re-use the same content and ensure that it is only populated once. +.. command:: FetchContent_MakeAvailable + + .. code-block:: cmake + + FetchContent_MakeAvailable( <name1> [<name2>...] ) + + This command implements the common pattern typically needed for most + dependencies. It iterates over each of the named dependencies in turn + and for each one it loosely follows the same + :ref:`canonical pattern <fetch-content-canonical-pattern>` as + presented at the beginning of this section. One small difference to + that pattern is that it will only call :command:`add_subdirectory` on the + populated content if there is a ``CMakeLists.txt`` file in its top level + source directory. This allows the command to be used for dependencies + that make downloaded content available at a known location but which do + not need or support being added directly to the build. + + .. _`fetch-content-examples`: Examples ^^^^^^^^ -Consider a project hierarchy where ``projA`` is the top level project and it -depends on projects ``projB`` and ``projC``. Both ``projB`` and ``projC`` -can be built standalone and they also both depend on another project -``projD``. For simplicity, this example will assume that all four projects -are available on a company git server. The ``CMakeLists.txt`` of each project -might have sections like the following: +This first fairly straightforward example ensures that some popular testing +frameworks are available to the main build: + +.. code-block:: cmake + + include(FetchContent) + FetchContent_Declare( + googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-1.8.0 + ) + FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.5.0 + ) + + # After the following call, the CMake targets defined by googletest and + # Catch2 will be defined and available to the rest of the build + FetchContent_MakeAvailable(googletest Catch2) + + +In more complex project hierarchies, the dependency relationships can be more +complicated. Consider a hierarchy where ``projA`` is the top level project and +it depends directly on projects ``projB`` and ``projC``. Both ``projB`` and +``projC`` can be built standalone and they also both depend on another project +``projD``. ``projB`` additionally depends on ``projE``. This example assumes +that all five projects are available on a company git server. The +``CMakeLists.txt`` of each project might have sections like the following: *projA*: @@ -373,31 +458,27 @@ might have sections like the following: include(FetchContent) FetchContent_Declare( projB - GIT_REPOSITORY git@mycompany.com/git/projB.git + GIT_REPOSITORY git@mycompany.com:git/projB.git GIT_TAG 4a89dc7e24ff212a7b5167bef7ab079d ) FetchContent_Declare( projC - GIT_REPOSITORY git@mycompany.com/git/projC.git + GIT_REPOSITORY git@mycompany.com:git/projC.git GIT_TAG 4ad4016bd1d8d5412d135cf8ceea1bb9 ) FetchContent_Declare( projD - GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_REPOSITORY git@mycompany.com:git/projD.git GIT_TAG origin/integrationBranch ) + FetchContent_Declare( + projE + GIT_REPOSITORY git@mycompany.com:git/projE.git + GIT_TAG origin/release/2.3-rc1 + ) - FetchContent_GetProperties(projB) - if(NOT projb_POPULATED) - FetchContent_Populate(projB) - add_subdirectory(${projb_SOURCE_DIR} ${projb_BINARY_DIR}) - endif() - - FetchContent_GetProperties(projC) - if(NOT projc_POPULATED) - FetchContent_Populate(projC) - add_subdirectory(${projc_SOURCE_DIR} ${projc_BINARY_DIR}) - endif() + # Order is important, see notes in the discussion further below + FetchContent_MakeAvailable(projD projB projC) *projB*: @@ -406,16 +487,16 @@ might have sections like the following: include(FetchContent) FetchContent_Declare( projD - GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_REPOSITORY git@mycompany.com:git/projD.git GIT_TAG 20b415f9034bbd2a2e8216e9a5c9e632 ) + FetchContent_Declare( + projE + GIT_REPOSITORY git@mycompany.com:git/projE.git + GIT_TAG 68e20f674a48be38d60e129f600faf7d + ) - FetchContent_GetProperties(projD) - if(NOT projd_POPULATED) - FetchContent_Populate(projD) - add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) - endif() - + FetchContent_MakeAvailable(projD projE) *projC*: @@ -424,48 +505,77 @@ might have sections like the following: include(FetchContent) FetchContent_Declare( projD - GIT_REPOSITORY git@mycompany.com/git/projD.git + GIT_REPOSITORY git@mycompany.com:git/projD.git GIT_TAG 7d9a17ad2c962aa13e2fbb8043fb6b8a ) + # This particular version of projD requires workarounds FetchContent_GetProperties(projD) if(NOT projd_POPULATED) FetchContent_Populate(projD) + + # Copy an additional/replacement file into the populated source + file(COPY someFile.c DESTINATION ${projd_SOURCE_DIR}/src) + add_subdirectory(${projd_SOURCE_DIR} ${projd_BINARY_DIR}) endif() A few key points should be noted in the above: - ``projB`` and ``projC`` define different content details for ``projD``, - but ``projA`` also defines a set of content details for ``projD`` and - because ``projA`` will define them first, the details from ``projB`` and + but ``projA`` also defines a set of content details for ``projD``. + Because ``projA`` will define them first, the details from ``projB`` and ``projC`` will not be used. The override details defined by ``projA`` are not required to match either of those from ``projB`` or ``projC``, but it is up to the higher level project to ensure that the details it does define still make sense for the child projects. -- While ``projA`` defined content details for ``projD``, it did not need - to explicitly call ``FetchContent_Populate(projD)`` itself. Instead, it - leaves that to a child project to do (in this case it will be ``projB`` - since it is added to the build ahead of ``projC``). If ``projA`` needed to - customize how the ``projD`` content was brought into the build as well - (e.g. define some CMake variables before calling - :command:`add_subdirectory` after populating), it would do the call to - ``FetchContent_Populate()``, etc. just as it did for the ``projB`` and - ``projC`` content. For higher level projects, it is usually enough to - just define the override content details and leave the actual population - to the child projects. This saves repeating the same thing at each level - of the project hierarchy unnecessarily. -- Even though ``projA`` is the top level project in this example, it still - checks whether ``projB`` and ``projC`` have already been populated before - going ahead to do those populations. This makes ``projA`` able to be more - easily incorporated as a child of some other higher level project in the - future if required. Always protect a call to - :command:`FetchContent_Populate` with a check to - :command:`FetchContent_GetProperties`, even in what may be considered a top - level project at the time. - - -The following example demonstrates how one might download and unpack a +- In the ``projA`` call to :command:`FetchContent_MakeAvailable`, ``projD`` + is listed ahead of ``projB`` and ``projC`` to ensure that ``projA`` is in + control of how ``projD`` is populated. +- While ``projA`` defines content details for ``projE``, it does not need + to explicitly call ``FetchContent_MakeAvailable(projE)`` or + ``FetchContent_Populate(projD)`` itself. Instead, it leaves that to the + child ``projB``. For higher level projects, it is often enough to just + define the override content details and leave the actual population to the + child projects. This saves repeating the same thing at each level of the + project hierarchy unnecessarily. + + +Projects don't always need to add the populated content to the build. +Sometimes the project just wants to make the downloaded content available at +a predictable location. The next example ensures that a set of standard +company toolchain files (and potentially even the toolchain binaries +themselves) is available early enough to be used for that same build. + +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.14) + + include(FetchContent) + FetchContent_Declare( + mycom_toolchains + URL https://intranet.mycompany.com//toolchains_1.3.2.tar.gz + ) + FetchContent_MakeAvailable(mycom_toolchains) + + project(CrossCompileExample) + +The project could be configured to use one of the downloaded toolchains like +so: + +.. code-block:: shell + + cmake -DCMAKE_TOOLCHAIN_FILE=_deps/mycom_toolchains-src/toolchain_arm.cmake /path/to/src + +When CMake processes the ``CMakeLists.txt`` file, it will download and unpack +the tarball into ``_deps/mycompany_toolchains-src`` relative to the build +directory. The :variable:`CMAKE_TOOLCHAIN_FILE` variable is not used until +the :command:`project` command is reached, at which point CMake looks for the +named toolchain file relative to the build directory. Because the tarball has +already been downloaded and unpacked by then, the toolchain file will be in +place, even the very first time that ``cmake`` is run in the build directory. + +Lastly, the following example demonstrates how one might download and unpack a firmware tarball using CMake's :manual:`script mode <cmake(1)>`. The call to :command:`FetchContent_Populate` specifies all the content details and the unpacked firmware will be placed in a ``firmware`` directory below the @@ -921,3 +1031,31 @@ function(FetchContent_Populate contentName) set(${contentNameLower}_POPULATED True PARENT_SCOPE) endfunction() + +# Arguments are assumed to be the names of dependencies that have been +# declared previously and should be populated. It is not an error if +# any of them have already been populated (they will just be skipped in +# that case). The command is implemented as a macro so that the variables +# defined by the FetchContent_GetProperties() and FetchContent_Populate() +# calls will be available to the caller. +macro(FetchContent_MakeAvailable) + + foreach(contentName IN ITEMS ${ARGV}) + string(TOLOWER ${contentName} contentNameLower) + FetchContent_GetProperties(${contentName}) + if(NOT ${contentNameLower}_POPULATED) + FetchContent_Populate(${contentName}) + + # Only try to call add_subdirectory() if the populated content + # can be treated that way. Protecting the call with the check + # allows this function to be used for projects that just want + # to ensure the content exists, such as to provide content at + # a known location. + if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt) + add_subdirectory(${${contentNameLower}_SOURCE_DIR} + ${${contentNameLower}_BINARY_DIR}) + endif() + endif() + endforeach() + +endmacro() diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index b6348fd..0aa4f50 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -13,62 +13,76 @@ list of libraries searched for is taken from the autoconf macro file, acx_blas.m4 (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_blas.html). -This module sets the following variables: - -:: - - BLAS_FOUND - set to true if a library implementing the BLAS interface - is found - BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l - and -L). - BLAS_LIBRARIES - uncached list of libraries (using full path name) to - link against to use BLAS (may be empty if compiler implicitly links - BLAS) - BLAS95_LIBRARIES - uncached list of libraries (using full path name) - to link against to use BLAS95 interface - BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface - is found - -The following variables can be used to control this module: - -:: - - BLA_STATIC if set on this determines what kind of linkage we do (static) - BLA_VENDOR if set checks only the specified vendor, if not set checks - all the possibilities - BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK - BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS - library first and if one is found that is preferred - -List of vendors (BLA_VENDOR) valid in this module: - -* Goto -* OpenBLAS -* FLAME -* ATLAS PhiPACK -* CXML -* DXML -* SunPerf -* SCSL -* SGIMATH -* IBMESSL -* Intel10_32 (intel mkl v10 32 bit) -* Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model) -* Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model) -* Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model) -* Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model) -* Intel (older versions of mkl 32 and 64 bit) -* ACML -* ACML_MP -* ACML_GPU -* Apple -* NAS -* Generic +Input Variables +^^^^^^^^^^^^^^^ + +The following variables may be set to influence this module's behavior: + +``BLA_STATIC`` + if ``ON`` use static linkage + +``BLA_VENDOR`` + If set, checks only the specified vendor, if not set checks all the + possibilities. List of vendors valid in this module: + + * Goto + * OpenBLAS + * FLAME + * ATLAS PhiPACK + * CXML + * DXML + * SunPerf + * SCSL + * SGIMATH + * IBMESSL + * Intel10_32 (intel mkl v10 32 bit) + * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model) + * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model) + * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model) + * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model) + * Intel (obsolete versions of mkl 32 and 64 bit) + * ACML + * ACML_MP + * ACML_GPU + * Apple + * NAS + * Generic + +``BLA_F95`` + if ``ON`` tries to find the BLAS95 interfaces + +``BLA_PREFER_PKGCONFIG`` + if set pkg-config will be used to search for a BLAS library first + and if one is found that is preferred + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``BLAS_FOUND`` + library implementing the BLAS interface is found +``BLAS_LINKER_FLAGS`` + uncached list of required linker flags (excluding -l and -L). +``BLAS_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use BLAS (may be empty if compiler implicitly links BLAS) +``BLAS95_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use BLAS95 interface +``BLAS95_FOUND`` + library implementing the BLAS95 interface is found .. note:: - C/CXX should be enabled to use Intel mkl + C or CXX must be enabled to use Intel MKL + For example, to use Intel MKL libraries and/or Intel compiler: + + .. code-block:: cmake + + set(BLA_VENDOR Intel10_64lp) + find_package(BLAS) #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) @@ -167,7 +181,6 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) endif() set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) endif() if(_libraries_work) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 7619664..d6646ea 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -14,35 +14,62 @@ The approach follows that taken for the autoconf macro file, acx_lapack.m4 (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). -This module sets the following variables: - -:: - - LAPACK_FOUND - set to true if a library implementing the LAPACK interface - is found - LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l - and -L). - LAPACK_LIBRARIES - uncached list of libraries (using full path name) to - link against to use LAPACK - LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to - link against to use LAPACK95 - LAPACK95_FOUND - set to true if a library implementing the LAPACK f95 - interface is found - BLA_STATIC if set on this determines what kind of linkage we do (static) - BLA_VENDOR if set checks only the specified vendor, if not set checks - all the possibilities - BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK - -List of vendors (BLA_VENDOR) valid in this module: - -* Intel(mkl) -* OpenBLAS -* FLAME -* ACML -* Apple -* NAS -* Generic - +Input Variables +^^^^^^^^^^^^^^^ + +The following variables may be set to influence this module's behavior: + +``BLA_STATIC`` + if ``ON`` use static linkage + +``BLA_VENDOR`` + If set, checks only the specified vendor, if not set checks all the + possibilities. List of vendors valid in this module: + + * ``Intel10_32`` (intel mkl v10 32 bit) + * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) + * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) + * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) + * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model) + * ``Intel`` (obsolete versions of mkl 32 and 64 bit) + * ``OpenBLAS`` + * ``FLAME`` + * ``ACML`` + * ``Apple`` + * ``NAS`` + * ``Generic`` + +``BLA_F95`` + if ``ON`` tries to find BLAS95/LAPACK95 + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LAPACK_FOUND`` + library implementing the LAPACK interface is found +``LAPACK_LINKER_FLAGS`` + uncached list of required linker flags (excluding -l and -L). +``LAPACK_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use LAPACK +``LAPACK95_LIBRARIES`` + uncached list of libraries (using full path name) to link against + to use LAPACK95 +``LAPACK95_FOUND`` + library implementing the LAPACK95 interface is found + +.. note:: + + C or CXX must be enabled to use Intel MKL + + For example, to use Intel MKL libraries and/or Intel compiler: + + .. code-block:: cmake + + set(BLA_VENDOR Intel10_64lp) + find_package(LAPACK) #]=======================================================================] set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -113,7 +140,7 @@ foreach(_library ${_list}) set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) endif () else () - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") # for ubuntu's libblas3gf and liblapack3gf packages set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif () @@ -142,7 +169,6 @@ if(_libraries_work) check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) endif () set(CMAKE_REQUIRED_LIBRARIES) - mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") endif() diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake index 0eba3d9..3adaa44 100644 --- a/Modules/FindXalanC.cmake +++ b/Modules/FindXalanC.cmake @@ -76,7 +76,7 @@ find_path(XalanC_INCLUDE_DIR DOC "Xalan-C++ include directory") mark_as_advanced(XalanC_INCLUDE_DIR) -if(XalanC_INCLUDE_DIR) +if(XalanC_INCLUDE_DIR AND EXISTS "${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp") _XalanC_GET_VERSION("${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp") endif() diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 085fafc..47bfd62 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -74,7 +74,7 @@ find_path(XercesC_INCLUDE_DIR DOC "Xerces-C++ include directory") mark_as_advanced(XercesC_INCLUDE_DIR) -if(XercesC_INCLUDE_DIR) +if(XercesC_INCLUDE_DIR AND EXISTS "${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") _XercesC_GET_VERSION("${XercesC_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp") endif() diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index fc22fce..4ae4514 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -69,14 +69,17 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES ) # Default per-language values. These may be later replaced after -# parsing the implicit link directories from compiler output. -list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES +# parsing the implicit directory information from compiler output. +set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT + ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} /usr/include ) -list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES +set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT + ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} /usr/include ) -list(APPEND CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES +set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT + ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES} /usr/include ) diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake index 767fec5..06d8f50 100644 --- a/Modules/Platform/Windows-Intel-C.cmake +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -1,2 +1,4 @@ include(Platform/Windows-Intel) __windows_compiler_intel(C) +set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake +set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <OBJECT> -QMF <DEPFILE>") diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index 84cd303..666de6e 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,3 +1,5 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") __windows_compiler_intel(CXX) +set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake +set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <OBJECT> -QMF <DEPFILE>") diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 2bcd28e..5600b4c 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -446,7 +446,7 @@ function (__java_copy_file src dest comment) endfunction () function(__java_lcat VAR) - foreach(_line ${ARGN}) + foreach(_line IN LISTS ARGN) string(APPEND ${VAR} "${_line}\n") endforeach() @@ -568,7 +568,7 @@ function(add_jar _TARGET_NAME) set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif() - foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) + foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH) string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach() @@ -592,7 +592,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) set(_JAVA_RESOURCE_FILES_RELATIVE) - foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) + foreach(_JAVA_SOURCE_FILE IN LISTS _JAVA_SOURCE_FILES) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) @@ -607,7 +607,7 @@ function(add_jar _TARGET_NAME) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) - if (${_BIN_LEN} LESS ${_SRC_LEN}) + if (_BIN_LEN LESS _SRC_LEN) set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) else () set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) @@ -637,7 +637,7 @@ function(add_jar _TARGET_NAME) endif () endforeach() - foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS}) + foreach(_JAVA_INCLUDE_JAR IN LISTS _add_jar_INCLUDE_JARS) if (TARGET ${_JAVA_INCLUDE_JAR}) get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) if (_JAVA_JAR_PATH) @@ -705,7 +705,7 @@ function(add_jar _TARGET_NAME) # create the jar file set(_JAVA_JAR_OUTPUT_PATH - ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + "${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}") if (CMAKE_JNI_TARGET) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} @@ -903,15 +903,15 @@ function (find_jar VARIABLE) set(_state "name") - foreach (arg ${ARGN}) - if (${_state} STREQUAL "name") - if (${arg} STREQUAL "VERSIONS") + foreach (arg IN LISTS ARGN) + if (_state STREQUAL "name") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_names ${arg}) @@ -919,22 +919,22 @@ function (find_jar VARIABLE) set(_jar_doc "Finding ${arg} jar") endif () endif () - elseif (${_state} STREQUAL "versions") - if (${arg} STREQUAL "NAMES") + elseif (_state STREQUAL "versions") + if (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_versions ${_jar_versions} ${arg}) endif () - elseif (${_state} STREQUAL "names") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "names") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_names ${_jar_names} ${arg}) @@ -942,22 +942,22 @@ function (find_jar VARIABLE) set(_jar_doc "Finding ${arg} jar") endif () endif () - elseif (${_state} STREQUAL "paths") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "paths") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_paths ${_jar_paths} ${arg}) endif () - elseif (${_state} STREQUAL "doc") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "doc") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") else () set(_jar_doc ${arg}) @@ -969,8 +969,8 @@ function (find_jar VARIABLE) message(FATAL_ERROR "find_jar: No name to search for given") endif () - foreach (jar_name ${_jar_names}) - foreach (version ${_jar_versions}) + foreach (jar_name IN LISTS _jar_names) + foreach (version IN LISTS _jar_versions) set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) endforeach () set(_jar_files ${_jar_files} ${jar_name}.jar) @@ -997,252 +997,252 @@ function(create_javadoc _target) set(_state "package") - foreach (arg ${ARGN}) - if (${_state} STREQUAL "package") - if (${arg} STREQUAL "PACKAGES") + foreach (arg IN LISTS ARGN) + if (_state STREQUAL "package") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_packages ${arg}) set(_state "packages") endif () - elseif (${_state} STREQUAL "packages") - if (${arg} STREQUAL "FILES") + elseif (_state STREQUAL "packages") + if (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_packages ${arg}) endif () - elseif (${_state} STREQUAL "files") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "files") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_files ${arg}) endif () - elseif (${_state} STREQUAL "sourcepath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "sourcepath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_sourcepath ${arg}) endif () - elseif (${_state} STREQUAL "classpath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "classpath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_classpath ${arg}) endif () - elseif (${_state} STREQUAL "installpath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "installpath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_installpath ${arg}) endif () - elseif (${_state} STREQUAL "doctitle") + elseif (_state STREQUAL "doctitle") if (${arg} STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_doctitle ${arg}) endif () - elseif (${_state} STREQUAL "windowtitle") + elseif (_state STREQUAL "windowtitle") if (${arg} STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_windowtitle ${arg}) endif () - elseif (${_state} STREQUAL "author") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "author") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_author ${arg}) endif () - elseif (${_state} STREQUAL "use") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "use") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_use ${arg}) endif () - elseif (${_state} STREQUAL "version") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "version") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_version ${arg}) @@ -1255,7 +1255,7 @@ function(create_javadoc _target) if (_javadoc_sourcepath) set(_start TRUE) - foreach(_path ${_javadoc_sourcepath}) + foreach(_path IN LISTS _javadoc_sourcepath) if (_start) set(_sourcepath ${_path}) set(_start FALSE) @@ -1268,7 +1268,7 @@ function(create_javadoc _target) if (_javadoc_classpath) set(_start TRUE) - foreach(_path ${_javadoc_classpath}) + foreach(_path IN LISTS _javadoc_classpath) if (_start) set(_classpath ${_path}) set(_start FALSE) @@ -1435,7 +1435,7 @@ function(export_jars) # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}") set(__targetdefs__ "") - foreach(_target ${_export_jars_TARGETS}) + foreach(_target IN LISTS _export_jars_TARGETS) get_target_property(_jarpath ${_target} JAR_FILE) get_filename_component(_jarpath ${_jarpath} PATH) __java_export_jar(__targetdefs__ ${_target} "${_jarpath}") @@ -1473,7 +1473,7 @@ function(install_jar_exports) endif() # Determine relative path from installed export file to install prefix - if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION}) + if(IS_ABSOLUTE "${_install_jar_exports_DESTINATION}") file(RELATIVE_PATH _relpath ${_install_jar_exports_DESTINATION} ${CMAKE_INSTALL_PREFIX} @@ -1492,7 +1492,7 @@ function(install_jar_exports) # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}") set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n") - foreach(_target ${_install_jar_exports_TARGETS}) + foreach(_target IN LISTS _install_jar_exports_TARGETS) get_target_property(_dir ${_target} INSTALL_DESTINATION) __java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}") endforeach() |