Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diy2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Spiros Tsalikis
diy2
Commits
594598be
Commit
594598be
authored
4 years ago
by
Sujin Philip
Browse files
Options
Downloads
Patches
Plain Diff
Add support for `find_package(DIY)`
parent
e9a24b89
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+14
-3
14 additions, 3 deletions
CMakeLists.txt
cmake/diy-config.cmake.in
+57
-0
57 additions, 0 deletions
cmake/diy-config.cmake.in
with
71 additions
and
3 deletions
CMakeLists.txt
+
14
−
3
View file @
594598be
...
...
@@ -65,7 +65,7 @@ endif ()
if
(
log
)
list
(
APPEND diy_definitions
"-DDIY_USE_SPDLOG"
)
find_path
(
SPDLOG_INCLUDE_DIR spdlog/spdlog.h
)
list
(
APPEND diy_include_thirdparty_directories
${
SPDLOG_INCLUDE_DIR
}
)
list
(
APPEND diy_include_thirdparty_directories
$<BUILD_INTERFACE:
${
SPDLOG_INCLUDE_DIR
}
>
)
endif
()
# Profiling
...
...
@@ -77,7 +77,7 @@ if (caliper)
list
(
APPEND diy_definitions
"-DDIY_USE_CALIPER"
)
find_package
(
caliper
)
list
(
APPEND diy_include_thirdparty_directories
${
caliper_INCLUDE_DIR
}
)
list
(
APPEND diy_include_thirdparty_directories
$<BUILD_INTERFACE:
${
caliper_INCLUDE_DIR
}
>
)
list
(
APPEND diy_libraries caliper caliper-mpi
)
endif
()
...
...
@@ -110,6 +110,8 @@ if (NOT DEFINED diy_export_name)
set
(
diy_export_name
"diy_targets"
)
endif
()
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
"
${
PROJECT_BINARY_DIR
}
/lib"
)
# for diy_developer_flags
include
(
DIYCompilerFlags
)
...
...
@@ -226,9 +228,17 @@ if (build_tests)
add_subdirectory
(
tests
)
endif
(
build_tests
)
# configure find_package script
include
(
CMakePackageConfigHelpers
)
configure_package_config_file
(
"
${
PROJECT_SOURCE_DIR
}
/cmake/diy-config.cmake.in"
"
${
PROJECT_BINARY_DIR
}
/lib/
${
diy_prefix
}
/diy-config.cmake"
INSTALL_DESTINATION
"
${
diy_install_lib_dir
}
/
${
diy_prefix
}
"
)
# install targets
if
(
NOT DEFINED diy_install_only_libraries
)
# defined by parent project if building for binary distribution
install
(
DIRECTORY
${
PROJECT_SOURCE_DIR
}
/include/
${
diy_prefix
}
DESTINATION
${
diy_install_include_dir
}
)
install
(
FILES
"
${
PROJECT_BINARY_DIR
}
/lib/
${
diy_prefix
}
/diy-config.cmake"
DESTINATION
"
${
diy_install_lib_dir
}
/
${
diy_prefix
}
"
)
if
(
build_diy_mpi_lib
)
install
(
FILES
${
PROJECT_BINARY_DIR
}
/include/
${
diy_prefix
}
/mpi/mpitypes.hpp DESTINATION
${
diy_install_include_dir
}
/
${
diy_prefix
}
/mpi
)
...
...
@@ -237,6 +247,7 @@ endif()
install
(
TARGETS
${
diy_targets
}
EXPORT
${
diy_export_name
}
DESTINATION
${
diy_install_lib_dir
}
)
export
(
EXPORT
${
diy_export_name
}
NAMESPACE DIY:: FILE
"
${
PROJECT_BINARY_DIR
}
/lib/
${
diy_prefix
}
/diy-targets.cmake"
)
if
(
NOT DEFINED diy_dont_install_export
)
# defined by parent project if it is handling the exports
install
(
EXPORT
${
diy_export_name
}
NAMESPACE DIY:: DESTINATION
${
diy_install_lib_dir
}
/
${
diy_prefix
}
)
install
(
EXPORT
${
diy_export_name
}
NAMESPACE DIY:: DESTINATION
"
${
diy_install_lib_dir
}
/
${
diy_prefix
}
"
FILE diy-targets.cmake
)
endif
()
This diff is collapsed.
Click to expand it.
cmake/diy-config.cmake.in
0 → 100644
+
57
−
0
View file @
594598be
if (CMAKE_VERSION VERSION_LESS "3.9")
message(FATAL_ERROR "Diy requires CMake 3.9+")
endif()
@PACKAGE_INIT@
set(threads "@threads@")
set(log "@log@")
set(caliper "@caliper@")
set(mpi "@mpi@")
include("${CMAKE_CURRENT_LIST_DIR}/diy-targets.cmake")
set(_diy_find_quietly)
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(_diy_find_quietly QUIET)
endif()
if (threads)
find_package(Threads ${_diy_find_quietly})
if (NOT Threads_FOUND)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "Threads not found")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
endif()
endif()
if (log)
find_path(SPDLOG_INCLUDE_DIR "spdlog/spdlog.h")
if (SPDLOG_INCLUDE_DIR STREQUAL "SPDLOG_INCLUDE_DIR-NOTFOUND")
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "SPDLOG not found")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
else()
target_include_directories(DIY::@diy_prefix@ INTERFACE $<INSTALL_INTERFACE:${SPDLOG_INCLUDE_DIR}>)
endif()
endif()
if (caliper)
find_package(caliper ${_diy_find_quietly})
if (NOT caliper_FOUND)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "Caliper not found")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
else()
target_include_directories(DIY::@diy_prefix@ INTERFACE $<INSTALL_INTERFACE:${caliper_INCLUDE_DIR}>)
endif()
endif()
if (mpi)
find_package(MPI ${_diy_find_quietly})
if (NOT MPI_FOUND)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "MPI not found")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
endif()
endif()
if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
endif ()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment