Newer
Older
PROJECT(ChimeraTK-ApplicationCore)
include(cmake/add_dependency.cmake)
Martin Christoph Hierholzer
committed
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
Martin Killenberg
committed
set(${PROJECT_NAME}_MINOR_VERSION 10)
set(${PROJECT_NAME}_PATCH_VERSION 00)
Martin Christoph Hierholzer
committed
include(cmake/set_version_numbers.cmake)
Martin Christoph Hierholzer
committed
# Find the ControlSystemAdapter
add_dependency(ChimeraTK-ControlSystemAdapter 02.04 REQUIRED)
# Find the DeviceAccess
# Although all the linker flags are added again, the include path might be different
# if the libraries are installed in different directories for development purposes.
Martin Killenberg
committed
add_dependency(ChimeraTK-DeviceAccess 03.03 REQUIRED)
Martin Killenberg
committed
Martin Christoph Hierholzer
committed
# Find the XML parser library libxml++
FIND_PACKAGE(PkgConfig REQUIRED)
set(LIBXML++_VERSION "libxml++-2.6")
PKG_CHECK_MODULES(LibXML++ REQUIRED ${LIBXML++_VERSION})
PKG_CHECK_MODULES(glib REQUIRED glib-2.0)
include_directories(SYSTEM ${glib_INCLUDE_DIRS} ${LibXML++_INCLUDE_DIRS})
Martin Christoph Hierholzer
committed
Martin Christoph Hierholzer
committed
# Find BOOST filesystem
# Note: we need to search this after looking for the unit_test_framework, since we must not link against the
# unit_test_framework library (use header-only)
FIND_PACKAGE(Boost COMPONENTS filesystem date_time chrono system thread REQUIRED)
Martin Christoph Hierholzer
committed
include(cmake/set_default_build_to_release.cmake)
include(cmake/set_default_flags.cmake)
include(cmake/enable_code_coverage_report.cmake)
Martin Christoph Hierholzer
committed
# linker flags
Martin Christoph Hierholzer
committed
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-dynamic ${ChimeraTK-ControlSystemAdapter_LINK_FLAGS}")
file(GLOB headers "${CMAKE_SOURCE_DIR}/include/*.h")
set(${PROJECT_NAME}_INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/Modules/include/)
aux_source_directory(${CMAKE_SOURCE_DIR}/src library_sources)
# add generic modules
include_directories(${CMAKE_SOURCE_DIR}/Modules/include)
file(GLOB module_headers "${CMAKE_SOURCE_DIR}/Modules/include/*.h")
aux_source_directory(${CMAKE_SOURCE_DIR}/Modules/src library_sources)
MACRO( COPY_MAPPING_FILES )
foreach( FILE_TO_COPY test.xlmap test.dmap )
configure_file( tests/${FILE_TO_COPY} ${PROJECT_BINARY_DIR}/${FILE_TO_COPY} copyonly)
endforeach( FILE_TO_COPY )
ENDMACRO( COPY_MAPPING_FILES )
Martin Christoph Hierholzer
committed
# Create the executables for automated unit testing.
option(BUILD_TESTS "Build test programs" ON)
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/tests")
add_library(${PROJECT_NAME} SHARED ${library_sources} ${headers} ${module_headers})
Martin Christoph Hierholzer
committed
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_FULL_LIBRARY_VERSION}
SOVERSION ${${PROJECT_NAME}_SOVERSION})
Martin Christoph Hierholzer
committed
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${ChimeraTK-ControlSystemAdapter_LINK_FLAGS}")
target_link_libraries(${PROJECT_NAME} ${ChimeraTK-ControlSystemAdapter_LIBRARIES}
${Boost_LIBRARIES}
Martin Christoph Hierholzer
committed
pthread
Martin Christoph Hierholzer
committed
${LibXML++_LIBRARIES}
${glib_LIBRARIES}
${HDF5_LIBRARIES})
Martin Christoph Hierholzer
committed
# do not remove runtime path of the library when installing
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
Martin Christoph Hierholzer
committed
include(cmake/enable_doxygen_documentation.cmake)
Martin Christoph Hierholzer
committed
# Install the library and the executables
install( TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib )
Martin Christoph Hierholzer
committed
# all include files go into include/PROJECT_NAME
# The exclusion of ${PROJECT_NAME} prevents the recursive installation of the files just being installed.
# The original headers are in include/*.h, the installed ones in include/PROJECT_NAME/*.h.
install(DIRECTORY ${${PROJECT_NAME}_INCLUDE_DIRS} DESTINATION include/ChimeraTK/ApplicationCore
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN "${PROJECT_NAME}" EXCLUDE)
set(${PROJECT_NAME}_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
set(${PROJECT_NAME}_LIBRARIES "${ChimeraTK-ControlSystemAdapter_LIBRARIES}")
set(${PROJECT_NAME}_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib")
Martin Christoph Hierholzer
committed
set(${PROJECT_NAME}_CXX_FLAGS "${ChimeraTK-ControlSystemAdapter_CXX_FLAGS}")
set(${PROJECT_NAME}_LINK_FLAGS "${ChimeraTK-ControlSystemAdapter_LINK_FLAGS}")
list(APPEND ${PROJECT_NAME}_PUBLIC_DEPENDENCIES "Boost COMPONENTS system thread chrono filesystem date_time atomic")
include(${CMAKE_SOURCE_DIR}/cmake/create_cmake_config_files.cmake)