Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/medical/DICOM/dicomReader/cmake/DICOMUtilities.cmake is written in an unsupported language. File is not indexed.

0001 # Utility macros for DICOM example
0002 # called from the DICOM example CMakeLists.txt
0003 #
0004 
0005 # - Include guard
0006 if(__dicomutilities_isloaded)
0007   return()
0008 endif()
0009 set(__dicomutilities_isloaded YES)
0010 
0011 # - for cmake_parse_arguments
0012 include(CMakeParseArguments)
0013 
0014 macro(DICOM_BUILD_LIBRARY)
0015 
0016     set(_options    )                       # options
0017     set(_onevalue   BUILD_SHARED            # single-value
0018                     BUILD_STATIC
0019                     OUTPUT_NAME
0020                     TARGET_NAME)
0021     set(_multival   SOURCES                 # multi-value
0022                     LINK_LIBRARIES
0023                     COMPILE_DEFINITIONS)
0024 
0025     cmake_parse_arguments(
0026         LIBRARY "${_options}" "${_onevalue}" "${_multival}" ${ARGN})
0027 
0028     # static library
0029     if(LIBRARY_BUILD_STATIC)
0030         # add static library
0031         add_library(${LIBRARY_TARGET_NAME}-static STATIC ${LIBRARY_SOURCES})
0032         # link
0033         target_link_libraries(${LIBRARY_TARGET_NAME}-static ${LIBRARY_LINK_LIBRARIES})
0034         # properties
0035         set_target_properties(${LIBRARY_TARGET_NAME}-static PROPERTIES
0036             OUTPUT_NAME ${LIBRARY_OUTPUT_NAME}
0037             POSITION_INDEPENDENT_CODE OFF)
0038         # On Windows, *must distinguish archive from DLL import lib (and other outputs)
0039         if(WIN32)
0040             set_target_properties(${LIBRARY_TARGET_NAME}-static PROPERTIES
0041                 OUTPUT_NAME ${LIBRARY_OUTPUT_NAME}-static)
0042         endif()
0043         # append this to list of libraries to install
0044         list(APPEND ${PROJECT_NAME}_INSTALL_LIBRARIES ${LIBRARY_TARGET_NAME}-static)
0045     endif(LIBRARY_BUILD_STATIC)
0046 
0047     # shared library
0048     if(LIBRARY_BUILD_SHARED)
0049         # add shared
0050         add_library(${LIBRARY_TARGET_NAME} SHARED ${LIBRARY_SOURCES})
0051         # link
0052         target_link_libraries(${LIBRARY_TARGET_NAME} ${LIBRARY_LINK_LIBRARIES})
0053         # properties
0054         set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES
0055             OUTPUT_NAME ${LIBRARY_OUTPUT_NAME}
0056             POSITION_INDEPENDENT_CODE ON
0057             WINDOWS_EXPORT_ALL_SYMBOLS ON)
0058         # append this to list of libraries to install
0059         list(APPEND ${PROJECT_NAME}_INSTALL_LIBRARIES ${LIBRARY_TARGET_NAME})
0060         # cleanup
0061     endif(LIBRARY_BUILD_SHARED)
0062 
0063     add_library(${PROJECT_NAME}::library ALIAS ${LIBRARY_TARGET_NAME}${_geant4_lib_use_suffix})
0064 
0065 endmacro(DICOM_BUILD_LIBRARY)