summaryrefslogtreecommitdiffstats
path: root/cmake/modules/ExternalProjectHelper.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /cmake/modules/ExternalProjectHelper.cmake
parentInitial commit. (diff)
downloadceph-upstream/16.2.11+ds.tar.xz
ceph-upstream/16.2.11+ds.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/ExternalProjectHelper.cmake')
-rw-r--r--cmake/modules/ExternalProjectHelper.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/modules/ExternalProjectHelper.cmake b/cmake/modules/ExternalProjectHelper.cmake
new file mode 100644
index 000000000..42beab197
--- /dev/null
+++ b/cmake/modules/ExternalProjectHelper.cmake
@@ -0,0 +1,17 @@
+function (set_library_properties_for_external_project _target _lib)
+ # Manually create the directory, it will be created as part of the build,
+ # but this runs in the configuration phase, and CMake generates an error if
+ # we add an include directory that does not exist yet.
+ set(_libfullname "${CMAKE_SHARED_LIBRARY_PREFIX}${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ set(_libpath "${CMAKE_BINARY_DIR}/external/lib/${_libfullname}")
+ set(_includepath "${CMAKE_BINARY_DIR}/external/include")
+ message(STATUS "Configuring ${_target} with ${_libpath}")
+
+ file(MAKE_DIRECTORY "${_includepath}")
+ set_target_properties(${_target} PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_libpath}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+ IMPORTED_LOCATION "${_libpath}"
+ INTERFACE_INCLUDE_DIRECTORIES "${_includepath}")
+ # set_property(TARGET ${_target} APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "CXX")
+endfunction ()