77 #########################################################################
81 # * Use
a macro to create the CMAKE variables according to the #
82 # provided options as input. #
84 #########################################################################
88 set(options SHARED STATIC NEEDS_CAMITKCORE NEEDS_ITK NEEDS_LIBXML2 NEEDS_XERCESC NEEDS_XSD NEEDS_QT PUBLIC)
89 set(oneValueArgs LIBNAME CEP_NAME DESCRIPTION)
90 set(multiValueArgs SOURCES NEEDS_CEP_LIBRARIES EXTERNAL_LIBRARIES INCLUDE_DIRECTORIES DEFINES LINK_DIRECTORIES HEADERS_TO_INSTALL EXTRA_TRANSLATE_LANGUAGE CXX_FLAGS)
91 cmake_parse_arguments(${DEFAULT_LIBRARY_NAME_CMAKE}
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
94 #########################################################################
96 # Consider moc sources files #
98 # *
if you use Q_OBJECT in your classes #
100 #########################################################################
101 file(GLOB_RECURSE MOC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/moc_*.cxx)
102 set(${DEFAULT_LIBRARY_NAME_CMAKE}_SOURCES ${${DEFAULT_LIBRARY_NAME_CMAKE}_SOURCES} ${MOC_SRCS})
105 #########################################################################
107 # CREATE CMAKE VARIABLES #
109 # * Create required and useful CMake variables
for the macro #
111 #########################################################################
114 # The target name is composed of the following: library-name
115 # * library is the suffix
116 # * name is deduced from the input folder containing the calling CMakeLists.txt file of the extension.
117 #
"-" is replaced by
"_" if configuring
for packaging with NSIS, the program to create
a Windows installer.
119 if (
"${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME}" STREQUAL
"")
120 set(LIBRARY_TARGET_NAME library_${DEFAULT_LIBRARY_NAME})
122 set(LIBRARY_TARGET_NAME library_${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME})
125 if (
"${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME}" STREQUAL
"")
126 set(LIBRARY_TARGET_NAME library-${DEFAULT_LIBRARY_NAME})
128 set(LIBRARY_TARGET_NAME library-${${DEFAULT_LIBRARY_NAME_CMAKE}_LIBNAME})
134 #########################################################################
136 # INCLUDE DIRECTORIES #
138 # * Include library directories where to look for header files #
139 # * Include also additional user provided directories #
140 # * These directories are used for compilation step #
142 #########################################################################
145 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
146 include_directories(${CMAKE_CURRENT_BINARY_DIR})
147 include_directories(${CAMITK_INCLUDE_DIRECTORIES})
149 # USER PROVIDED ADDITIONAL DIRECTORIEs
150 include_directories(${${DEFAULT_LIBRARY_NAME_CMAKE}_INCLUDE_DIRECTORIES})
154 #########################################################################
158 # * On Windows, Visual Studio, group .moc and .ui files #
159 # in subdirectories #
161 #########################################################################
163 source_group(
"Source Files\\Moc Files" "moc_*")
164 source_group(
"Source Files\\CLI Files" "CommandLineOptions.*")
165 source_group(
"Header Files\\UI Files" "ui_*.h")
166 source_group(
"Source Files\\Resources Files" "qrc_*")
167 source_group(
"Source Files\\Resources Files" "*.qrc")
168 source_group(
"UI Files" "*.ui")
173 #########################################################################
175 # ADDITIONAL KNOWN LIBRARY DEPENDENCIES #
177 # * Look for specific library needed #
178 # * Specific libraries are specified as option with the #
179 # NEEDS_LIBRARY syntax (see macro syntax for more options) #
180 # * Backward compatibility : Warn user if using old NEEDS_TOOL syntax #
182 #########################################################################
185 set(ITK_LIBRARIES
"")
186 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_ITK)
187 find_package(ITK 4.12 REQUIRED)
190 set(ITK_VERSION ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}) #ITK_VERSION is not always
set
191 set(CAMITK_ITK_VERSION ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR})
192 message(STATUS
"${${DEFAULT_LIBRARY_NAME_CMAKE}_TARGET_NAME}: Found ITK version ${ITK_VERSION}")
194 if ((${ITK_VERSION} VERSION_GREATER
"4")) # ITK 4.12 on Windows, maybe
a lesser version
for Linux.
196 set(ITK_DIR ${ITK_DIR}/../..)
197 # Construct list of ITK libraries
for linking = CAMITK_ITK_LIBRARIES
198 foreach(ITK_LIBRARY ${ITK_LIBRARIES})
199 string(SUBSTRING ${ITK_LIBRARY} 0 3 ${ITK_LIBRARY}_PREFIX)
200 # Some libraries have not the expected
'itk' prefix. Add it then
201 if((NOT ${${ITK_LIBRARY}_PREFIX} STREQUAL
"itk") AND (NOT ${${ITK_LIBRARY}_PREFIX} STREQUAL
"ITK"))
202 set(ITK_LIBRARY
itk${ITK_LIBRARY})
204 list(APPEND CAMITK_ITK_LIBRARIES debug ${ITK_DIR}/${ITK_LIBRARY}-${CAMITK_ITK_VERSION}${CAMITK_DEBUG_POSTFIX}.lib
205 optimized ${ITK_DIR}/${ITK_LIBRARY}-${CAMITK_ITK_VERSION}.lib
209 set(CAMITK_ITK_LIBRARIES ${ITK_LIBRARIES})
211 message(WARNING
"CamiTKExtension.cmake: ITK LIBRARY NOT SET FOR APPLE")
214 message(FATAL_ERROR "Wrong version of ITK : ${ITK_VERSION}. At least version 4.12 is required
")
217 message(FATAL_ERROR "ITK not found but required
for ${${DEFAULT_LIBRARY_NAME_CMAKE}_TARGET_NAME}
")
222 set(LIBXML2_LIBRARY "")
223 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_LIBXML2)
224 # LibXml2 is required
227 add_definitions(${LIBXML2_DEFINITIONS})
228 include_directories(${LIBXML2_INCLUDE_DIR})
229 set(LIBXML2_LIBRARY ${LIBXML2_LIBRARIES})
231 # most probably win32 or crosscompiling
232 message(WARNING "${LIBRARY_TARGET_NAME}: libxml2 required
")
237 set(XERCESC_LIBRARIES)
238 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_XERCESC)
239 # XercesC is required
240 find_package(XercesC REQUIRED)
242 include_directories(${XERCESC_INCLUDE_DIR})
243 set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
245 # most probably win32 or crosscompiling
246 message(FATAL_ERROR "${DEFAULT_LIBRARY_NAME}: xerces-c required. Please provide Xerces-C path.
")
251 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_XSD)
252 # XercesC is required
253 find_package(XercesC REQUIRED)
255 include_directories(${XERCESC_INCLUDE_DIR})
256 set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
257 find_package(XSD REQUIRED)
258 include_directories(${XSD_INCLUDE_DIR})
260 # most probably win32 or crosscompiling
261 message(FATAL_ERROR "${LIBRARY_TARGET_NAME}: xerces-c required because of XSD cxx, please
set XERCESC_INCLUDE_DIR
")
266 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_QT)
267 # Instruct CMake to run moc automatically when needed.
268 set(CMAKE_AUTOMOC ON)
270 set(QT_COMPONENTS Core Gui Xml XmlPatterns Widgets Help UiTools OpenGL OpenGLExtensions Test)
271 string(REGEX REPLACE "([^;]+)
" "Qt5::\\1
" QT_LIBRARIES "${QT_COMPONENTS}
")
272 find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
274 # cmake_policy(SET CMP0020 NEW) # policy for Qt core linking to qtmain.lib
275 message(STATUS "${LIBRARY_TARGET_NAME}: found Qt ${Qt5_VERSION}.
")
276 set(QT_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5XmlPatterns_INCLUDE_DIRS} ${Qt5Declarative_INCLUDE_DIRS} ${Qt5Help_INCLUDE_DIRS} ${Qt5UiTools_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5OpenGLExtensions_INCLUDE_DIRS})
277 include_directories(${QT_INCLUDE_DIRS})
279 message(SEND_ERROR "${LIBRARY_TARGET_NAME}: Failed to find Qt 5.x. This is needed by ${LIBRARY_TARGET_NAME}.
")
283 # EXTERNAL DEPENDENCIES
284 set(LINKER_EXTERNAL_LIBRARIES)
285 if(${DEFAULT_LIBRARY_NAME_CMAKE}_EXTERNAL_LIBRARIES)
286 foreach(EXTERNAL_LIBRARY ${${DEFAULT_LIBRARY_NAME_CMAKE}_EXTERNAL_LIBRARIES})
288 set(LINKER_EXTERNAL_LIBRARIES ${LINKER_EXTERNAL_LIBRARIES}
289 debug ${EXTERNAL_LIBRARY}${CAMITK_DEBUG_POSTFIX}.lib
290 optimized ${EXTERNAL_LIBRARY}.lib
292 message(STATUS "LINKER_EXTERNAL_LIBRARIES = ${LINKER_EXTERNAL_LIBRARIES}
")
294 set(LINKER_EXTERNAL_LIBRARIES ${LINKER_EXTERNAL_LIBRARIES} ${EXTERNAL_LIBRARY})
301 #########################################################################
305 # * Link directories are used to indicate the compiler where #
306 # to look for folder containing libraries to link with. #
307 # * Additional link directories provided by the user #
309 #########################################################################
310 # CAMITK BASIC LIB DIRECTORIES
311 link_directories(${CAMITK_LINK_DIRECTORIES})
313 # ADDITIONAL LINK DIRECTORIES
314 if (NOT "${${DEFAULT_LIBRARY_NAME_CMAKE}_LINK_DIRECTORIES}
" STREQUAL "")
315 link_directories(${${DEFAULT_LIBRARY_NAME_CMAKE}_LINK_DIRECTORIES})
320 #########################################################################
322 # TARGET COMPILATION DEFINITION #
324 # * Additional sources files to consider at compilation (.cpp) #
325 # * CMake project target definition depending on library type #
328 #########################################################################
329 # CMAKE TARGET DEFINITION DEPENDENDING ON THE LIBRARY TYPE (SHARED or STATIC)
330 if (${DEFAULT_LIBRARY_NAME_CMAKE}_SHARED) # shared library
331 message(STATUS "Building shared library: ${LIBRARY_TARGET_NAME}
")
332 add_library(${LIBRARY_TARGET_NAME} SHARED ${${DEFAULT_LIBRARY_NAME_CMAKE}_SOURCES})
333 # prepare the library specific info (SONAME...)
334 set(${LIBRARY_TARGET_NAME}_LIBRARY_PROPERTIES ${${LIBRARY_TARGET_NAME}_LIBRARY_PROPERTIES}
335 VERSION "${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}.${CAMITK_VERSION_PATCH}
"
336 SOVERSION "${CAMITK_VERSION_MAJOR}
"
339 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ${${LIBRARY_TARGET_NAME}_LIBRARY_PROPERTIES} LINK_INTERFACE_LIBRARIES "")
340 elseif (${DEFAULT_LIBRARY_NAME_CMAKE}_STATIC) # static library
341 message(STATUS "Building
static library: ${LIBRARY_TARGET_NAME}
")
342 add_library(${LIBRARY_TARGET_NAME} STATIC ${${DEFAULT_LIBRARY_NAME_CMAKE}_SOURCES})
344 message(FATAL_ERROR "In adding
static library ${LIBRARY_TARGET_NAME}.\n Please specify the library type: SHARED or STATIC
")
349 #########################################################################
351 # QT LINKING LIBRARIES #
353 # * Set linking modules for the Qt5 libraries #
355 #########################################################################
356 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_QT)
357 target_link_libraries(${LIBRARY_TARGET_NAME} ${QT_LIBRARIES})
361 #########################################################################
363 # CAMITK CORE LIBRARIES #
365 # * If a library build on top of CamiTKCore add required dependencies #
367 #########################################################################
368 # Check if camitk core is needed
369 if (${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CAMITKCORE)
370 set(CAMITK_LIBRARIES_DEPENDENCIES ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES})
374 #########################################################################
376 # CAMITK LIBRARIES DEPENDENCIES #
378 # * Add in this section library dependencies to other camitk libraies #
379 # to keep a correct build order (NEEDS_CEP_LIBRARIES). #
381 #########################################################################
383 # CEP LIBRARIES DEPENDENCIES
384 if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CEP_LIBRARIES)
385 set(CEP_LIBRARIES "")
386 set(LIBRARIES_DEPENDENCY_LIST "") #use for generating the project.xml file
387 foreach(CEP_LIBRARY_NEEDED ${${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_CEP_LIBRARIES})
388 # include directories from build, camitk (local or global install).
389 include_directories(${CAMITK_BUILD_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
390 include_directories(${CAMITK_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED})
391 include_directories(${CMAKE_CURRENT_BINARY_DIR}/../../libraries/${CEP_LIBRARY_NEEDED})
394 list(APPEND CEP_LIBRARIES debug ${CEP_LIBRARY_NEEDED}${CAMITK_DEBUG_POSTFIX}.lib
395 optimized ${CEP_LIBRARY_NEEDED}
398 list(APPEND CEP_LIBRARIES ${CEP_LIBRARY_NEEDED})
400 # CMake / CDash dependencies
402 if (EXISTS ${CAMITK_BUILD_INCLUDE_DIR}/libraries/${CEP_LIBRARY_NEEDED} AND NOT TARGET library_${CEP_LIBRARY_NEEDED})
403 message(STATUS "Importing target library_${CEP_LIBRARY_NEEDED}
")
404 add_library(library_${CEP_LIBRARY_NEEDED} INTERFACE IMPORTED)
406 # now add the dependency
407 add_dependencies(${LIBRARY_TARGET_NAME} library_${CEP_LIBRARY_NEEDED})
409 if (NOT TARGET library-${CEP_LIBRARY_NEEDED})
410 message(STATUS "Importing target library-${CEP_LIBRARY_NEEDED}
")
411 add_library(library-${CEP_LIBRARY_NEEDED} INTERFACE IMPORTED)
413 add_dependencies(${LIBRARY_TARGET_NAME} library-${CEP_LIBRARY_NEEDED})
414 list(APPEND LIBRARIES_DEPENDENCY_LIST library-${CEP_LIBRARY_NEEDED})
421 #########################################################################
425 # * Linking is the last stage of compilation #
426 # * Indicate what libraries to use for linking the target #
428 #########################################################################
430 target_link_libraries(${LIBRARY_TARGET_NAME} ${CAMITK_LIBRARIES_DEPENDENCIES} ${CEP_LIBRARIES} ${LINKER_EXTERNAL_LIBRARIES} ${LIBXML2_LIBRARY} ${CAMITK_ITK_LIBRARIES} ${XERCESC_LIBRARIES})
434 #########################################################################
438 # * Define the output directory (location and name) #
439 # * Define the output name of the library #
440 # * Add ${CAMITK_DEBUG_POSTFIX} suffix to Debug MSVC built libraries #
442 #########################################################################
444 # OUTPUT DIRECTORY LOCATION and NAME depending on the type of the library (PUBLIC or PRIVATE)
445 # DEBGUG POSTFIX FOR MSVC
446 if (${DEFAULT_LIBRARY_NAME_CMAKE}_PUBLIC) # Public library => build in the bin folder
448 # With Visual Studio, public libraries are built in build\bin directory, else it's in build\lib
449 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
450 LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
451 LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
453 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
454 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
455 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
457 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_BIN_DIR}
458 ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_BIN_DIR}
459 ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_BIN_DIR}
461 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
463 # for xcode generation, the <CONFIG> postfix should also be used, but "a la
" UNIX (lib in /lib etc...)
464 # no need to check the generator with if(CMAKE_GENERATOR STREQUAL Xcode), as the <CONFIG> postfix should
465 # not affect the other unix generators
466 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR}
467 LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PUBLIC_LIB_DIR}
468 LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PUBLIC_LIB_DIR}
470 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR}
471 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PUBLIC_LIB_DIR}
472 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PUBLIC_LIB_DIR}
474 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_PUBLIC_LIB_DIR}
475 ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PUBLIC_LIB_DIR}
476 ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PUBLIC_LIB_DIR}
479 else() # Private library => build in lib folder
481 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CAMITK_DEBUG_POSTFIX})
483 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}
484 LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}
485 LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}
487 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}
488 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}
489 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}
491 set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CAMITK_BUILD_PRIVATE_LIB_DIR}
492 ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CAMITK_BUILD_PRIVATE_LIB_DIR}
493 ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CAMITK_BUILD_PRIVATE_LIB_DIR}
497 # OUTPUT LIBRARY NAME (without the prefix "library-
").
498 string(REGEX REPLACE "^library_|^library-
" "" LIBRARY_NAME "${LIBRARY_TARGET_NAME}
")
499 set_target_properties(${LIBRARY_TARGET_NAME}
500 PROPERTIES OUTPUT_NAME ${LIBRARY_NAME}
505 #########################################################################
509 # * Flags are options to give to the compiler #
510 # * Add user input flags #
511 # * Add platform specific flags #
513 #########################################################################
515 # USER INPUT COMPILER FLAG
516 if(${DEFAULT_LIBRARY_NAME_CMAKE}_DEFINES)
517 foreach (FLAG ${${DEFAULT_LIBRARY_NAME_CMAKE}_DEFINES})
518 add_definitions(-D${FLAG})
522 # USER INPUT CUSTOM COMPILER FLAG
523 if(${DEFAULT_LIBRARY_NAME_CMAKE}_CXX_FLAGS)
524 foreach (FLAG ${${DEFAULT_LIBRARY_NAME_CMAKE}_CXX_FLAGS})
525 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}
")
529 # PLATFORM SPECIFIC COMPILER FLAG
530 # 64bits and other platform with relocation needs -fPIC
531 include(TestCXXAcceptsFlag)
532 check_cxx_accepts_flag(-fPIC FPIC_FLAG_ACCEPTED)
533 # no need to add -fPIC on mingw, otherwise it generates a warning: -fPIC ignored for target (all code is position independent) [enabled by default]
534 # msvc is also accepting the flag, but then produce warning D9002 : ignoring unknown option '-fPIC' cl
535 if(FPIC_FLAG_ACCEPTED AND NOT WIN32)
536 set_property(TARGET ${LIBRARY_TARGET_NAME} APPEND PROPERTY COMPILE_FLAGS -fPIC)
541 #########################################################################
545 # * When installing the project, header files (.h) and test data are #
546 # copied into an installation folder to determine. #
547 # * Indicate in this section, where to install your project and which #
548 # files to copy into that folder (during local/global installation) #
550 #########################################################################
552 # FOLDER INSTALLATION
553 # Indicate where to install the library, dependending on its property (public / private)
554 message(STATUS "Installing library ${LIBRARY_TARGET_NAME} in ${CMAKE_INSTALL_LIBDIR}
")
555 if (${DEFAULT_LIBRARY_NAME_CMAKE}_PUBLIC) # public library
557 # public library -> install in bin folder
558 install(TARGETS ${LIBRARY_TARGET_NAME}
559 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
560 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
561 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CAMITK_SHORT_VERSION_STRING}
562 COMPONENT ${LIBRARY_NAME_INSTALL}
565 # other public libraries -> install in lib folder
566 install(TARGETS ${LIBRARY_TARGET_NAME}
567 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
568 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
569 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
570 COMPONENT ${LIBRARY_NAME_INSTALL}
574 # private library -> install in lib/camitk-version folder
575 install(TARGETS ${LIBRARY_TARGET_NAME}
576 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CAMITK_SHORT_VERSION_STRING}
577 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CAMITK_SHORT_VERSION_STRING}
578 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${CAMITK_SHORT_VERSION_STRING}
579 COMPONENT ${LIBRARY_NAME_INSTALL}
583 # HEADER FILES (.h) INSTALLATION
584 if(${DEFAULT_LIBRARY_NAME_CMAKE}_HEADERS_TO_INSTALL)
585 # If headers information provided for installation => install them
586 export_headers(${${DEFAULT_LIBRARY_NAME_CMAKE}_HEADERS_TO_INSTALL} COMPONENT ${LIBRARY_TARGET_NAME} GROUP libraries)
588 # By default, install all headers and keep include directories structure
589 camitk_install_all_headers(COMPONENT ${LIBRARY_TARGET_NAME} GROUP libraries)
592 #########################################################################
594 # CDASH SUBPROJECT DESCRIPTION #
596 # * Update the XML descriton of the subprojects dependencies #
599 #########################################################################
600 # CDASH XML SUBPROJECTS DESCRIPTION UPDATE
601 if(LIBRARY_TARGET_NAME STREQUAL "library-qtpropertybrowser
")
602 # library-qtpropertybrowser is a corelib as library-camitkcore depends on it
603 camitk_register_subproject(CORELIB ${LIBRARY_TARGET_NAME} DEPENDENCIES ${LIBRARIES_DEPENDENCY_LIST})
605 camitk_register_subproject(CEP_LIBRARY ${LIBRARY_TARGET_NAME} DEPENDENCIES ${LIBRARIES_DEPENDENCY_LIST})
610 #####################################################################################
614 # * CAMITK_TRANSLATIONS contains the list of language to translate #
617 # * Create the translate.pro file which contains 4 sections: #
618 # - HEADERS: list of .h/.hpp files to look for tr("") QString #
619 # - SOURCES: list of .cpp files to look for tr("") QString #
620 # - FORMS: list of .ui files to look for tr("") QString #
621 # - TRANSLATIONS: list of .ts files which use CAMITK_TRANSLATIONS #
622 # to define each .ts file #
624 # * Execute lupdate program to update the .ts files with new QString #
627 # * Execute lrelease program to create .qm files (binary equivalent of #
630 # * Create translate.qrc which contains the list of .qm files. #
631 # * Create the flags.qrc file which contains the list of .png flags #
634 #####################################################################################
636 if(${DEFAULT_LIBRARY_NAME_CMAKE}_EXTRA_TRANSLATE_LANGUAGE)
637 camitk_translate(EXTRA_LANGUAGE ${${DEFAULT_LIBRARY_NAME_CMAKE}_EXTRA_TRANSLATE_LANGUAGE})
645 #########################################################################
647 # PACKAGING CATEGORIZATION #
649 # * On Windows, when building a package (win32 installer), the #
650 # install shield wizard proposes you to select which component #
652 # * Each component to install has a short description following its #
653 # name to understand its role. #
654 # * This section deals with the categorization and the description #
655 # of the component in this installer. #
657 #########################################################################
659 # WINDOWS INSTALLER CATEGORIZATION
660 if(${DEFAULT_LIBRARY_NAME_CMAKE}_CEP_NAME) # This input variable describes the category
661 if (${DEFAULT_LIBRARY_NAME_CMAKE}_CEP_NAME MATCHES "SDK
")
662 # The default SDK extensions are categorized as "required
" and are not "unselectable
" by the user at installation time
663 cpack_add_component(${LIBRARY_TARGET_NAME}
664 DISPLAY_NAME ${LIBRARY_TARGET_NAME}
665 DESCRIPTION ${${DEFAULT_LIBRARY_NAME_CMAKE}_DESCRIPTION}
671 # Extension is selectable for installation in the wizard of the installer
672 cpack_add_component(${LIBRARY_TARGET_NAME}
673 DISPLAY_NAME ${LIBRARY_TARGET_NAME}
674 DESCRIPTION ${${DEFAULT_LIBRARY_NAME_CMAKE}_DESCRIPTION}
675 GROUP ${${DEFAULT_LIBRARY_NAME_CMAKE}_CEP_NAME}
679 # Extension if not categorized for packaging presentation
680 cpack_add_component(${LIBRARY_TARGET_NAME}
681 DISPLAY_NAME ${LIBRARY_TARGET_NAME}
682 DESCRIPTION ${${DEFAULT_LIBRARY_NAME_CMAKE}_DESCRIPTION}
if(${CMAKE_VERSION} VERSION_GREATER "3.3" OR ${CMAKE_VERSION} VERSION_EQUAL "3.3") option(CAMITK_INCLUDE_WHAT_YOU_USE "Enable the header analysis on you code
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
static void include(QRect &r, const QRect &rect)
Definition: canvas_typed/qtcanvas.cpp:98
camitk_library()
macro camitk_library simplifies the declaration of a library inside CamiTK and is to be used for all ...
Definition: CamiTKLibrary.h:75
get_directory_name()
macro get_directory_name set the variable VariableName to the name of the last directory of FullPathD...
Definition: GetDirectoryName.h:14
Definition: itkImageToVTKImageFilter.h:39