cmake: IMPORT, EXPORT and RPATH improvements
[awesomized/libmemcached] / CMake / _Include.cmake
index 0f25ab4875a6eb363f298ade9b2c5646a51ae3ea..3b264670934b3098aa0d1029eff5ac82e8018119 100644 (file)
@@ -3,8 +3,10 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
 # globals
 include(CTest)
 include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
 
 find_package(PkgConfig)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 
 # locals
@@ -14,6 +16,7 @@ include(CheckDebug)
 include(CheckDecl)
 include(CheckDependency)
 include(CheckHeader)
+include(CheckCompiles)
 include(CheckType)
 include(CheckStdatomic)
 
@@ -31,10 +34,15 @@ endif()
 
 ## dtrace
 if(ENABLE_DTRACE)
-    set(HAVE_DTRACE 1)
+    find_package(DTrace)
+    if(DTRACE_EXECUTABLE)
+        set(HAVE_DTRACE 1)
+    else()
+        message(WARNING "The dtrace command is required to enable dtrace/systemtap support.")
+    endif()
 endif()
 
-##uuid
+## uuid
 if(BUILD_TESTING)
     check_dependency(LIBUUID uuid uuid/uuid.h)
 endif()
@@ -90,8 +98,9 @@ check_decl(MSG_MORE sys/socket.h)
 check_decl(MSG_NOSIGNAL sys/socket.h)
 check_decl(rcvtimeo sys/socket.h)
 check_decl(sndtimeo sys/socket.h)
-check_decl(strerror_r string.h)
 check_decl(strerror string.h)
+check_decl(strerror_r string.h)
+check_compiles(HAVE_STRERROR_R_CHAR_P "char x, y = *strerror_r(0,&x,1);" string.h)
 check_decl(abi::__cxa_demangle cxxabi.h)
 set(HAVE_GCC_ABI_DEMANGLE ${HAVE_ABI____CXA_DEMANGLE})