2
0

CMakeLists.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. cmake_minimum_required(VERSION 3.6.2) # Debian Jessie backports minimal version
  2. option(KS_DEBUG_MUTEX "Debug mutexes, only works on linux for now" OFF)
  3. option(KS_DEBUG_SPINLOCK "Debug spinlocks" OFF)
  4. option(KS_DEBUG_POOL "Track pool allocations and provide hooks for rendering them" OFF)
  5. option(KS_DEBUG_HANDLE "Track pool allocations and provide hooks for rendering them" OFF)
  6. option(KS_STATIC "Build ks statically" OFF)
  7. option(WITH_KS_TEST "Enable KsTest c++ harness" OFF)
  8. option(WITH_LIBBACKTRACE "Enables linking to libbacktrace as an external project, used in abort areas in libks" OFF)
  9. # Must include cotire before anything else for auto pch setup
  10. include(cmake/cotire.cmake)
  11. # Load our common utility api and setup the platfomrm and build
  12. include(cmake/ksutil.cmake)
  13. ksutil_setup_platform()
  14. # Find stuff we need for packaging on UNIX
  15. if(KS_PLAT_LIN)
  16. find_program(LSB_RELEASE_CMD lsb_release)
  17. find_package(Git)
  18. find_program(GZIP_CMD gzip)
  19. find_program(DATE_CMD date)
  20. find_program(DPKG_CMD dpkg)
  21. endif()
  22. # Fixes build on older gcc, Debian Jessie
  23. if(KS_PLAT_LIN)
  24. set(CMAKE_C_STANDARD 99)
  25. endif()
  26. if (KS_PLAT_WIN OR WITH_KS_TEST)
  27. # Setup hunter gate to auto grab our 3rd party dependencies
  28. # (may be included by our super project so check HUNTER_WIKI)
  29. if (NOT HUNTER_WIKI)
  30. include(cmake/HunterGate.cmake)
  31. HunterGate(
  32. URL "https://github.com/ruslo/hunter/archive/v0.20.39.tar.gz"
  33. SHA1 "b49c4b58e17c1473e822f8b21fcde92fee25791d"
  34. )
  35. endif()
  36. endif()
  37. # Declare our project, libks
  38. project(LibKS VERSION 1.2.0 LANGUAGES C CXX)
  39. message("LibKS Version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
  40. # Set package version
  41. set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
  42. set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
  43. set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
  44. # Fetch Catch2 testing framework
  45. if (WITH_KS_KSTEST)
  46. hunter_add_package(Catch)
  47. find_package(Catch2 CONFIG REQUIRED)
  48. endif()
  49. # This setting defers the rpath generation to be set at install time, allowing
  50. # us to run the apps from the build dir without installing (come install time
  51. # the binary is re-linked with an rpath matching that of the install prefix)
  52. set(SKIP_BUILD_RPATH TRUE)
  53. set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  54. # Now detect a bunch of platform stuff
  55. include(CheckFunctionExists)
  56. include(CheckLibraryExists)
  57. include(CheckIncludeFile)
  58. include(TestBigEndian)
  59. # Set package name
  60. string(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME)
  61. # Set package version
  62. set(PACKAGE_VERSION ${PROJECT_VERSION})
  63. # Set package contact
  64. set(CPACK_PACKAGE_CONTACT "support@signalwire.com")
  65. # Detect architecture
  66. if(NOT CPACK_SYSTEM_NAME)
  67. set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_PROCESSOR})
  68. # sanity check
  69. if(CPACK_SYSTEM_NAME STREQUAL x86_64)
  70. set(CPACK_SYSTEM_NAME amd64)
  71. endif()
  72. endif()
  73. # Get UNIX type
  74. if(KS_PLAT_LIN)
  75. find_file(DEBIAN_FOUND debian_version debconf.conf
  76. PATHS /etc
  77. )
  78. if(DEBIAN_FOUND)
  79. set(CMAKE_OS_NAME "Debian" CACHE STRING "Operating system name" FORCE)
  80. endif()
  81. endif()
  82. # Get distro codename
  83. if(KS_PLAT_LIN)
  84. if(NOT DISTRO_CODENAME)
  85. if(NOT LSB_RELEASE_CMD)
  86. message(WARNING "DEB Generator: Can't find lsb_release in your path. Setting DISTRO_CODENAME to unknown.")
  87. set(DISTRO_CODENAME unknown)
  88. else()
  89. execute_process(COMMAND ${LSB_RELEASE_CMD} -cs
  90. OUTPUT_VARIABLE DISTRO_CODENAME
  91. OUTPUT_STRIP_TRAILING_WHITESPACE)
  92. endif()
  93. endif()
  94. endif()
  95. # Debian packaging
  96. if("${CMAKE_OS_NAME}" STREQUAL "Debian")
  97. # https://gitlab.kitware.com/cmake/cmake/issues/16517
  98. set(CPACK_COMPONENTS_ALL runtime)
  99. set(CPACK_DEB_COMPONENT_INSTALL "ON")
  100. # Set package name
  101. set(CPACK_DEBIAN_PACKAGE_NAME "libks")
  102. # Abuse Cmake runtime component name
  103. set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME ${CPACK_DEBIAN_PACKAGE_NAME})
  104. # Find stuff we need for packaging on Debian
  105. find_program(DPKG_CMD dpkg)
  106. # Set package type to build
  107. set(CPACK_GENERATOR DEB)
  108. # Set package maintainer
  109. set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
  110. # Manual package dependencies
  111. set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
  112. # Detect package dependencies
  113. set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
  114. set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
  115. set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
  116. # Set package description
  117. set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Foundational support for signalwire C products")
  118. # Set package section
  119. set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
  120. # Set package priority
  121. set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
  122. # Set package architecture
  123. if(DPKG_CMD)
  124. execute_process(COMMAND ${DPKG_CMD} --print-architecture OUTPUT_VARIABLE DEB_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
  125. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEB_ARCH})
  126. set(CPACK_SYSTEM_NAME ${DEB_ARCH})
  127. unset(DEB_ARCH)
  128. endif()
  129. # Enforce Debian policy permission rules
  130. set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON)
  131. # Set a Debian compliant changelog footer
  132. if(DATE_CMD)
  133. execute_process(COMMAND ${DATE_CMD} -R OUTPUT_VARIABLE RFC2822_TIMESTAMP)
  134. # Two spaces between maintainer and timestamp is NOT a mistake
  135. set(CHANGELOG_FOOTER " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER} ${RFC2822_TIMESTAMP}")
  136. endif()
  137. # Set version release from environment variable
  138. if (NOT "$ENV{PACKAGE_RELEASE}" STREQUAL "")
  139. set(CPACK_DEBIAN_PACKAGE_RELEASE "$ENV{PACKAGE_RELEASE}")
  140. else()
  141. if(DATE_CMD)
  142. execute_process(COMMAND ${DATE_CMD} +%Y%m%d OUTPUT_VARIABLE DATE_YMD)
  143. set(CPACK_DEBIAN_PACKAGE_RELEASE ${DATE_YMD})
  144. else()
  145. set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
  146. endif()
  147. endif()
  148. # Set package version
  149. set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}~${DISTRO_CODENAME})
  150. # Set debian file name format
  151. set(CPACK_DEBIAN_FILE_NAME "${PACKAGE_NAME}_${PROJECT_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${DISTRO_CODENAME}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
  152. # Set a Debian compliant changelog header
  153. set(CHANGELOG_HEADER "${PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_VERSION}) ${DISTRO_CODENAME}\; urgency=${CPACK_DEBIAN_PACKAGE_PRIORITY}")
  154. # Generate a Debian compliant changelog
  155. if(GIT_FOUND AND GZIP_CMD AND DATE_CMD)
  156. # Get git log info
  157. execute_process(COMMAND ${GIT_EXECUTABLE} log --no-merges --pretty=format:"%n [%an]%n * %s" --since="last month"
  158. OUTPUT_VARIABLE CHANGELOG
  159. WORKING_DIRECTORY .
  160. OUTPUT_STRIP_TRAILING_WHITESPACE)
  161. string(REPLACE "\"" "" CHANGELOG ${CHANGELOG})
  162. # Create changelog
  163. file(WRITE changelog.Debian ${CHANGELOG_HEADER}\n${CHANGELOG}\n\n${CHANGELOG_FOOTER})
  164. execute_process(COMMAND ${GZIP_CMD} -f -9 -n changelog.Debian)
  165. # Install changelog
  166. install(FILES "${CMAKE_BINARY_DIR}/changelog.Debian.gz" COMPONENT "runtime" DESTINATION "share/doc/${CPACK_DEBIAN_PACKAGE_NAME}")
  167. # Delete changelog related variables
  168. unset(CHANGELOG_HEADER)
  169. unset(CHANGELOG_FOOTER)
  170. unset(RFC2822_TIMESTAMP)
  171. else()
  172. message(WARNING "DEB Generator: Can't find git and/or gzip and/or date in your path. DEB packages will be missing changelog.Debian.gz.")
  173. endif()
  174. endif()
  175. # Enable packaging module
  176. include(CPack)
  177. # Include our libks cmake utils
  178. include(cmake/ksutil.cmake)
  179. # Load our source and header files with a glob
  180. file(GLOB_RECURSE KsDeps [LIST_DIRECTORIES false]
  181. ${CMAKE_CURRENT_LIST_DIR}/src/*.c
  182. ${CMAKE_CURRENT_LIST_DIR}/src/include/libks/*.h
  183. ${CMAKE_CURRENT_LIST_DIR}/src/include/crypt/*.c
  184. ${CMAKE_CURRENT_LIST_DIR}/src/include/crypt/*.h
  185. )
  186. if (KS_PLAT_WIN)
  187. source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${KsDeps})
  188. endif()
  189. if (KS_STATIC)
  190. add_library(ks STATIC ${KsDeps})
  191. target_compile_definitions(ks PUBLIC -DKS_DECLARE_STATIC=1)
  192. set_target_properties(ks PROPERTIES VERSION ${PROJECT_VERSION})
  193. else()
  194. add_library(ks SHARED ${KsDeps})
  195. set_target_properties(ks PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
  196. endif()
  197. set_target_properties(ks PROPERTIES DEBUG_POSTFIX "")
  198. if (KS_PLAT_LIN AND "${CMAKE_BUILD_TYPE}" STREQUAL "Sanitize")
  199. target_link_libraries(ks PUBLIC asan ubsan)
  200. endif()
  201. # Use libbacktrace if requested
  202. if (NOT KS_PLAT_WIN AND WITH_LIBBACKTRACE)
  203. include(cmake/AddLibBacktrace.cmake)
  204. target_link_libraries(ks PRIVATE LibBacktrace)
  205. target_compile_definitions(ks PUBLIC -DHAVE_LIBBACKTRACE=1)
  206. endif()
  207. if (NOT KS_PLAT_WIN)
  208. # Now auto detect our dependencies
  209. ksutil_target_check_library_exists_hdr(ks PUBLIC rt clock_gettime time.h HAVE_CLOCK_GETTIME)
  210. ksutil_target_check_library_exists_hdr(ks PUBLIC rt clock_getres time.h HAVE_CLOCK_GETRES)
  211. ksutil_target_check_library_exists_hdr(ks PUBLIC rt clock_nanosleep time.h HAVE_CLOCK_NANOSLEEP)
  212. ksutil_target_check_library_exists_hdr(ks PUBLIC rt strftime time.h HAVE_STRFTIME)
  213. ksutil_target_check_library_exists(ks PUBLIC c sched_setscheduler HAVE_SCHED_SETSCHEDULER)
  214. ksutil_target_check_library_exists(ks PUBLIC c malloc HAVE_MALLOC)
  215. ksutil_target_check_library_exists(ks PUBLIC c usleep HAVE_USLEEP)
  216. ksutil_target_check_function_exists(ks PUBLIC pthread_setschedparam HAVE_PTHREAD_SETSCHEDPARAM)
  217. ksutil_target_check_function_exists(ks PUBLIC memmem HAVE_MEMMEM)
  218. ksutil_target_check_include_file(ks PUBLIC stdlib.h HAVE_STDLIB_H)
  219. ksutil_target_check_include_file(ks PUBLIC sys/types.h HAVE_SYS_TYPES_H)
  220. ksutil_target_check_include_file(ks PUBLIC sys/stat.h HAVE_SYS_STAT_H)
  221. ksutil_target_check_include_file(ks PUBLIC string.h HAVE_STRING_H)
  222. ksutil_target_check_include_file(ks PUBLIC unistd.h HAVE_UNISTD_H)
  223. ksutil_target_check_include_file(ks PUBLIC memory.h HAVE_MEMORY_H)
  224. ksutil_target_check_include_file(ks PUBLIC strings.h HAVE_STRINGS_H)
  225. ksutil_target_check_include_file(ks PUBLIC inttypes.h HAVE_INTTYPES_H)
  226. ksutil_target_check_include_file(ks PUBLIC stdint.h HAVE_STDINT_H)
  227. ksutil_target_check_include_file(ks PUBLIC dlfcn.h HAVE_DLFCN_H)
  228. ksutil_target_check_include_file(ks PUBLIC sched.h HAVE_SCHED_H)
  229. ksutil_target_check_include_file(ks PUBLIC byteswap.h HAVE_BYTESWAP_H)
  230. ksutil_target_check_include_file(ks PUBLIC dirent.h HAVE_DIRENT_H)
  231. endif()
  232. # Check endianess for our swap macros
  233. TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
  234. # Need libm on linux
  235. if (KS_PLAT_LIN)
  236. include(cmake/FindLibM.cmake)
  237. endif()
  238. if (KS_PLAT_WIN)
  239. # We use RpcString on windows
  240. target_link_libraries(ks PUBLIC Rpcrt4.lib)
  241. else()
  242. # Locate libuuid on non-win platforms
  243. include(cmake/FindUUID.cmake)
  244. endif()
  245. # Locate ssl
  246. if (KS_PLAT_MAC)
  247. set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
  248. endif()
  249. include(FindOpenSSL)
  250. find_package(OpenSSL REQUIRED Crypto SSL)
  251. if (NOT KS_PLAT_WIN)
  252. # Use pthreads
  253. set(THREADS_PREFER_PTHREAD_FLAG ON)
  254. find_package(Threads REQUIRED)
  255. endif()
  256. set_target_properties(ks PROPERTIES DEFINE_SYMBOL KS_EXPORTS)
  257. # Setup ks core definitions, these are private defintions
  258. # meaning they won't be exported to public linkers
  259. target_compile_definitions(ks PRIVATE
  260. -DPACKAGE_NAME="libks"
  261. -DPACKAGE_TARNAME="libks"
  262. -DPACKAGE_VERSION="${PROJECT_VERSION}"
  263. -DPACKAGE_STRING="libks ${PROJECT_VERSION}"
  264. -DPACKAGE_BUGREPORT="bugs@freeswitch.org"
  265. -DPACKAGE_URL=""
  266. -DVERSION="${PROJECT_VERSION}"
  267. -D_GNU_SOURCE=1
  268. -DCJSON_HIDE_SYMBOLS=1
  269. )
  270. # Setup our public facing definitions
  271. target_compile_definitions(ks PUBLIC
  272. -DSTDC_HEADERS=1
  273. -DTIME_WITH_SYS_TIME=1
  274. -DRETSIGTYPE=void
  275. -DHAVE_LIBCRYPTO=1
  276. -DHAVE_LIBSSL=1
  277. -D_REENTRANT=1
  278. ${PublicHaves}
  279. )
  280. # Handle debug mode
  281. if (KS_DEBUG_HANDLE)
  282. target_compile_definitions(ks PUBLIC
  283. -DKS_DEBUG_HANDLE=1
  284. )
  285. endif()
  286. # JSON debug mode
  287. if (KS_DEBUG_JSON)
  288. target_compile_definitions(ks PUBLIC
  289. -DKS_DEBUG_JSON=1
  290. )
  291. endif()
  292. # Pool debug mode
  293. if (KS_DEBUG_POOL)
  294. target_compile_definitions(ks PUBLIC
  295. -DKS_DEBUG_POOL=1
  296. )
  297. endif()
  298. # Spinlock debug mode
  299. if (KS_DEBUG_SPINLOCK)
  300. target_compile_definitions(ks PUBLIC
  301. -DKS_DEBUG_SPINLOCK=1
  302. )
  303. endif()
  304. # Mutex debug mode
  305. if (KS_DEBUG_MUTEX)
  306. target_compile_definitions(ks PUBLIC
  307. -DKS_DEBUG_MUTEX=1
  308. )
  309. endif()
  310. if (NOT KS_PLAT_WIN)
  311. # All symbols are hidden by default, unless exposed explicitly
  312. include(CheckCXXCompilerFlag)
  313. check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
  314. if (COMPILER_HAS_HIDDEN_VISIBILITY)
  315. message("Compiler supports visibility")
  316. set_target_properties(ks PROPERTIES CXX_VISIBILITY_PRESET hidden)
  317. set_target_properties(ks PROPERTIES C_VISIBILITY_PRESET hidden)
  318. target_compile_definitions(ks PRIVATE
  319. -DKS_API_VISIBILITY=1
  320. )
  321. else()
  322. message("Compiler does not support visibility")
  323. endif()
  324. endif()
  325. if (IS_BIG_ENDIAN)
  326. target_compile_definitions(ks PUBLIC
  327. -D__BYTE_ORDER=__BIG_ENDIAN
  328. )
  329. else()
  330. target_compile_definitions(ks PUBLIC
  331. -D__BYTE_ORDER=__LITTLE_ENDIAN
  332. )
  333. endif()
  334. # Setup ks core dependent linkages
  335. target_link_libraries(
  336. ks PUBLIC
  337. OpenSSL::SSL
  338. OpenSSL::Crypto
  339. )
  340. if (NOT KS_PLAT_WIN)
  341. target_link_libraries(
  342. ks PRIVATE
  343. LIBUUID::LIBUUID
  344. Threads::Threads
  345. )
  346. endif()
  347. if (KS_PLAT_LIN)
  348. target_link_libraries(ks PRIVATE LIBM::LIBM)
  349. target_link_libraries(ks PUBLIC rt atomic)
  350. endif()
  351. # Include key paths
  352. target_include_directories(
  353. ks PUBLIC
  354. $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/libks> # Include both include paths in the install config
  355. $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include> # so we don't break any includes in installed areas
  356. $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src/include> # Within the build tree however, encforce the root
  357. $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> # include path only
  358. )
  359. target_include_directories(
  360. ks PRIVATE
  361. ${OPENSSL_INCLUDE_DIR}
  362. )
  363. # Setup a useful export file for inclusion in other projects
  364. export(TARGETS ks
  365. NAMESPACE ${PROJECT_NAME}
  366. FILE LibKSConfig.cmake
  367. EXPORT_LINK_INTERFACE_LIBRARIES
  368. )
  369. if (NOT KS_PLAT_WIN)
  370. # Set install targets
  371. install(TARGETS ks COMPONENT "runtime" EXPORT LibKSConfig DESTINATION lib)
  372. install(DIRECTORY src/include/libks COMPONENT "runtime" DESTINATION include PATTERN src/include/libks/internal EXCLUDE)
  373. install(FILES ${PROJECT_BINARY_DIR}/libks.pc COMPONENT "runtime" DESTINATION lib/pkgconfig)
  374. install(FILES cmake/ksutil.cmake COMPONENT "runtime" DESTINATION include/libks/cmake)
  375. install(FILES cmake/FindPCRE.cmake COMPONENT "runtime" DESTINATION include/libks/cmake)
  376. install(FILES cmake/FindConfig.cmake COMPONENT "runtime" DESTINATION include/libks/cmake)
  377. install(FILES cmake/FindConfigCpp.cmake COMPONENT "runtime" DESTINATION include/libks/cmake)
  378. install(FILES cmake/AddLibBacktrace.cmake COMPONENT "runtime" DESTINATION include/libks/cmake)
  379. install(FILES ${PROJECT_BINARY_DIR}/copyright COMPONENT "runtime" DESTINATION share/doc/libks)
  380. install(EXPORT LibKSConfig COMPONENT "runtime" DESTINATION include/libks/cmake)
  381. # Set uninstall target
  382. if(NOT TARGET uninstall)
  383. configure_file(
  384. "${CMAKE_CURRENT_SOURCE_DIR}/uninstall.cmake.in"
  385. "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
  386. IMMEDIATE @ONLY)
  387. add_custom_target(uninstall
  388. COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake)
  389. endif()
  390. # Create a package config for registration with the system
  391. # prefix=@PC_PREFIX@
  392. # exec_prefix=@PC_EXEC_PREFIX@
  393. # libdir=@PC_LIB_DIR@
  394. # includedir=@PC_INCLUDE_DIR@
  395. # definitions=@PC_DEFINITIONS@
  396. # cmakedir=@PC_CMAKE_DIR@
  397. # Name: @PACKAGE_NAME@
  398. # Version: @PACKAGE_VERSION@
  399. set(PC_PREFIX ${CMAKE_INSTALL_PREFIX})
  400. set(PACKAGE_VERSION ${PROJECT_VERSION})
  401. get_property(PC_DEFINITIONS TARGET ks PROPERTY INTERFACE_COMPILE_DEFINITIONS)
  402. configure_file("${CMAKE_CURRENT_LIST_DIR}/libks.pc.in" "${PROJECT_BINARY_DIR}/libks.pc" @ONLY)
  403. endif()
  404. cotire(ks)
  405. # Add tests
  406. enable_testing()
  407. add_subdirectory(tests)
  408. if (WITH_KS_TEST)
  409. enable_testing()
  410. add_subdirectory(KSTest)
  411. endif()