Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(INSTALL_TARGETS ${TREELITE_TARGETS} objtreelite rapidjson mdspan)
set(INSTALL_TARGETS ${TREELITE_TARGETS} objtreelite rapidjson)
if(NOT mdspan_FOUND) # Found mdspan via FetchContent
list(APPEND INSTALL_TARGETS mdspan)
endif()
if(NOT nlohmann_json_FOUND) # Fetched nlohmann/json via FetchContent
list(APPEND INSTALL_TARGETS nlohmann_json)
endif()
Expand Down
33 changes: 18 additions & 15 deletions cmake/ExternalLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,24 @@ if(NOT nlohmann_json_FOUND)
endif()

# mdspan (header-only library)
message(STATUS "Fetching mdspan...")
set(MDSPAN_CXX_STANDARD 17 CACHE STRING "")
FetchContent_Declare(
mdspan
GIT_REPOSITORY https://github.com/kokkos/mdspan.git
GIT_TAG mdspan-0.6.0
)
FetchContent_GetProperties(mdspan)
if(NOT mdspan_POPULATED)
FetchContent_Populate(mdspan)
add_subdirectory(${mdspan_SOURCE_DIR} ${mdspan_BINARY_DIR} EXCLUDE_FROM_ALL)
message(STATUS "mdspan was downloaded at ${mdspan_SOURCE_DIR}.")
endif()
if(MSVC) # workaround for MSVC 19.x: https://github.com/kokkos/mdspan/issues/276
target_compile_options(mdspan INTERFACE "/permissive-")
find_package(mdspan 0.6.0)
if(NOT mdspan_FOUND)
message(STATUS "Fetching mdspan...")
set(MDSPAN_CXX_STANDARD 17 CACHE STRING "")
FetchContent_Declare(
mdspan
GIT_REPOSITORY https://github.com/kokkos/mdspan.git
GIT_TAG mdspan-0.6.0
)
FetchContent_GetProperties(mdspan)
if(NOT mdspan_POPULATED)
FetchContent_Populate(mdspan)
add_subdirectory(${mdspan_SOURCE_DIR} ${mdspan_BINARY_DIR} EXCLUDE_FROM_ALL)
message(STATUS "mdspan was downloaded at ${mdspan_SOURCE_DIR}.")
endif()
if(MSVC) # workaround for MSVC 19.x: https://github.com/kokkos/mdspan/issues/276
target_compile_options(mdspan INTERFACE "/permissive-")
endif()
endif()

# Google C++ tests
Expand Down
Loading