Warning, /geant4/examples/extended/medical/DICOM/dicomReader/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 #----------------------------------------------------------------------------
0002 # Setup the project
0003 cmake_minimum_required(VERSION 3.16...3.27)
0004 project(dicomReader)
0005 # for shared library
0006 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
0007 #set(CMAKE_MACOSX_RPATH OFF)
0008
0009 #----------------------------------------------------------------------------
0010 # Find Geant4 package, no UI and Vis drivers activated
0011 #
0012 find_package(Geant4 REQUIRED)
0013
0014 #----------------------------------------------------------------------------
0015 # Setup Geant4 include directories and compile definitions
0016 #
0017 include(${Geant4_USE_FILE})
0018 include("${PROJECT_SOURCE_DIR}/cmake/DICOMUtilities.cmake")
0019
0020 #----------------------------------------------------------------------------
0021 # Find DCMTK installation
0022 #
0023 find_package(DCMTK REQUIRED)
0024 add_definitions(-DG4_DCMTK)
0025
0026 #----------------------------------------------------------------------------
0027 # Locate sources and headers for this project
0028 #
0029 include_directories(${PROJECT_SOURCE_DIR}/include
0030 ${Geant4_INCLUDE_DIR}
0031 ${DCMTK_INCLUDE_DIRS})
0032
0033 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0034 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0035
0036 #----------------------------------------------------------------------------
0037 # Add the library
0038 #
0039 dicom_build_library(
0040 BUILD_SHARED ${Geant4_shared_FOUND}
0041 BUILD_STATIC ${Geant4_static_FOUND}
0042 OUTPUT_NAME dicomReader
0043 TARGET_NAME dicomReader
0044 SOURCES ${headers} ${sources}
0045 LINK_LIBRARIES ${Geant4_LIBRARIES} ${DCMTK_LIBRARIES})
0046
0047 #----------------------------------------------------------------------------
0048 # Configuration
0049 #
0050 include(CMakePackageConfigHelpers)
0051 include(GNUInstallDirs)
0052
0053 #----------------------------------------------------------------------------
0054 # Configuration for build tree
0055 #
0056 export(TARGETS ${${PROJECT_NAME}_INSTALL_LIBRARIES}
0057 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Build.cmake)
0058
0059 set(PROJECT_TARGETS_FILE ${PROJECT_NAME}Build.cmake)
0060 set(PACKAGE_INCLUDE_INSTALL_DIR ${PROJECT_SOURCE_DIR}/include)
0061 set(PACKAGE_INIT
0062 "macro(set_and_check _var _file)
0063 set(\${_var} \"\${_file}\")
0064 if(NOT EXISTS \"\${_file}\")
0065 message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
0066 endif()
0067 endmacro()
0068
0069 macro(check_required_components _NAME)
0070 foreach(comp \${\${_NAME}_FIND_COMPONENTS})
0071 if(NOT \${_NAME}_\${comp}_FOUND)
0072 if(\${_NAME}_FIND_REQUIRED_\${comp})
0073 set(\${_NAME}_FOUND FALSE)
0074 endif()
0075 endif()
0076 endforeach()
0077 endmacro()
0078 ")
0079
0080 configure_file(
0081 ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
0082 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY)
0083
0084 write_basic_package_version_file(
0085 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
0086 VERSION ${Geant4_VERSION}
0087 COMPATIBILITY SameMajorVersion )
0088
0089 unset(PACKAGE_INIT)
0090
0091 #----------------------------------------------------------------------------
0092 # Install the library to 'lib' directory under CMAKE_INSTALL_PREFIX
0093 #
0094 set(${PROJECT_NAME}_DIR ${CMAKE_INSTALL_LIBDIR}/Geant4-${Geant4_VERSION} CACHE PATH "${PROJECT_NAME} installation")
0095
0096 install(FILES ${headers} DESTINATION include/${PROJECT_NAME})
0097 install(TARGETS ${${PROJECT_NAME}_INSTALL_LIBRARIES}
0098 DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT ${PROJECT_NAME}Targets)
0099 install(EXPORT ${PROJECT_NAME}Targets DESTINATION ${${PROJECT_NAME}_DIR})
0100
0101 set(PROJECT_TARGETS_FILE ${PROJECT_NAME}Targets.cmake)
0102 set(INCLUDE_INSTALL_DIR include/${PROJECT_NAME})
0103 set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
0104
0105 configure_package_config_file(
0106 ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
0107 ${PROJECT_BINARY_DIR}/InstallTreeFiles/${PROJECT_NAME}Config.cmake
0108 INSTALL_DESTINATION ${${PROJECT_NAME}_DIR}
0109 PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
0110
0111 write_basic_package_version_file(
0112 ${PROJECT_BINARY_DIR}/InstallTreeFiles/${PROJECT_NAME}ConfigVersion.cmake
0113 VERSION ${Geant4_VERSION}
0114 COMPATIBILITY SameMajorVersion )
0115
0116 install(FILES ${PROJECT_BINARY_DIR}/InstallTreeFiles/${PROJECT_NAME}Config.cmake
0117 ${PROJECT_BINARY_DIR}/InstallTreeFiles/${PROJECT_NAME}ConfigVersion.cmake
0118 DESTINATION ${${PROJECT_NAME}_DIR} )