diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f8ddeb2..3340524f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,10 @@ option(USE_MPI_FOR_TESTS "Use MPI for tests" ON) option(USE_NPKIT "Use NPKIT" ON) option(ALLOW_GDRCOPY "Use GDRCopy, if available" OFF) +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/installed" CACHE PATH "default install path" FORCE) +endif() + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) find_package(CUDAToolkit REQUIRED) @@ -24,6 +28,7 @@ include_directories(${CUDAToolkit_INCLUDE_DIRS}) include(CTest) include(FetchContent) FetchContent_Declare(googletest URL https://github.com/google/googletest/archive/b796f7d44681514f58a683a3a71ff17c94edb0c1.zip) +option(INSTALL_GTEST OFF) FetchContent_MakeAvailable(googletest) include(GoogleTest) @@ -45,5 +50,6 @@ if(ALLOW_GDRCOPY AND GDRCOPY_FOUND) target_link_libraries(mscclpp PRIVATE MSCCLPP::gdrcopy) endif() +add_subdirectory(include) # This adds the public headers to install with mscclpp add_subdirectory(src) # This adds the sources to the mscclpp target add_subdirectory(test) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 00000000..b5fa7984 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,3 @@ +file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS *.hpp) +target_sources(mscclpp PUBLIC FILE_SET HEADERS FILES ${HEADERS}) +install(TARGETS mscclpp FILE_SET HEADERS)