diff --git a/cmake/HPX_GeneratePackageUtils.cmake b/cmake/HPX_GeneratePackageUtils.cmake index ae25a6db95a..2e5114fc872 100644 --- a/cmake/HPX_GeneratePackageUtils.cmake +++ b/cmake/HPX_GeneratePackageUtils.cmake @@ -242,16 +242,18 @@ function(hpx_sanitize_usage_requirements property is_build) endfunction(hpx_sanitize_usage_requirements) -function(hpx_filter_cuda_flags cflag_list) - set(_cflag_list "${${cflag_list}}") - string(REGEX REPLACE "\\$<\\$:[^>]*>;?" "" _cflag_list - "${_cflag_list}" - ) - set(${cflag_list} - ${_cflag_list} - PARENT_SCOPE - ) -endfunction(hpx_filter_cuda_flags) +function(hpx_filter_language_flags cflag_list) + set(_cflag_list "${${cflag_list}}") + # We are always in CXX, so replace conditional values with the values themselves + string(REGEX REPLACE "\\$<\\$:([^>]*)>?" "\\1" _cflag_list "${_cflag_list}") + # Remove conditional values for other languages + string(REGEX REPLACE "\\$<\\$]*>:([^>]*)>?" "" _cflag_list "${_cflag_list}") + + set(${cflag_list} + ${_cflag_list} + PARENT_SCOPE + ) +endfunction(hpx_filter_language_flags) # Append the corresponding (-D, -I) flags for the compilation function( @@ -383,14 +385,18 @@ function(hpx_generate_pkgconfig_from_target target template is_build) hpx_compile_definitions hpx_compile_options hpx_pic_option hpx_include_directories hpx_system_include_directories hpx_cflags_list ) - # Cannot generate one file per language yet so filter out cuda - hpx_filter_cuda_flags(hpx_cflags_list) + # Generator expressions that depend on language must be filtered out + hpx_filter_language_flags(hpx_cflags_list) hpx_construct_library_list( hpx_link_libraries hpx_link_options hpx_library_list ) string(TOLOWER ${CMAKE_BUILD_TYPE} build_type) +# Print hpx_library_list and hpx_cflags_list + message(STATUS "hpx_library_list: ${hpx_library_list}") + message(STATUS "hpx_cflags_list: ${hpx_cflags_list}") + configure_file( cmake/templates/${template}.pc.in ${OUTPUT_DIR}${template}_${build_type}.pc.in @ONLY ESCAPE_QUOTES