IAP GITLAB

Skip to content
Snippets Groups Projects
CMakeLists.txt 1.38 KiB
Newer Older
Ralf M Ulrich's avatar
Ralf M Ulrich committed
find_package (Boost OPTIONAL_COMPONENTS iostreams)
Ralf M Ulrich's avatar
Ralf M Ulrich committed

ralfulrich's avatar
ralfulrich committed
if (Boost_iostreams_FOUND)
  set (
    files
    source/Interface.boost.cc 
    )
else (Boost_iostreams_FOUND)
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  message (STATUS "Boost::iostreams not found, data tables need to be unpacked with bunzip2 manually!")
ralfulrich's avatar
ralfulrich committed
  set (
    files
    source/Interface.dummy.cc 
    )
endif (Boost_iostreams_FOUND)
Ralf M Ulrich's avatar
Ralf M Ulrich committed

Ralf M Ulrich's avatar
Ralf M Ulrich committed
add_library (CorsikaData STATIC ${files})
Ralf M Ulrich's avatar
Ralf M Ulrich committed

ralfulrich's avatar
ralfulrich committed
if (Boost_iostreams_FOUND)
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  target_link_libraries (CorsikaData PUBLIC Boost::iostreams)
ralfulrich's avatar
ralfulrich committed
endif (Boost_iostreams_FOUND)
Ralf M Ulrich's avatar
Ralf M Ulrich committed

Ralf M Ulrich's avatar
Ralf M Ulrich committed
set_target_properties (
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  CorsikaData
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  PROPERTIES
  PUBLIC_HEADER corsika_data/Interface.h
  )

target_include_directories (
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  CorsikaData
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
  $<INSTALL_INTERFACE:include/>
  )

install (
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  TARGETS CorsikaData
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  PUBLIC_HEADER DESTINATION include/corsika_data
  )

Ralf M Ulrich's avatar
Ralf M Ulrich committed
# add unit test, if run inside CORSIKA
if (COMMAND CORSIKA_ADD_TEST)
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  CORSIKA_ADD_TEST (testData SOURCES source/testData.cc)
Ralf M Ulrich's avatar
Ralf M Ulrich committed
  set (TEST_WITH_BOOST "")
  if (Boost_iostreams_FOUND)
    set (TEST_WITH_BOOST "TEST_WITH_BOOST")
  endif (Boost_iostreams_FOUND)
    
  target_compile_definitions (
    testData
    PRIVATE
    TESTDATA="${CMAKE_CURRENT_SOURCE_DIR}/source/test.data"
    ${TEST_WITH_BOOST}
    )
  target_link_libraries (
    testData
    CorsikaData
    CORSIKAtesting
    )
endif (COMMAND CORSIKA_ADD_TEST)