Skip to content

Commit

Permalink
Merge pull request #4 from yaito3014/test-building
Browse files Browse the repository at this point in the history
build test if project is top level
  • Loading branch information
saki7 authored Aug 29, 2024
2 parents 5439f7e + 1bce89b commit abcb4fa
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ project(
LANGUAGES CXX
)

option(YK_VARIANT_VIEW_BUILD_TESTING "build tests" ${PROJECT_IS_TOP_LEVEL})

add_library(variant_view INTERFACE)

add_library(yk::variant_view ALIAS variant_view)

file(GLOB_RECURSE VARIANT_VIEW_HEADERS CONFIGURE_DEPENDS include/*.hpp)
target_sources(variant_view INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${VARIANT_VIEW_HEADERS})
target_sources(
variant_view INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${VARIANT_VIEW_HEADERS}
)

include(GNUInstallDirs)
target_include_directories(
Expand Down Expand Up @@ -52,8 +56,10 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake
)

if(${Boost_unit_test_framework_FOUND})
add_subdirectory(test EXCLUDE_FROM_ALL)
else()
message(STATUS "Boost.Test is not found, not building tests")
if(YK_VARIANT_VIEW_BUILD_TESTING)
if(Boost_unit_test_framework_FOUND)
add_subdirectory(test EXCLUDE_FROM_ALL)
else()
message(STATUS "Boost.Test is not found, not building tests")
endif()
endif()

0 comments on commit abcb4fa

Please sign in to comment.