mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 12:24:26 +02:00
fix: target_sources
with FILE_SET HEADERS
called only when headers are present
This commit is contained in:
@@ -62,25 +62,26 @@ function(add_mp_units_module name target_name)
|
||||
|
||||
# define the target for a module
|
||||
add_library(${target_name} ${SCOPE})
|
||||
target_sources(
|
||||
${target_name}
|
||||
${${projectPrefix}TARGET_SCOPE}
|
||||
FILE_SET
|
||||
HEADERS
|
||||
BASE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
FILES
|
||||
${ARG_HEADERS}
|
||||
)
|
||||
target_link_libraries(${target_name} ${${projectPrefix}TARGET_SCOPE} ${ARG_DEPENDENCIES})
|
||||
set_target_properties(${target_name} PROPERTIES EXPORT_NAME ${name})
|
||||
add_library(mp-units::${name} ALIAS ${target_name})
|
||||
|
||||
if(ARG_HEADERS)
|
||||
target_sources(
|
||||
${target_name}
|
||||
${${projectPrefix}TARGET_SCOPE}
|
||||
FILE_SET
|
||||
HEADERS
|
||||
BASE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
FILES
|
||||
${ARG_HEADERS}
|
||||
)
|
||||
target_include_directories(
|
||||
${target_name} ${unitsAsSystem} ${${projectPrefix}TARGET_SCOPE}
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
|
||||
)
|
||||
endif()
|
||||
set_target_properties(${target_name} PROPERTIES EXPORT_NAME ${name})
|
||||
add_library(mp-units::${name} ALIAS ${target_name})
|
||||
|
||||
if(${projectPrefix}BUILD_CXX_MODULES)
|
||||
target_sources(${target_name} PUBLIC FILE_SET CXX_MODULES FILES ${ARG_MODULE_INTERFACE_UNIT})
|
||||
|
Reference in New Issue
Block a user