commonSetup.cmake 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. ################################################################################
  2. # Copyright (C) 2011 HPCC Systems.
  3. #
  4. # All rights reserved. This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as
  6. # published by the Free Software Foundation, either version 3 of the
  7. # License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ################################################################################
  17. # File : commonSetup.cmake
  18. #
  19. #########################################################
  20. # Description:
  21. # ------------
  22. # sets up various cmake options.
  23. #########################################################
  24. IF ("${COMMONSETUP_DONE}" STREQUAL "")
  25. SET (COMMONSETUP_DONE 1)
  26. MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
  27. STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
  28. IF (insource)
  29. MESSAGE(FATAL_ERROR "${_errorMessage}")
  30. ENDIF(insource)
  31. ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
  32. macro_ensure_out_of_source_build("The LexisNexis Hpcc requires an out of source build.
  33. Please remove the directory ${CMAKE_BINARY_DIR}/CMakeFiles
  34. and the file ${CMAKE_BINARY_DIR}/CMakeCache.txt,
  35. then create a separate build directory and run 'cmake path_to_source [options]' there.")
  36. cmake_policy ( SET CMP0011 NEW )
  37. option(CLIENTTOOLS "Enable the building/inclusion of a Client Tools component." ON)
  38. option(PLATFORM "Enable the building/inclusion of a Platform component." ON)
  39. option(DEVEL "Enable the building/inclusion of a Development component." OFF)
  40. option(CLIENTTOOLS_ONLY "Enable the building of Client Tools only." OFF)
  41. option(USE_BINUTILS "Enable use of binutils to embed workunit info into shared objects" ON)
  42. option(USE_CPPUNIT "Enable unit tests (requires cppunit)" OFF)
  43. option(USE_OPENLDAP "Enable OpenLDAP support (requires OpenLDAP)" ON)
  44. option(USE_ICU "Enable unicode support (requires ICU)" ON)
  45. option(USE_BOOST_REGEX "Configure use of boost regex" ON)
  46. option(Boost_USE_STATIC_LIBS "Use boost_regex static library for RPM BUILD" OFF)
  47. option(USE_OPENSSL "Configure use of OpenSSL" ON)
  48. option(USE_ZLIB "Configure use of zlib" ON)
  49. if (WIN32)
  50. option(USE_LIBARCHIVE "Configure use of libarchive" OFF) # libarchive rather less standard on windows systems
  51. else()
  52. option(USE_LIBARCHIVE "Configure use of libarchive" ON)
  53. endif()
  54. option(USE_NATIVE_LIBRARIES "Search standard OS locations for thirdparty libraries" ON)
  55. option(USE_GIT_DESCRIBE "Use git describe to generate build tag" ON)
  56. option(CHECK_GIT_TAG "Require git tag to match the generated build tag" OFF)
  57. option(USE_XALAN "Configure use of xalan" ON)
  58. option(USE_LIBXSLT "Configure use of libxslt" OFF)
  59. option(MAKE_DOCS "Create documentation at build time." OFF)
  60. option(MAKE_DOCS_ONLY "Create a base build with only docs." OFF)
  61. option(DOCS_DRUPAL "Create Drupal HTML Docs" OFF)
  62. option(DOCS_EPUB "Create EPUB Docs" OFF)
  63. option(DOCS_MOBI "Create Mobi Docs" OFF)
  64. if ( USE_XALAN AND USE_LIBXSLT )
  65. set(USE_XALAN OFF)
  66. endif()
  67. if ( USE_LIBXSLT )
  68. set(USE_LIBXML2 ON)
  69. endif()
  70. if ( USE_XALAN )
  71. set(USE_XERCES ON)
  72. endif()
  73. if ( MAKE_DOCS AND CLIENTTOOLS_ONLY )
  74. set( MAKE_DOCS OFF )
  75. endif()
  76. if ( MAKE_DOCS_ONLY AND NOT CLIENTTOOLS_ONLY )
  77. set( MAKE_DOCS ON )
  78. endif()
  79. if ( CLIENTTOOLS_ONLY )
  80. set(PLATFORM OFF)
  81. set(DEVEL OFF)
  82. endif()
  83. option(PORTALURL "Set url to hpccsystems portal download page")
  84. if ( NOT PORTALURL )
  85. set( PORTALURL "http://hpccsystems.com/download" )
  86. endif()
  87. set(CMAKE_MODULE_PATH "${HPCC_SOURCE_DIR}/cmake_modules/")
  88. ##########################################################
  89. # common compiler/linker flags
  90. if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
  91. set ( CMAKE_BUILD_TYPE "Release" )
  92. elseif (NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug|Release")
  93. message (FATAL_ERROR "Unknown build type $ENV{CMAKE_BUILD_TYPE}")
  94. endif ()
  95. message ("-- Making ${CMAKE_BUILD_TYPE} system")
  96. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  97. set ( ARCH64BIT 1 )
  98. else ()
  99. set ( ARCH64BIT 0 )
  100. endif ()
  101. message ("-- 64bit architecture is ${ARCH64BIT}")
  102. set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG")
  103. set (CMAKE_THREAD_PREFER_PTHREAD 1)
  104. find_package(Threads)
  105. IF (NOT THREADS_FOUND)
  106. message(FATAL_ERROR "No threading support found")
  107. ENDIF()
  108. if (WIN32)
  109. # On windows, the vcproj generator generates both windows and debug build capabilities, and the release mode is appended to the directory later
  110. # This output location matches what our existing windows release scripts expect - might make sense to move out of tree sometime though
  111. set ( EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" )
  112. set ( LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" )
  113. # Workaround CMake's odd decision to default windows stack size to 10000000
  114. STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
  115. SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
  116. if (${ARCH64BIT} EQUAL 0)
  117. add_definitions(/Zc:wchar_t-)
  118. endif ()
  119. if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
  120. add_definitions(/ZI)
  121. endif ()
  122. if ("${GIT_COMMAND}" STREQUAL "")
  123. set ( GIT_COMMAND "git.cmd" )
  124. endif ()
  125. else ()
  126. if (NOT CMAKE_USE_PTHREADS_INIT)
  127. message (FATAL_ERROR "pthreads support not detected")
  128. endif ()
  129. set ( EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin" )
  130. set ( LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libs" )
  131. if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
  132. set (CMAKE_COMPILER_IS_CLANGXX 1)
  133. endif()
  134. if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
  135. message ("${CMAKE_CXX_COMPILER_ID}")
  136. SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fPIC -fmessage-length=0 -Wformat -Wformat-security -Wformat-nonliteral -pthread")
  137. SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
  138. SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -fno-default-inline -fno-inline-functions")
  139. endif ()
  140. if (CMAKE_COMPILER_IS_CLANGXX)
  141. SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=logical-op-parentheses -Werror=bool-conversions -Werror=return-type -Werror=comment")
  142. SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=bitwise-op-parentheses -Werror=tautological-compare")
  143. endif()
  144. # All of these are defined in platform.h too, but need to be defned before any system header is included
  145. ADD_DEFINITIONS (-D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64=1 -D__USE_FILE_OFFSET64=1)
  146. if ("${GIT_COMMAND}" STREQUAL "")
  147. set ( GIT_COMMAND "git" )
  148. endif ()
  149. endif ()
  150. macro(HPCC_ADD_EXECUTABLE target)
  151. add_executable(${target} ${ARGN})
  152. endmacro(HPCC_ADD_EXECUTABLE target)
  153. macro(HPCC_ADD_LIBRARY target)
  154. add_library(${target} ${ARGN})
  155. endmacro(HPCC_ADD_LIBRARY target)
  156. # This Macro is provided as Public domain from
  157. # http://www.cmake.org/Wiki/CMakeMacroParseArguments
  158. MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
  159. SET(DEFAULT_ARGS)
  160. FOREACH(arg_name ${arg_names})
  161. SET(${prefix}_${arg_name})
  162. ENDFOREACH(arg_name)
  163. FOREACH(option ${option_names})
  164. SET(${prefix}_${option} FALSE)
  165. ENDFOREACH(option)
  166. SET(current_arg_name DEFAULT_ARGS)
  167. SET(current_arg_list)
  168. FOREACH(arg ${ARGN})
  169. SET(larg_names ${arg_names})
  170. LIST(FIND larg_names "${arg}" is_arg_name)
  171. IF (is_arg_name GREATER -1)
  172. SET(${prefix}_${current_arg_name} ${current_arg_list})
  173. SET(current_arg_name ${arg})
  174. SET(current_arg_list)
  175. ELSE (is_arg_name GREATER -1)
  176. SET(loption_names ${option_names})
  177. LIST(FIND loption_names "${arg}" is_option)
  178. IF (is_option GREATER -1)
  179. SET(${prefix}_${arg} TRUE)
  180. ELSE (is_option GREATER -1)
  181. SET(current_arg_list ${current_arg_list} ${arg})
  182. ENDIF (is_option GREATER -1)
  183. ENDIF (is_arg_name GREATER -1)
  184. ENDFOREACH(arg)
  185. SET(${prefix}_${current_arg_name} ${current_arg_list})
  186. ENDMACRO(PARSE_ARGUMENTS)
  187. # This macro allows for disabling a directory based on the value of a variable passed to the macro.
  188. #
  189. # ex. HPCC_ADD_SUBDIRECORY(roxie ${CLIENTTOOLS_ONLY})
  190. #
  191. # This call will disable the roxie dir if -DCLIENTTOOLS_ONLY=ON is set at config time.
  192. #
  193. macro(HPCC_ADD_SUBDIRECTORY)
  194. set(adddir OFF)
  195. PARSE_ARGUMENTS(_HPCC_SUB "" "" ${ARGN})
  196. LIST(GET _HPCC_SUB_DEFAULT_ARGS 0 subdir)
  197. set(flags ${_HPCC_SUB_DEFAULT_ARGS})
  198. LIST(REMOVE_AT flags 0)
  199. LIST(LENGTH flags length)
  200. if(NOT length)
  201. set(adddir ON)
  202. else()
  203. foreach(f ${flags})
  204. if(${f})
  205. set(adddir ON)
  206. endif()
  207. endforeach()
  208. endif()
  209. if ( adddir )
  210. add_subdirectory(${subdir})
  211. endif()
  212. endmacro(HPCC_ADD_SUBDIRECTORY)
  213. set ( SCM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated )
  214. include_directories (${SCM_GENERATED_DIR})
  215. ##################################################################
  216. # Build tag generation
  217. set(projname ${HPCC_PROJECT})
  218. set(majorver ${HPCC_MAJOR})
  219. set(minorver ${HPCC_MINOR})
  220. set(point ${HPCC_POINT})
  221. if ( "${HPCC_MATURITY}" STREQUAL "release" )
  222. set(stagever "${HPCC_SEQUENCE}")
  223. else()
  224. set(stagever "${HPCC_SEQUENCE}${HPCC_MATURITY}")
  225. endif()
  226. set(version ${majorver}.${minorver}.${point})
  227. IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  228. set( stagever "${stagever}-Debug" )
  229. ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  230. ###########################################################################
  231. if (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  232. message ("-- Using externals directory at ${EXTERNALS_DIRECTORY}")
  233. endif()
  234. IF ( NOT MAKE_DOCS_ONLY )
  235. IF ("${EXTERNALS_DIRECTORY}" STREQUAL "")
  236. SET(bisoncmd "bison")
  237. SET(flexcmd "flex")
  238. ELSE()
  239. IF (WIN32)
  240. SET(bisoncmdprefix "call")
  241. SET(flexcmdprefix "call")
  242. SET(bisoncmd "${EXTERNALS_DIRECTORY}\\bison\\bison.bat")
  243. SET(flexcmd "${EXTERNALS_DIRECTORY}\\bison\\flex.bat")
  244. ELSE ()
  245. SET(bisoncmd "${EXTERNALS_DIRECTORY}/bison/bison")
  246. SET(flexcmd "${EXTERNALS_DIRECTORY}/bison/flex")
  247. ENDIF()
  248. ENDIF()
  249. IF ("${BISON_VERSION}" STREQUAL "")
  250. IF (WIN32)
  251. # cmake bug workaround - it converts path separators fine in add_custom_command but not here
  252. STRING(REPLACE "/" "\\" BISON_exename "${bisoncmd}")
  253. ELSE()
  254. SET(BISON_exename "${bisoncmd}")
  255. ENDIF()
  256. EXECUTE_PROCESS(COMMAND ${BISON_exename} --version
  257. OUTPUT_VARIABLE BISON_version_output
  258. ERROR_VARIABLE BISON_version_error
  259. RESULT_VARIABLE BISON_version_result
  260. OUTPUT_STRIP_TRAILING_WHITESPACE)
  261. STRING(REGEX REPLACE "^[^0-9]*([0-9.]+).*" "\\1" BISON_VERSION "${BISON_version_output}")
  262. ENDIF()
  263. IF ("${FLEX_VERSION}" STREQUAL "")
  264. IF (WIN32)
  265. # cmake bug workaround - it converts path separators fine in add_custom_command but not here
  266. STRING(REPLACE "/" "\\" FLEX_exename "${flexcmd}")
  267. ELSE()
  268. SET(FLEX_exename "${flexcmd}")
  269. ENDIF()
  270. EXECUTE_PROCESS(COMMAND ${FLEX_exename} --version
  271. OUTPUT_VARIABLE FLEX_version_output
  272. ERROR_VARIABLE FLEX_version_error
  273. RESULT_VARIABLE FLEX_version_result
  274. OUTPUT_STRIP_TRAILING_WHITESPACE)
  275. STRING(REGEX REPLACE "^[^0-9]*([0-9.]+).*" "\\1" FLEX_VERSION "${FLEX_version_output}")
  276. ENDIF()
  277. IF ("${BISON_VERSION}" VERSION_LESS "2.4.1")
  278. MESSAGE(FATAL_ERROR "You need bison version 2.4.1 or later to build this project (version ${BISON_VERSION} detected)")
  279. ENDIF()
  280. IF ("${FLEX_VERSION}" VERSION_LESS "2.5.35")
  281. MESSAGE(FATAL_ERROR "You need flex version 2.5.35 or later to build this project (version ${FLEX_VERSION} detected)")
  282. ENDIF()
  283. IF (CMAKE_COMPILER_IS_GNUCXX)
  284. EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GNUCXX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
  285. IF ("${GNUCXX_VERSION}" VERSION_LESS "4.1.1")
  286. MESSAGE(FATAL_ERROR "You need Gnu c++ version 4.1.1 or later to build this project (version ${GNUCXX_VERSION} detected)")
  287. ENDIF()
  288. ENDIF()
  289. ENDIF()
  290. ###########################################################################
  291. # External library setup - some can be optionally selected based on USE_xxx flags, some are required
  292. IF (MAKE_DOCS)
  293. find_package(XSLTPROC)
  294. IF (XSLTPROC_FOUND)
  295. add_definitions (-D_USE_XSLTPROC)
  296. ELSE()
  297. message(FATAL_ERROR "XSLTPROC requested but package not found")
  298. ENDIF()
  299. find_package(FOP)
  300. IF (FOP_FOUND)
  301. add_definitions (-D_USE_FOP)
  302. ELSE()
  303. message(FATAL_ERROR "FOP requested but package not found")
  304. ENDIF()
  305. ENDIF(MAKE_DOCS)
  306. IF ( NOT MAKE_DOCS_ONLY )
  307. IF (USE_BINUTILS AND NOT WIN32)
  308. find_package(BINUTILS)
  309. IF (BINUTILS_FOUND)
  310. add_definitions (-D_USE_BINUTILS)
  311. ELSE()
  312. message(FATAL_ERROR "BINUTILS requested but package not found")
  313. ENDIF()
  314. ENDIF()
  315. IF (USE_OPENLDAP)
  316. find_package(OPENLDAP)
  317. IF (OPENLDAP_FOUND)
  318. add_definitions (-D_USE_OPENLDAP)
  319. ELSE()
  320. message(FATAL_ERROR "OPENLDAP requested but package not found")
  321. ENDIF()
  322. ELSE()
  323. add_definitions (-D_NO_LDAP)
  324. ENDIF(USE_OPENLDAP)
  325. IF (USE_CPPUNIT)
  326. find_package(CPPUNIT)
  327. IF (CPPUNIT_FOUND)
  328. add_definitions (-D_USE_CPPUNIT)
  329. include_directories(${CPPUNIT_INCLUDE_DIR})
  330. ELSE()
  331. message(FATAL_ERROR "CPPUNIT requested but package not found")
  332. ENDIF()
  333. ENDIF(USE_CPPUNIT)
  334. IF (USE_ICU)
  335. find_package(ICU)
  336. IF (ICU_FOUND)
  337. add_definitions (-D_USE_ICU)
  338. include_directories(${ICU_INCLUDE_DIR})
  339. ELSE()
  340. message(FATAL_ERROR "ICU requested but package not found")
  341. ENDIF()
  342. ENDIF(USE_ICU)
  343. if(USE_XALAN)
  344. find_package(XALAN)
  345. if (XALAN_FOUND)
  346. add_definitions (-D_USE_XALAN)
  347. else()
  348. message(FATAL_ERROR "XALAN requested but package not found")
  349. endif()
  350. endif(USE_XALAN)
  351. if(USE_LIBXSLT)
  352. find_package(LIBXSLT)
  353. if (LIBXSLT_FOUND)
  354. add_definitions (-D_USE_LIBSLT)
  355. else()
  356. message(FATAL_ERROR "LIBXSLT requested but package not found")
  357. endif()
  358. endif(USE_LIBXSLT)
  359. if(USE_XERCES)
  360. find_package(XERCES)
  361. if (XERCES_FOUND)
  362. add_definitions (-D_USE_XERCES)
  363. else()
  364. message(FATAL_ERROR "XERCES requested but package not found")
  365. endif()
  366. endif(USE_XERCES)
  367. if(USE_LIBXML2)
  368. find_package(LIBXML2)
  369. if (LIBXML2_FOUND)
  370. add_definitions (-D_USE_LIBXML2)
  371. else()
  372. message(FATAL_ERROR "LIBXML2 requested but package not found")
  373. endif()
  374. endif(USE_LIBXML2)
  375. if(USE_ZLIB)
  376. find_package(ZLIB)
  377. if (ZLIB_FOUND)
  378. add_definitions (-D_USE_ZLIB)
  379. else()
  380. message(FATAL_ERROR "ZLIB requested but package not found")
  381. endif()
  382. endif(USE_ZLIB)
  383. if(USE_LIBARCHIVE)
  384. find_package(LIBARCHIVE)
  385. if (LIBARCHIVE_FOUND)
  386. add_definitions (-D_USE_LIBARCHIVE)
  387. else()
  388. message(FATAL_ERROR "LIBARCHIVE requested but package not found")
  389. endif()
  390. endif(USE_LIBARCHIVE)
  391. if(USE_BOOST_REGEX)
  392. find_package(BOOST_REGEX)
  393. if (BOOST_REGEX_FOUND)
  394. add_definitions (-D_USE_BOOST_REGEX)
  395. else()
  396. message(FATAL_ERROR "BOOST_REGEX requested but package not found")
  397. endif()
  398. endif(USE_BOOST_REGEX)
  399. if(USE_OPENSSL)
  400. find_package(OPENSSL)
  401. if (OPENSSL_FOUND)
  402. add_definitions (-D_USE_OPENSSL)
  403. include_directories(${OPENSSL_INCLUDE_DIR})
  404. link_directories(${OPENSSL_LIBRARY_DIR})
  405. else()
  406. message(FATAL_ERROR "OPENSSL requested but package not found")
  407. endif()
  408. endif(USE_OPENSSL)
  409. if(USE_MYSQL)
  410. find_package(MYSQL)
  411. if (MYSQL_FOUND)
  412. add_definitions (-D_USE_MYSQL)
  413. else()
  414. message(FATAL_ERROR "MYSQL requested but package not found")
  415. endif()
  416. else()
  417. add_definitions (-D_NO_MYSQL)
  418. endif(USE_MYSQL)
  419. ENDIF()
  420. ###########################################################################
  421. ###
  422. ## The following sets the install directories and names.
  423. ###
  424. if ( PLATFORM )
  425. set ( OSSDIR "${DIR_NAME}" )
  426. else()
  427. set ( OSSDIR "${DIR_NAME}/${version}/clienttools" )
  428. endif()
  429. set ( CPACK_INSTALL_PREFIX "${PREFIX}" )
  430. set ( CPACK_PACKAGING_INSTALL_PREFIX "${PREFIX}" )
  431. set ( CMAKE_INSTALL_PREFIX "${PREFIX}" )
  432. SET(CMAKE_SKIP_BUILD_RPATH FALSE)
  433. SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  434. SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OSSDIR}/lib")
  435. SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  436. if (APPLE)
  437. set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
  438. set(CMAKE_INSTALL_NAME_DIR "@loader_path/../lib")
  439. endif()
  440. MACRO (FETCH_GIT_TAG workdir edition result)
  441. execute_process(COMMAND "${GIT_COMMAND}" describe --tags --dirty --abbrev=6 --match ${edition}*
  442. WORKING_DIRECTORY "${workdir}"
  443. OUTPUT_VARIABLE ${result}
  444. ERROR_QUIET
  445. OUTPUT_STRIP_TRAILING_WHITESPACE)
  446. if ("${${result}}" STREQUAL "")
  447. execute_process(COMMAND "${GIT_COMMAND}" describe --always --tags --all --abbrev=6 --dirty --long
  448. WORKING_DIRECTORY "${workdir}"
  449. OUTPUT_VARIABLE ${result}
  450. ERROR_QUIET
  451. OUTPUT_STRIP_TRAILING_WHITESPACE)
  452. endif()
  453. ENDMACRO()
  454. endif ("${COMMONSETUP_DONE}" STREQUAL "")