/usr/share/camitk-3.3/cmake/macros/CamiTKLibrary.cmake is in libcamitk3-dev 3.3.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | #!
#! @ingroup group_sdk_cmake
#!
#! macro camitk_library simplifies the declaration of a library inside CamiTK
#! and is to be used for all inner project libraries
#!
#! The name of the CEP library is deduced from the name of the directory, unless LIBNAME is provided
#!
#! If the library is compiled as shared, it adds the needed library properties
#! If it needs relocation flag fPIC (on some plateforms), this macro should determine
#! if this is the case and specify this flag
#!
#! usage:
#! \code
#! camitk_library(
#! SHARED|STATIC
#! [LIBNAME libname]
#! [PUBLIC]
#! SOURCES source1.cpp source1.h...
#! [NEEDS_CEP_LIBRARIES lib1 lib2...]
#! [NEEDS_LIBXML2]
#! [NEEDS_XERCESC]
#! [NEEDS_XSD]
#! [NEEDS_QT_MODULES]
#! [DEFINES flag1 flag2 ...]
#! [EXTERNAL_LIBRARIES lib1 lib2... ]
#! [INCLUDE_DIRECTORIES dir1 dir2...]
#! [LINK_DIRECTORIES dir1 dir2...]
#! [HEADERS_TO_INSTALL]
#! [CEP_NAME]
#! [DESCRIPTION]
#!
#! )
#! \endcode
#!
#! \param SHARED optional, if the library should be compiled as shared
#! \param SOURCES all sources to be included in the library
#! \param INCLUDE_DIRECTORIES all needed include directories (${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} are automatically added)
#! \param EXTERNAL_LIBRARIES all the libraries to be used during the link (shared or static)
#! \param NEEDS_CEP_LIBRARIES all the libraries to be used during the link (shared or static)
#! \param NEEDS_LIBXML2 add this if the CEP library needs libxml2
#! \param NEEDS_XERCESC add this if your action / component needs XercesC library
#! \param NEEDS_XSD add this if your action needs Codesynthesis xsd cxx (xml schema compiler)
#! \param NEEDS_QT_MODULES add this if your library depends on Qt modules, such as QtCore, QtGui, QtMultimedia, QtNetwork, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtWebkit, QtXml, QtXmlPatterns, QtDeclarative
#! \param LIBNAME force the CEP library name to be different from the directory it is in
#! \param LINK_DIRECTORIES additional directories to use in link_directories(...)
#! \param DEFINES list of define flags to add at compilation time
#! \param PUBLIC The library is a public library that has to be loaded directly by the operating system.
#! It is generally only needed for SDK library. A public library should not be installed in the
#! lib/${CAMITK_SHORT_VERSION_STRING} but directly in lib/ (on Unix/MacOS) or bin/ (on windows)
#! \param HEADERS_TO_INSTALL list of headers to install, if present this will automatically
#! create an "install-COMPONENT_NAMEcomponent" target, that can be used
#! anywhere else to manage dependencies to this component.
#! The headers are installed ${CAMITK_BUILD_INCLUDE_DIR}/COMPONENT_NAME
#! when the target "install-COMPONENT_NAMEcomponent" is called.
#! \param CEP_NAME specify the CEP_NAME, which is used to categorized the extension for packaging purpose
#! No CEP_NAME provided will result in default categorization (generic extension).
#! \param DESCRIPTION Simple description of the extension. Used for packaging presentation for instance.
macro(camitk_library)
#########################################################################
# #
# ARGUMENTS PARSING #
# #
# * Use a macro to create the CMAKE variables according to the #
# provided options as input. #
# #
#########################################################################
get_directory_name(${CMAKE_CURRENT_SOURCE_DIR} DEFAULT_LIBRARY_NAME)
parse_arguments(${DEFAULT_LIBRARY_NAME_CMAKE}
"SOURCES;NEEDS_CEP_LIBRARIES;EXTERNAL_LIBRARIES;INCLUDE_DIRECTORIES;LIBNAME;DEFINES;LINK_DIRECTORIES;HEADERS_TO_INSTALL;CEP_NAME;DESCRIPTION;" # possible lists
"SHARED;STATIC;NEEDS_LIBXML2;NEEDS_XERCESC;NEEDS_XSD;NEEDS_QT_MODULES;PUBLIC" # possible options
${ARGN}
)
#########################################################################
# #
# CREATE CMAKE VARIABLES #
# #
# * Create required and usefull CMake variables for the macro #
# #
#########################################################################
# TARGET NAME
# The target name is composed of the following: librart-name
# * library is the suffix
# * name is deduced from the input folder containing the calling CMakeLists.txt file of the extension.
# "-" is replaced by "_" if configuring for packaging with NSIS, the program to create a Windows installer.
if (PACKAGING_NSIS)
if ("${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME}" STREQUAL "")
set(LIBRARY_TARGET_NAME library_${DEFAULT_LIBRARY_NAME})
else()
set(LIBRARY_TARGET_NAME library_${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME})
endif()
else()
if ("${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME}" STREQUAL "")
set(LIBRARY_TARGET_NAME library-${DEFAULT_LIBRARY_NAME})
else()
set(LIBRARY_TARGET_NAME library-${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME})
endif()
endif()
#########################################################################
# #
# INCLUDE DIRECTORIES #
# #
# * Include library directories where to look for header files #
# * Include also additional user provided directories #
# * These directories are used for compilation step #
# #
#########################################################################
include_directories ( ${${DEFAULT_LIBRARY_NAME_CMAKE}_INCLUDE_DIRECTORIES} # USER PROVIDED ADDITIONAL DIRECTORIEs
${CMAKE_CURRENT_SOURCE_DIR} # BASIC CAMITK DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR} # LIBRARY DIRECTORIES
)
#########################################################################
# #
# ADDITIONAL KNOWN LIBRARY DEPENDENCIES #
# #
# * Look for specific library needed #
# * Specific libraries are specified as option with the #
# NEEDS_LIBRARY syntax (see macro syntax for more options) #
# * Backward compatibility : Warn user if using old NEEDS_TOOL syntax #
# #
#########################################################################
# LIBXML2
set(LIBXML2_LIBRARY "")
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_LIBXML2)
# LibXml2 is required
find_package(Xml2)
if (LIBXML2_FOUND)
add_definitions(${LIBXML2_DEFINITIONS})
include_directories(${LIBXML2_INCLUDE_DIR})
set(LIBXML2_LIBRARY ${LIBXML2_LIBRARIES})
else()
# most probably win32 or crosscompiling
message(WARNING "${LIBRARY_TARGET_NAME}: libxml2 required")
endif()
endif()
# XERCES-C
set(XERCESC_LIBRARIES)
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_XERCESC)
# XercesC is required
find_package(XercesC REQUIRED)
if (XERCESC_FOUND)
include_directories(${XERCESC_INCLUDE_DIR})
set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
else()
# most probably win32 or crosscompiling
message(FATAL_ERROR "${DEFAULT_LIBRARY_NAME}: xerces-c required. Please provide Xerces-C path.")
endif()
endif()
# XSD
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_XSD)
# XercesC is required
find_package(XercesC REQUIRED)
if (XERCESC_FOUND)
include_directories(${XERCESC_INCLUDE_DIR})
set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
find_package(XSD REQUIRED)
include_directories(${XSD_INCLUDE_DIR})
else()
# most probably win32 or crosscompiling
message(FATAL_ERROR "${LIBRARY_TARGET_NAME}: xerces-c required because of XSD cxx, please set XERCESC_INCLUDE_DIR")
endif()
endif()
# ADDITIONAL QT MODULES
set(QT_MODULES_LIBRARIES)
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_QT_MODULES)
find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork REQUIRED)
if(NOT QT4_FOUND)
message(SEND_ERROR "${DEFAULT_LIBRARY_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
endif()
# CMake will add the Qt modules specific include directories
include(${QT_USE_FILE})
# Qt additional modules are required for linking
set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
endif()
# CEP LIBRARIES
set(CEP_LIBRARIES)
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
foreach(CEP_LIBRARY_NEEDED ${${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
string(TOUPPER ${CEP_LIBRARY_NEEDED} ${CEP_LIBRARY_NEEDED}_INTERNAL)
set(LIBRARY_${${CEP_LIBRARY_NEEDED}_INTERNAL} ON CACHE BOOL "Required by action extension ${EXTENSION_NAME}" FORCE )
if (MSVC)
set(CEP_LIBRARIES ${CEP_LIBRARIES} debug ${CEP_LIBRARY_NEEDED}${CAMITK_DEBUG_POSTFIX}
optimized ${CEP_LIBRARY_NEEDED}
)
else()
if(PACKAGING_NSIS)
set(CEP_LIBRARIES ${CEP_LIBRARIES} ${CEP_LIBRARY_NEEDED})
else()
set(CEP_LIBRARIES ${CEP_LIBRARIES} ${CEP_LIBRARY_NEEDED})
endif()
endif()
include_directories(${CAMITK_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
include_directories(${CAMITK_USER_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
include_directories(${CAMITK_BUILD_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/${CEP_LIBRARY_NEEDED})
endforeach()
endif()
# EXTERNAL DEPENDENCIES
set(LINKER_EXTERNAL_LIBRARIES)
if(${DEFAULT_LIBRARY_NAME_CMAKE}_EXTERNAL_LIBRARIES)
foreach(EXTERNAL_LIBRARY ${${DEFAULT_LIBRARY_NAME_CMAKE}_EXTERNAL_LIBRARIES})
if (MSVC)
set(LINKER_EXTERNAL_LIBRARIES ${LINKER_EXTERNAL_LIBRARIES}
debug ${EXTERNAL_LIBRARY}${CAMITK_DEBUG_POSTFIX}
optimized ${EXTERNAL_LIBRARY}
)
message(STATUS "LINKER_EXTERNAL_LIBRARIES = ${LINKER_EXTERNAL_LIBRARIES}")
else()
set(LINKER_EXTERNAL_LIBRARIES ${LINKER_EXTERNAL_LIBRARIES} ${EXTERNAL_LIBRARY})
endif()
endforeach()
endif()
#########################################################################
# #
# LINK DIRECTORIES #
# #
# * Link directories are used to indicate the compiler where #
# to look for folder containing libraries to link with. #
# * Additional link directories provided by the user #
# #
#########################################################################
# CAMITK BASIC LIB DIRECTORIES
link_directories(${CAMITK_LINK_DIRECTORIES})
# ADDITIONAL LINK DIRECTORIES
if (NOT "${${DEFAULT_LIBRARY_NAME_CMAKE}_LINK_DIRECTORIES}" STREQUAL "")
link_directories(${${DEFAULT_LIBRARY_NAME_CMAKE}_LINK_DIRECTORIES})
endif()
#########################################################################
# #
# TARGET COMPILATION DEFINITION #
# #
# * Additional sources files to consider at compilation (.cpp) #
# * CMake project target definition depending on library type #
# public / private #
# #
#########################################################################
# CMAKE TARGET DEFINITION DEPENDENDING ON THE LIBRARY TYPE (SHARED or STATIC)
if (${DEFAULT_LIBRARY_NAME_CMAKE}_SHARED) # shared library
message(STATUS "Adding shared library: ${LIBRARY_TARGET_NAME}")
add_library(${LIBRARY_TARGET_NAME} SHARED ${${DEFAULT_LIBRARY_NAME_CMAKE}_SOURCES})
# prepare the library specific info (SONAME...)
set(${LIBRARY_TARGET_NAME}_LIBRARY_PROPERTIES ${${LIBRARY_TARGET_NAME}_LIBRARY_PROPERTIES}
VERSION "${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}.${CAMITK_VERSION_PATCH}"
SOVERSION "${CAMITK_VERSION_MAJOR}"
)
# set the library specific info (SONAME...)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ${${LIBRARY_TARGET_NAME}_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "")
elseif (${DEFAULT_LIBRARY_NAME_CMAKE}_STATIC) # static library
message(STATUS "Adding static library: ${LIBRARY_TARGET_NAME}")
add_library(${LIBRARY_TARGET_NAME} STATIC ${${DEFAULT_LIBRARY_NAME_CMAKE}_SOURCES})
else()
message(FATAL_ERROR "In adding static library ${LIBRARY_TARGET_NAME}.\n Please specify the library type: SHARED or STATIC")
endif()
#########################################################################
# #
# LINKING #
# #
# * Linking is the last stage of compilation #
# * Indicate what libraries to use for linking the target #
# #
#########################################################################
# LINKING LIBRARIES
target_link_libraries(${LIBRARY_TARGET_NAME} ${CEP_LIBRARIES} ${LINKER_EXTERNAL_LIBRARIES} ${LIBXML2_LIBRARY} ${QT_MODULES_LIBRARIES} ${XERCESC_LIBRARIES})
#########################################################################
# #
# OUTPUT #
# #
# * Define the output directory (location and name) #
# * Define the output name of the library #
# * Add ${CAMITK_DEBUG_POSTFIX} suffix to Debug MSVC built libraries #
# #
#########################################################################
# OUTPUT DIRECTORY LOCATION and NAME depending on the type of the library (PUBLIC or PRIVATE)
# DEBGUG POSTFIX FOR MSVC
if (${DEFAULT_LIBRARY_NAME_CMAKE}_PUBLIC) # Public library => build in the bin folder
if (MSVC)
# With Visual Studio, public libraries are built in build\bin directory, else it's in build\lib
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
else()
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR})
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR})
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR})
endif()
else() # Private library => build in lib folder
if (MSVC)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}
)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}
)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}
ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}
ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}
)
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
else()
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR})
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR})
set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR})
endif()
endif()
# OUTUPUT LIBRARY NAME (without the prefix "library-").
string(REGEX REPLACE "^library_|^library-" "" LIBRARY_NAME ${LIBRARY_TARGET_NAME})
set_target_properties(${LIBRARY_TARGET_NAME}
PROPERTIES OUTPUT_NAME ${LIBRARY_NAME}
)
#########################################################################
# #
# COMPILATION FLAG #
# #
# * Flags are options to give to the compiler #
# * Add user input flags #
# * Add platform specific flags #
# #
#########################################################################
# USER INPUT COMPILER FLAG
if(${DEFAULT_LIBRARY_NAME_CMAKE}_DEFINES)
foreach (FLAG ${${DEFAULT_LIBRARY_NAME_CMAKE}_DEFINES})
add_definitions(-D${FLAG})
endforeach()
endif()
# PLATFORM SPECIFIC COMPILER FLAG
# 64bits and other platform with relocation needs -fPIC
include(TestCXXAcceptsFlag)
check_cxx_accepts_flag(-fPIC FPIC_FLAG_ACCEPTED)
# no need to add -fPIC on mingw, otherwise it generates a warning: -fPIC ignored for target (all code is position independent) [enabled by default]
# msvc is also accepting the flag, but then produce warning D9002 : ignoring unknown option '-fPIC' cl
if(FPIC_FLAG_ACCEPTED AND NOT WIN32)
set_property(TARGET ${LIBRARY_TARGET_NAME} APPEND PROPERTY COMPILE_FLAGS -fPIC)
endif()
#########################################################################
# #
# INSTALLATION #
# #
# * When installing the project, header files (.h) and test data are #
# copied into an installation folder to determine. #
# * Indicate in this section, where to install your project and which #
# files to copy into that folder (during local/global installation) #
# #
#########################################################################
# FOLDER INSTALLATION
# Indicate where to install the library, dependending on its property (public / private)
if (${DEFAULT_LIBRARY_NAME_CMAKE}_PUBLIC) # public library
if(WIN32)
# public library -> install in bin folder
install(TARGETS ${LIBRARY_TARGET_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}
COMPONENT ${LIBRARY_NAME_INSTALL}
)
else()
# other public libraries -> install in lib folder
install(TARGETS ${LIBRARY_TARGET_NAME}
RUNTIME DESTINATION lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT ${LIBRARY_NAME_INSTALL}
)
endif()
else()
# private library -> install in lib/camitk-version folder
install(TARGETS ${LIBRARY_TARGET_NAME}
RUNTIME DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}
LIBRARY DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}
ARCHIVE DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}
COMPONENT ${LIBRARY_NAME_INSTALL}
)
endif()
# HEADER FILES (.h) INSTALLATION
# generate an install target for headers in include/{camitk-version}/libraries
if(${DEFAULT_LIBRARY_NAME_CMAKE}_HEADERS_TO_INSTALL)
export_headers(${${DEFAULT_LIBRARY_NAME_CMAKE}_HEADERS_TO_INSTALL} COMPONENT ${LIBRARY_TARGET_NAME} GROUP libraries)
endif()
#########################################################################
# #
# PROJECT DEPENDENCIES #
# #
# * Add in this section library dependencies to other camitk projects #
# to keep a correct build order. #
# #
#########################################################################
# CEP LIBRARIES DEPENDENCIES
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
foreach(CEP_LIBRARY_NEEDED ${${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
if(PACKAGING_NSIS)
add_dependencies(${LIBRARY_TARGET_NAME} library_${CEP_LIBRARY_NEEDED})
else()
add_dependencies(${LIBRARY_TARGET_NAME} library-${CEP_LIBRARY_NEEDED})
endif()
endforeach()
endif()
#########################################################################
# #
# CDASH SUBPROJECT DESCRIPTION #
# #
# * Update the XML descriton of the subprojects dependencies #
# for CDash. #
# #
#########################################################################
# CDASH XML SUBPROJECTS DESCRIPTION UPDATE
camitk_sub_project_add(CEP_LIBRARY ${LIBRARY_TARGET_NAME})
#########################################################################
# #
# PACKAGING CATEGORIZATION #
# #
# * On Windows, when building a package (win32 installer), the #
# install shield wizard proposes you to select which component #
# to install. #
# * Each component to install has a short description following its #
# name to understand its role. #
# * This section deals with the categorization and the description #
# of the component in this installer. #
# #
#########################################################################
# WINDOWS INSTALLER CATEGORIZATION
if(${DEFAULT_LIBRARY_NAME_CMAKE}_CEP_NAME) # This input variable describes the category
if (${DEFAULT_LIBRARY_NAME_CMAKE}_CEP_NAME MATCHES "SDK")
# The default SDK extensions are categorized as "required" and are not "unselectable" by the user at installation time
cpack_add_component(${LIBRARY_TARGET_NAME}
DISPLAY_NAME ${LIBRARY_TARGET_NAME}
DESCRIPTION ${${DEFAULT_LIBRARY_NAME_CMAKE}_DESCRIPTION}
REQUIRED
GROUP SDK
)
else()
# Extension is selectable for installation in the wizard of the installer
cpack_add_component(${LIBRARY_TARGET_NAME}
DISPLAY_NAME ${LIBRARY_TARGET_NAME}
DESCRIPTION ${${DEFAULT_LIBRARY_NAME_CMAKE}_DESCRIPTION}
GROUP ${${DEFAULT_LIBRARY_NAME_CMAKE}_CEP_NAME}
)
endif()
else()
# Extension if not categorized for packaging presentation
cpack_add_component(${LIBRARY_TARGET_NAME}
DISPLAY_NAME ${LIBRARY_TARGET_NAME}
DESCRIPTION ${${DEFAULT_LIBRARY_NAME_CMAKE}_DESCRIPTION}
)
endif()
endmacro()
# Old macro to configure a tool
# Use camitk_library macro instead
# TODO CAMITK_DEPRECATED. This macro is marked as deprecated. It is to be removed in CamiTK 4.0
macro(camitk_tool)
message(WARNING "Warning: ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt: camitk_tool macro is deprecated, please usecamitk_library(...) instead (use the same parameters).")
# string(REPLACE "NEEDS_TOOL" "NEEDS_CEP_LIBRARIES" OBSOLETE_ARGN ${ARGN})
# message(STATUS "**************************************** ${ARGN} ===>>> ${OBSOLETE_ARGN} ")
camitk_library(${OBSOLETE_ARGN})
endmacro()
|