mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 11:54:27 +02:00
build: add_mp_units_module
improved
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.19)
|
cmake_minimum_required(VERSION 3.23)
|
||||||
|
|
||||||
function(validate_unparsed module prefix)
|
function(validate_unparsed module prefix)
|
||||||
if(${prefix}_UNPARSED_ARGUMENTS)
|
if(${prefix}_UNPARSED_ARGUMENTS)
|
||||||
@@ -65,12 +65,11 @@ function(add_mp_units_module name target_name)
|
|||||||
target_compile_features(${target_name} ${${projectPrefix}TARGET_SCOPE} cxx_std_20)
|
target_compile_features(${target_name} ${${projectPrefix}TARGET_SCOPE} cxx_std_20)
|
||||||
target_link_libraries(${target_name} ${${projectPrefix}TARGET_SCOPE} ${ARG_DEPENDENCIES})
|
target_link_libraries(${target_name} ${${projectPrefix}TARGET_SCOPE} ${ARG_DEPENDENCIES})
|
||||||
set_target_properties(${target_name} PROPERTIES EXPORT_NAME ${name})
|
set_target_properties(${target_name} PROPERTIES EXPORT_NAME ${name})
|
||||||
add_library(mp-units::${name} ALIAS ${target_name})
|
|
||||||
|
|
||||||
if(ARG_HEADERS)
|
if(ARG_HEADERS)
|
||||||
target_sources(
|
target_sources(
|
||||||
${target_name}
|
${target_name}
|
||||||
${${projectPrefix}TARGET_SCOPE}
|
PUBLIC
|
||||||
FILE_SET
|
FILE_SET
|
||||||
HEADERS
|
HEADERS
|
||||||
BASE_DIRS
|
BASE_DIRS
|
||||||
@@ -78,10 +77,6 @@ function(add_mp_units_module name target_name)
|
|||||||
FILES
|
FILES
|
||||||
${ARG_HEADERS}
|
${ARG_HEADERS}
|
||||||
)
|
)
|
||||||
target_include_directories(
|
|
||||||
${target_name} ${unitsAsSystem} ${${projectPrefix}TARGET_SCOPE}
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${projectPrefix}BUILD_CXX_MODULES)
|
if(${projectPrefix}BUILD_CXX_MODULES)
|
||||||
@@ -94,4 +89,6 @@ function(add_mp_units_module name target_name)
|
|||||||
else()
|
else()
|
||||||
install(TARGETS ${target_name} EXPORT mp-unitsTargets FILE_SET HEADERS)
|
install(TARGETS ${target_name} EXPORT mp-unitsTargets FILE_SET HEADERS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(mp-units::${name} ALIAS ${target_name})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Reference in New Issue
Block a user