diff options
Diffstat (limited to 'cmake/QtFlagHandlingHelpers.cmake')
-rw-r--r-- | cmake/QtFlagHandlingHelpers.cmake | 379 |
1 files changed, 270 insertions, 109 deletions
diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake index b36f6cff0c..6a62b85c03 100644 --- a/cmake/QtFlagHandlingHelpers.cmake +++ b/cmake/QtFlagHandlingHelpers.cmake @@ -1,49 +1,156 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +# Sets '${var}' to a genex that extracts the target's property. +# Sets 'have_${var}' to a genex that checks that the property has a +# non-empty value. +macro(qt_internal_genex_get_property var target property) + set(${var} "$<TARGET_PROPERTY:${target},${property}>") + set(have_${var} "$<BOOL:${${var}}>") +endmacro() + +# Sets '${var}' to a genex that will join the given property values +# using '${glue}' and will surround the entire output with '${prefix}' +# and '${suffix}'. +macro(qt_internal_genex_get_joined_property var target property prefix suffix glue) + qt_internal_genex_get_property("${var}" "${target}" "${property}") + set(${var} + "$<${have_${var}}:${prefix}$<JOIN:${${var}},${glue}>${suffix}>") +endmacro() + +# This function generates LD version script for the target and uses it in the target linker line. +# Function has two modes dependending on the specified arguments. +# Arguments: +# PRIVATE_CONTENT_FILE specifies the pre-cooked content of Qt_<version>_PRIVATE_API section. +# Requires the content file available at build time. function(qt_internal_add_linker_version_script target) - qt_parse_all_arguments(arg "qt_internal_add_linker" "" "" "PRIVATE_HEADERS" ${ARGN}) + if(WASM) + return() + endif() + + cmake_parse_arguments(PARSE_ARGV 1 arg + "" + "PRIVATE_CONTENT_FILE" + "PRIVATE_HEADERS" + ) + _qt_internal_validate_all_args_are_parsed(arg) + + if(arg_PRIVATE_CONTENT_FILE AND arg_PRIVATE_HEADERS) + message(FATAL_ERROR "Both PRIVATE_CONTENT_FILE and PRIVATE_HEADERS are specified.") + endif() + + if(TEST_ld_version_script) + # Create a list of mangled symbol matches for all "std::" symbols. This + # list will catch most symbols, but will miss global-namespace symbols + # that only have std parameters. + # See https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.name for reference + set(contents "NonQt {\nlocal:") + + # For types: vtable, VTT, typeinfo, typeinfo name + foreach(ptrqualifier "" "P" "PK") # T, T *, const T * (volatile ignored) + string(APPEND contents "\n _ZT[VTIS]${ptrqualifier}S*;" + "_ZT[VTIS]${ptrqualifier}NS*;") + endforeach() - if (TEST_ld_version_script) - set(contents "Qt_${PROJECT_VERSION_MAJOR}_PRIVATE_API {\n qt_private_api_tag*;\n") - foreach(ph ${arg_PRIVATE_HEADERS}) - string(APPEND contents " @FILE:${ph}@\n") + # For functions and variables + foreach(special "" + "G[VR]" # guard variables, extended-lifetime references + "GTt") # transaction entry points + foreach(cvqualifier "" "[VK]" "VK") # plain, const|volatile, const volatile + string(APPEND contents "\n ") + foreach(refqualifier "" "[RO]") # plain, & or && + # For names in the std:: namespace, compression applies + # (https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression) + string(APPEND contents + " _Z${special}${cvqualifier}${refqualifier}S*;" # plain + " _Z${special}N${cvqualifier}${refqualifier}S*;" # nested name + ) + endforeach() + endforeach() endforeach() + + string(APPEND contents "\n};\nQt_${PROJECT_VERSION_MAJOR}") + if(QT_FEATURE_elf_private_full_version) + string(APPEND contents ".${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") + endif() + string(APPEND contents "_PRIVATE_API { qt_private_api_tag*;\n") + if(arg_PRIVATE_HEADERS) + foreach(ph ${arg_PRIVATE_HEADERS}) + string(APPEND contents " @FILE:${ph}@\n") + endforeach() + else() + string(APPEND contents "@PRIVATE_CONTENT@") + endif() string(APPEND contents "};\n") set(current "Qt_${PROJECT_VERSION_MAJOR}") - if (QT_NAMESPACE STREQUAL "") - set(tag_symbol "qt_version_tag") - else() - set(tag_symbol "qt_version_tag_${QT_NAMESPACE}") + string(APPEND contents "${current} {\n *;") + + get_target_property(target_type ${target} TYPE) + if(NOT target_type STREQUAL "INTERFACE_LIBRARY") + set(genex_prefix "\n ") + set(genex_glue "$<SEMICOLON>\n ") + set(genex_suffix "$<SEMICOLON>") + qt_internal_genex_get_joined_property( + linker_exports "${target}" _qt_extra_linker_script_exports + "${genex_prefix}" "${genex_suffix}" "${genex_glue}" + ) + string(APPEND contents "${linker_exports}") + endif() + string(APPEND contents "\n};\n") + + if(NOT target_type STREQUAL "INTERFACE_LIBRARY") + set(property_genex "$<TARGET_PROPERTY:${target},_qt_extra_linker_script_content>") + set(check_genex "$<BOOL:${property_genex}>") + string(APPEND contents + "$<${check_genex}:${property_genex}>") endif() - string(APPEND contents "${current} { *; };\n") - - foreach(minor_version RANGE ${PROJECT_VERSION_MINOR}) - set(previous "${current}") - set(current "Qt_${PROJECT_VERSION_MAJOR}.${minor_version}") - if (minor_version EQUAL ${PROJECT_VERSION_MINOR}) - string(APPEND contents "${current} { ${tag_symbol}; } ${previous};\n") - else() - string(APPEND contents "${current} {} ${previous};\n") - endif() - endforeach() set(infile "${CMAKE_CURRENT_BINARY_DIR}/${target}.version.in") set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${target}.version") file(GENERATE OUTPUT "${infile}" CONTENT "${contents}") - qt_ensure_perl() + if(NOT arg_PRIVATE_CONTENT_FILE) + set(arg_PRIVATE_CONTENT_FILE "") + endif() + set(generator_command ${CMAKE_COMMAND} + "-DIN_FILE=${infile}" + "-DPRIVATE_CONTENT_FILE=${arg_PRIVATE_CONTENT_FILE}" + "-DOUT_FILE=${outfile}" + -P "${QT_CMAKE_DIR}/QtGenerateVersionScript.cmake" + ) + set(generator_dependencies + "${arg_PRIVATE_CONTENT_FILE}" + "${QT_CMAKE_DIR}/QtGenerateVersionScript.cmake" + ) - add_custom_command(TARGET "${target}" PRE_LINK - COMMAND "${HOST_PERL}" "${QT_MKSPECS_DIR}/features/data/unix/findclasslist.pl" < "${infile}" > "${outfile}" - BYPRODUCTS "${outfile}" DEPENDS "${infile}" + add_custom_command( + OUTPUT "${outfile}" + COMMAND ${generator_command} + DEPENDS ${generator_dependencies} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Generating version linker script" - ) - target_link_options("${target}" PRIVATE "-Wl,--version-script,${outfile}") + COMMENT "Generating version linker script for target ${target}" + VERBATIM + ) + add_custom_target(${target}_version_script DEPENDS ${outfile}) + add_dependencies(${target} ${target}_version_script) + target_link_options(${target} PRIVATE "-Wl,--version-script,${outfile}") endif() endfunction() function(qt_internal_add_link_flags_no_undefined target) - if (NOT QT_BUILD_SHARED_LIBS) + if (NOT QT_BUILD_SHARED_LIBS OR WASM) + return() + endif() + if (VXWORKS) + # VxWorks requires thread_local-related symbols to be found at + # runtime, resulting in linker error when no-undefined flag is + # set and thread_local is used + return() + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + # ld64 defaults to -undefined,error, and in Xcode 15 + # passing this option is deprecated, causing a warning. return() endif() if ((GCC OR CLANG) AND NOT MSVC) @@ -83,11 +190,20 @@ endfunction() function(qt_internal_apply_gc_binaries target visibility) set(possible_visibilities PRIVATE INTERFACE PUBLIC) - list(FIND possible_visibilities "${visibility}" known_visibility) - if (known_visibility EQUAL "-1") + if(NOT visibility IN_LIST possible_visibilities) message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.") endif() + string(JOIN "" clang_or_gcc_begin + "$<$<OR:" + "$<CXX_COMPILER_ID:GNU>," + "$<CXX_COMPILER_ID:Clang>," + "$<CXX_COMPILER_ID:AppleClang>," + "$<CXX_COMPILER_ID:IntelLLVM>" + ">:" + ) + set(clang_or_gcc_end ">") + if ((GCC OR CLANG) AND NOT WASM AND NOT UIKIT AND NOT MSVC) if(APPLE) set(gc_sections_flag "-Wl,-dead_strip") @@ -96,16 +212,26 @@ function(qt_internal_apply_gc_binaries target visibility) elseif(LINUX OR BSD OR WIN32 OR ANDROID) set(gc_sections_flag "-Wl,--gc-sections") endif() + + # Save the flag value with and without genex wrapping, so we can remove the wrapping + # when generating .pc pkgconfig files. + set_property(GLOBAL PROPERTY _qt_internal_gc_sections_without_genex "${gc_sections_flag}") + + set(gc_sections_flag + "${clang_or_gcc_begin}${gc_sections_flag}${clang_or_gcc_end}") + + set_property(GLOBAL PROPERTY _qt_internal_gc_sections_with_genex "${gc_sections_flag}") endif() if(gc_sections_flag) target_link_options("${target}" ${visibility} "${gc_sections_flag}") endif() if((GCC OR CLANG) AND NOT WASM AND NOT UIKIT AND NOT MSVC) - set(split_sections_flags "-ffunction-sections" "-fdata-sections") + set(split_sections_flags + "${clang_or_gcc_begin}-ffunction-sections;-fdata-sections${clang_or_gcc_end}") endif() if(split_sections_flags) - target_compile_options("${target}" ${visibility} ${split_sections_flags}) + target_compile_options("${target}" ${visibility} "${split_sections_flags}") endif() endfunction() @@ -115,13 +241,17 @@ function(qt_internal_apply_intel_cet target visibility) endif() set(possible_visibilities PRIVATE INTERFACE PUBLIC) - list(FIND possible_visibilities "${visibility}" known_visibility) - if (known_visibility EQUAL "-1") + if(NOT visibility IN_LIST possible_visibilities) message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.") endif() if(GCC) - set(flags "-mshstk") + string(JOIN "" flags + "$<$<OR:" + "$<CXX_COMPILER_ID:GNU>," + "$<CXX_COMPILER_ID:Clang>," + "$<CXX_COMPILER_ID:AppleClang>" + ">:-mshstk>") endif() if(flags) target_compile_options("${target}" ${visibility} "${flags}") @@ -129,15 +259,25 @@ function(qt_internal_apply_intel_cet target visibility) endfunction() function(qt_internal_library_deprecation_level result) - if(WIN32) - # On Windows, due to the way DLLs work, we need to export all functions, - # including the inlines - list(APPEND deprecations "QT_DISABLE_DEPRECATED_BEFORE=0x040800") + # QT_DISABLE_DEPRECATED_UP_TO controls which version we use as a cut-off + # compiling in to the library. E.g. if it is set to QT_VERSION then no + # code which was deprecated before QT_VERSION will be compiled in. + if (NOT DEFINED QT_DISABLE_DEPRECATED_UP_TO) + if(WIN32) + # On Windows, due to the way DLLs work, we need to export all functions, + # including the inlines + list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=0x040800") + else() + # On other platforms, Qt's own compilation does need to compile the Qt 5.0 API + list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=0x050000") + endif() else() - # On other platforms, Qt's own compilation goes needs to compile the Qt 5.0 API - list(APPEND deprecations "QT_DISABLE_DEPRECATED_BEFORE=0x050000") + list(APPEND deprecations "QT_DISABLE_DEPRECATED_UP_TO=${QT_DISABLE_DEPRECATED_UP_TO}") endif() - list(APPEND deprecations "QT_DEPRECATED_WARNINGS_SINCE=0x060000") + # QT_WARN_DEPRECATED_UP_TO controls the upper-bound of deprecation + # warnings that are emitted. E.g. if it is set to 0x060500 then all use of + # things deprecated in or before 6.5.0 will be warned against. + list(APPEND deprecations "QT_WARN_DEPRECATED_UP_TO=0x070000") set("${result}" "${deprecations}" PARENT_SCOPE) endfunction() @@ -148,22 +288,22 @@ function(qt_internal_set_exceptions_flags target exceptions_on) if(exceptions_on) if(MSVC) set(_flag "/EHsc") - if(MSVC_VERSION GREATER_EQUAL 1929) + if((MSVC_VERSION GREATER_EQUAL 1929) AND NOT CLANG) + # Use the undocumented compiler flag to make our binary smaller on x64. + # https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/ + # NOTE: It seems we'll use this new exception handling model unconditionally without + # this hack since some unknown MSVC version. set(_flag ${_flag} "/d2FH4") endif() + else() + set(_flag "-fexceptions") endif() else() set(_defs "QT_NO_EXCEPTIONS") - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + if(MSVC) set(_flag "/EHs-c-" "/wd4530" "/wd4577") - elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|AppleClang|InteLLLVM") + else() set(_flag "-fno-exceptions") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - if (MSVC) - set(_flag "/EHs-c-" "/wd4530" "/wd4577") - else() - set(_flag "-fno-exceptions") - endif() endif() endif() @@ -211,17 +351,17 @@ endfunction() function(qt_set_language_standards) ## Use the latest standard the compiler supports (same as qt_common.prf) - if (QT_FEATURE_cxx20) + if (QT_FEATURE_cxx2b) + set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE) + elseif (QT_FEATURE_cxx20) set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE) else() set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE) endif() + set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE) - if (c_std_11 IN_LIST CMAKE_C_COMPILE_FEATURES) - set(CMAKE_C_STANDARD 11 PARENT_SCOPE) - elseif (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES) - set(CMAKE_C_STANDARD 99 PARENT_SCOPE) - endif() + set(CMAKE_C_STANDARD 11 PARENT_SCOPE) + set(CMAKE_C_STANDARD_REQUIRED ON PARENT_SCOPE) endfunction() function(qt_set_language_standards_interface_compile_features target) @@ -236,14 +376,15 @@ function(qt_set_msvc_cplusplus_options target visibility) # Check qt_config_compile_test for more info. if(MSVC AND MSVC_VERSION GREATER_EQUAL 1913) set(flags "-Zc:__cplusplus" "-permissive-") - target_compile_options("${target}" ${visibility} "$<$<COMPILE_LANGUAGE:CXX>:${flags}>") + target_compile_options("${target}" ${visibility} + "$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<COMPILE_LANGUAGE:CXX>>:${flags}>") endif() endfunction() function(qt_enable_utf8_sources target) set(utf8_flags "") if(MSVC) - list(APPEND utf8_flags "-utf-8") + list(APPEND utf8_flags "$<$<CXX_COMPILER_ID:MSVC>:-utf-8>") endif() if(utf8_flags) @@ -263,7 +404,7 @@ function(qt_internal_enable_unicode_defines) set(no_unicode_condition "$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_NO_UNICODE_DEFINES>>>") target_compile_definitions(Platform - INTERFACE "$<${no_unicode_condition}:UNICODE;_UNICODE>") + INTERFACE "$<${no_unicode_condition}:UNICODE$<SEMICOLON>_UNICODE>") endif() endfunction() @@ -475,13 +616,11 @@ endfunction() # LANGUAGES - optional list of languages like 'C', 'CXX', for which to remove the flags # if not provided, defaults to the list of enabled C-like languages function(qt_internal_remove_known_optimization_flags) - qt_parse_all_arguments( - arg - "qt_internal_remove_known_optimization_flags" + cmake_parse_arguments(PARSE_ARGV 0 arg "IN_CACHE" "" - "CONFIGS;LANGUAGES" - ${ARGN}) + "CONFIGS;LANGUAGES") + _qt_internal_validate_all_args_are_parsed(arg) if(NOT arg_CONFIGS) message(FATAL_ERROR @@ -508,20 +647,27 @@ endfunction() # Removes specified flags from CMAKE_<LANGUAGES>_FLAGS[_CONFIGS] variables # -# IN_CACHE enables flags removal from CACHE -# CONFIGS list of configurations that need to clear flags. Clears all configs by default if not -# specified. -# LANGUAGES list of LANGUAGES that need clear flags. Clears all languages by default if not -# specified. -# REGEX enables the flag processing as a regular expression. +# Option Arguments: +# IN_CACHE +# Enables flags removal from CACHE +# REGEX +# Enables the flag processing as a regular expression. +# +# Multi-value Arguments: +# CONFIGS +# List of configurations that need to clear flags. Clears all configs by default if not +# specified. +# +# LANGUAGES +# List of LANGUAGES that need clear flags. Clears all languages by default if not +# specified. function(qt_internal_remove_compiler_flags flags) - qt_parse_all_arguments(arg - "qt_internal_remove_compiler_flags" + cmake_parse_arguments(PARSE_ARGV 1 arg "IN_CACHE;REGEX" "" "CONFIGS;LANGUAGES" - ${ARGN} ) + _qt_internal_validate_all_args_are_parsed(arg) if("${flags}" STREQUAL "") message(WARNING "qt_internal_remove_compiler_flags was called without any flags specified.") @@ -537,8 +683,7 @@ function(qt_internal_remove_compiler_flags flags) if(arg_CONFIGS) set(configs "${arg_CONFIGS}") else() - message(FATAL_ERROR - "You must specify at least one configuration for which to remove the flags.") + qt_internal_get_configs_for_flag_manipulation(configs) endif() if(arg_REGEX) @@ -576,13 +721,11 @@ endfunction() # LANGUAGES - optional list of languages like 'C', 'CXX', for which to add the flags # if not provided, defaults to the list of enabled C-like languages function(qt_internal_add_compiler_flags) - qt_parse_all_arguments( - arg - "qt_internal_add_compiler_flags" + cmake_parse_arguments(PARSE_ARGV 0 arg "IN_CACHE" "FLAGS" - "CONFIGS;LANGUAGES" - ${ARGN}) + "CONFIGS;LANGUAGES") + _qt_internal_validate_all_args_are_parsed(arg) if(NOT arg_CONFIGS) message(FATAL_ERROR @@ -619,13 +762,11 @@ endfunction() # LANGUAGES - optional list of languages like 'C', 'CXX', for which to add the flags # if not provided, defaults to the list of enabled C-like languages function(qt_internal_add_compiler_flags_for_release_configs) - qt_parse_all_arguments( - arg - "qt_internal_add_compiler_flags_for_release_configs" + cmake_parse_arguments(PARSE_ARGV 0 arg "IN_CACHE" "FLAGS" - "LANGUAGES" - ${ARGN}) + "LANGUAGES") + _qt_internal_validate_all_args_are_parsed(arg) set(args "") @@ -665,13 +806,11 @@ endfunction() # It is meant to be called in a subdirectory scope to enable full optimizations for a particular # Qt module, like Core or Gui. function(qt_internal_add_optimize_full_flags) - qt_parse_all_arguments( - arg - "qt_internal_add_optimize_full_flags" + cmake_parse_arguments(PARSE_ARGV 0 arg "IN_CACHE" "" - "" - ${ARGN}) + "") + _qt_internal_validate_all_args_are_parsed(arg) # QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS disables forced full optimization. if(QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS) @@ -727,13 +866,11 @@ endfunction() # LANGUAGES - optional list of languages like 'C', 'CXX', for which to replace the flags # if not provided, defaults to the list of enabled C-like languages function(qt_internal_replace_compiler_flags match_string replace_string) - qt_parse_all_arguments( - arg - "qt_internal_replace_compiler_flags" + cmake_parse_arguments(PARSE_ARGV 2 arg "IN_CACHE" "" - "CONFIGS;LANGUAGES" - ${ARGN}) + "CONFIGS;LANGUAGES") + _qt_internal_validate_all_args_are_parsed(arg) if(NOT arg_CONFIGS) message(FATAL_ERROR @@ -768,13 +905,11 @@ endfunction() # CMAKE_<LINKER_TYPE>_LINKER_FLAGS_<CONFIG> cache variable. # e.g EXE, MODULE, SHARED, STATIC. function(qt_internal_add_linker_flags) - qt_parse_all_arguments( - arg - "qt_internal_add_linker_flags" + cmake_parse_arguments(PARSE_ARGV 0 arg "IN_CACHE" "FLAGS" - "CONFIGS;TYPES" - ${ARGN}) + "CONFIGS;TYPES") + _qt_internal_validate_all_args_are_parsed(arg) if(NOT arg_TYPES) message(FATAL_ERROR @@ -815,13 +950,11 @@ endfunction() # CMAKE_<LINKER_TYPE>_LINKER_FLAGS_<CONFIG> cache variable. # e.g EXE, MODULE, SHARED, STATIC. function(qt_internal_replace_linker_flags match_string replace_string) - qt_parse_all_arguments( - arg - "qt_internal_replace_compiler_flags" + cmake_parse_arguments(PARSE_ARGV 2 arg "IN_CACHE" "" - "CONFIGS;TYPES" - ${ARGN}) + "CONFIGS;TYPES") + _qt_internal_validate_all_args_are_parsed(arg) if(NOT arg_TYPES) message(FATAL_ERROR @@ -956,14 +1089,42 @@ function(qt_internal_set_up_config_optimizations_like_in_qmake) IN_CACHE) endif() + # Legacy Android toolchain file adds the `-g` flag to CMAKE_<LANG>_FLAGS, as a + # result, our release build ends up containing debug symbols. To avoid that, we + # remove the flag from CMAKE_<LANGL>_FLAGS and add + # it to CMAKE_<LANG>_FLAGS_DEBUG. + # + # Note: + # The new `android.toolchain.cmake` file does not have this problem, but + # it has other issues, eg., https://github.com/android/ndk/issues/1693, so we + # cannot force it. While we do load the new toolchain, it automatically falls + # back to the legacy toolchain, ie., `android-legacy.toolchain.cmake` which + # has the problem described above. + # + # Todo: + # When the new toolchain is fixed, and it doesn't fall back to the legacy + # anymore by default, then we should be able to remove this workaround. + if(ANDROID AND ANDROID_COMPILER_FLAGS MATCHES "(^| )-g") + qt_internal_remove_compiler_flags("-g") + qt_internal_add_compiler_flags(FLAGS "-g" CONFIGS DEBUG RELWITHDEBINFO) + endif() + # Update all relevant flags in the calling scope - foreach(config ${configs}) - foreach(lang ${enabled_languages}) + foreach(lang ${enabled_languages}) + set(flag_var_name "CMAKE_${lang}_FLAGS") + set(${flag_var_name} "${${flag_var_name}}" PARENT_SCOPE) + + foreach(config ${configs}) set(flag_var_name "CMAKE_${lang}_FLAGS_${config}") set(${flag_var_name} "${${flag_var_name}}" PARENT_SCOPE) endforeach() + endforeach() - foreach(t ${target_link_types}) + foreach(t ${target_link_types}) + set(flag_var_name "CMAKE_${t}_LINKER_FLAGS") + set(${flag_var_name} "${${flag_var_name}}" PARENT_SCOPE) + + foreach(config ${configs}) set(flag_var_name "CMAKE_${t}_LINKER_FLAGS_${config}") set(${flag_var_name} "${${flag_var_name}}" PARENT_SCOPE) endforeach() |