summaryrefslogtreecommitdiffstats
path: root/cmake/build_depends.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
commit06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /cmake/build_depends.cmake
parentInitial commit. (diff)
downloadmariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz
mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/build_depends.cmake')
-rw-r--r--cmake/build_depends.cmake46
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/build_depends.cmake b/cmake/build_depends.cmake
new file mode 100644
index 00000000..5adaee33
--- /dev/null
+++ b/cmake/build_depends.cmake
@@ -0,0 +1,46 @@
+IF(RPM)
+ MACRO(FIND_DEP V)
+ SET(out ${V}_DEP)
+ IF (NOT DEFINED ${out})
+ IF(EXISTS ${${V}} AND NOT IS_DIRECTORY ${${V}})
+ EXECUTE_PROCESS(COMMAND ${ARGN} RESULT_VARIABLE res OUTPUT_VARIABLE O OUTPUT_STRIP_TRAILING_WHITESPACE)
+ ELSE()
+ SET(res 1)
+ ENDIF()
+ IF (res)
+ SET(O)
+ ELSE()
+ MESSAGE(STATUS "Need ${O} for ${${V}}")
+ ENDIF()
+ SET(${out} ${O} CACHE INTERNAL "Package that contains ${${V}}" FORCE)
+ ENDIF()
+ ENDMACRO()
+
+ # FindBoost.cmake doesn't leave any trace, do it here
+ IF (Boost_INCLUDE_DIR)
+ FIND_FILE(Boost_config_hpp boost/config.hpp PATHS ${Boost_INCLUDE_DIR})
+ ENDIF()
+
+ GET_CMAKE_PROPERTY(ALL_VARS CACHE_VARIABLES)
+ FOREACH (V ${ALL_VARS})
+ GET_PROPERTY(H CACHE ${V} PROPERTY HELPSTRING)
+ IF (H MATCHES "^Have library [^/]" AND ${V})
+ STRING(REGEX REPLACE "^Have library " "" L ${H})
+ SET(V ${L}_LIBRARY)
+ FIND_LIBRARY(${V} ${L})
+ ENDIF()
+ GET_PROPERTY(T CACHE ${V} PROPERTY TYPE)
+ IF ((T STREQUAL FILEPATH OR V MATCHES "^CMAKE_COMMAND$") AND ${V} MATCHES "^/")
+ IF (RPM)
+ FIND_DEP(${V} rpm -q --qf "%{NAME}" -f ${${V}})
+ ELSE() # must be DEB
+ MESSAGE(FATAL_ERROR "Not implemented")
+ ENDIF ()
+ SET(BUILD_DEPS ${BUILD_DEPS} ${${V}_DEP})
+ ENDIF()
+ ENDFOREACH()
+ IF (BUILD_DEPS)
+ LIST(REMOVE_DUPLICATES BUILD_DEPS)
+ STRING(REPLACE ";" " " CPACK_RPM_BUILDREQUIRES "${BUILD_DEPS}")
+ ENDIF()
+ENDIF(RPM)