test: test_package now is tested also with C++20 modules

This commit is contained in:
Mateusz Pusz
2024-11-18 13:56:18 +01:00
parent c1d323a91a
commit 6ea2adf936
2 changed files with 16 additions and 3 deletions

View File

@ -23,7 +23,17 @@
cmake_minimum_required(VERSION 3.25)
project(test_package LANGUAGES CXX)
message(STATUS "MP_UNITS_BUILD_CXX_MODULES: ${MP_UNITS_BUILD_CXX_MODULES}")
message(STATUS "MP_UNITS_API_STD_FORMAT: ${MP_UNITS_API_STD_FORMAT}")
find_package(mp-units REQUIRED)
add_executable(test_package test_package.cpp)
target_link_libraries(test_package PRIVATE mp-units::mp-units)
add_executable(test_package-headers test_package.cpp)
target_compile_features(test_package-headers PRIVATE cxx_std_20)
target_link_libraries(test_package-headers PRIVATE mp-units::mp-units)
if(MP_UNITS_BUILD_CXX_MODULES)
add_executable(test_package test_package.cpp)
target_compile_features(test_package PRIVATE cxx_std_20)
target_link_libraries(test_package PRIVATE mp-units::mp-units)
endif()

View File

@ -64,5 +64,8 @@ class TestPackageConan(ConanFile):
def test(self):
if can_run(self):
if self.dependencies["mp-units"].options.cxx_modules:
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package-headers")
self.run(bin_path, env="conanrun")