File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
125125endif ()
126126include (GNUInstallDirs )
127127include (CMakePackageConfigHelpers )
128- set (INSTALL_TARGETS ${TREELITE_TARGETS} objtreelite rapidjson mdspan)
128+ set (INSTALL_TARGETS ${TREELITE_TARGETS} objtreelite rapidjson)
129+ if (NOT mdspan_FOUND) # Found mdspan via FetchContent
130+ list (APPEND INSTALL_TARGETS mdspan)
131+ endif ()
129132if (NOT nlohmann_json_FOUND) # Fetched nlohmann/json via FetchContent
130133 list (APPEND INSTALL_TARGETS nlohmann_json)
131134endif ()
Original file line number Diff line number Diff line change @@ -41,21 +41,24 @@ if(NOT nlohmann_json_FOUND)
4141endif ()
4242
4343# mdspan (header-only library)
44- message (STATUS "Fetching mdspan..." )
45- set (MDSPAN_CXX_STANDARD 17 CACHE STRING "" )
46- FetchContent_Declare (
47- mdspan
48- GIT_REPOSITORY https://github.com/kokkos/mdspan.git
49- GIT_TAG mdspan-0.6.0
50- )
51- FetchContent_GetProperties (mdspan)
52- if (NOT mdspan_POPULATED)
53- FetchContent_Populate (mdspan)
54- add_subdirectory (${mdspan_SOURCE_DIR } ${mdspan_BINARY_DIR } EXCLUDE_FROM_ALL )
55- message (STATUS "mdspan was downloaded at ${mdspan_SOURCE_DIR } ." )
56- endif ()
57- if (MSVC ) # workaround for MSVC 19.x: https://github.com/kokkos/mdspan/issues/276
58- target_compile_options (mdspan INTERFACE "/permissive-" )
44+ find_package (mdspan 0.6.0 )
45+ if (NOT mdspan_FOUND)
46+ message (STATUS "Fetching mdspan..." )
47+ set (MDSPAN_CXX_STANDARD 17 CACHE STRING "" )
48+ FetchContent_Declare (
49+ mdspan
50+ GIT_REPOSITORY https://github.com/kokkos/mdspan.git
51+ GIT_TAG mdspan-0.6.0
52+ )
53+ FetchContent_GetProperties (mdspan)
54+ if (NOT mdspan_POPULATED)
55+ FetchContent_Populate (mdspan)
56+ add_subdirectory (${mdspan_SOURCE_DIR } ${mdspan_BINARY_DIR } EXCLUDE_FROM_ALL )
57+ message (STATUS "mdspan was downloaded at ${mdspan_SOURCE_DIR } ." )
58+ endif ()
59+ if (MSVC ) # workaround for MSVC 19.x: https://github.com/kokkos/mdspan/issues/276
60+ target_compile_options (mdspan INTERFACE "/permissive-" )
61+ endif ()
5962endif ()
6063
6164# Google C++ tests
You can’t perform that action at this time.
0 commit comments