Add Boost::atomic target, required by Boost::thread in some configurations (e.g. OpenSUSE)

This commit is contained in:
Carles Fernandez 2019-02-04 08:11:28 +01:00
parent eb281bcd68
commit 999604cd75
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 14 additions and 6 deletions

View File

@ -501,7 +501,7 @@ set(Boost_ADDITIONAL_VERSIONS
) )
set(Boost_USE_MULTITHREAD ON) set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost COMPONENTS date_time system filesystem thread serialization chrono REQUIRED) find_package(Boost COMPONENTS date_time system filesystem thread serialization chrono atomic REQUIRED)
if(NOT Boost_FOUND) if(NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >=${GNSSSDR_BOOST_MIN_VERSION}) required.") message(FATAL_ERROR "Fatal error: Boost (version >=${GNSSSDR_BOOST_MIN_VERSION}) required.")
endif() endif()
@ -568,6 +568,15 @@ if(CMAKE_VERSION VERSION_LESS 3.5)
set_property(TARGET Boost::chrono PROPERTY set_property(TARGET Boost::chrono PROPERTY
IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES}) IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES})
endif() endif()
if(NOT TARGET Boost::atomic)
add_library(Boost::atomic SHARED IMPORTED)
set_property(TARGET Boost::atomic PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
set_property(TARGET Boost::atomic PROPERTY
INTERFACE_LINK_LIBRARIES ${Boost_ATOMIC_LIBRARIES})
set_property(TARGET Boost::atomic PROPERTY
IMPORTED_LOCATION ${Boost_ATOMIC_LIBRARIES})
endif()
endif() endif()

View File

@ -40,17 +40,12 @@ target_link_libraries(front_end_cal_lib
Glog::glog Glog::glog
Gnuradio::blocks Gnuradio::blocks
Gnuradio::runtime Gnuradio::runtime
Boost::boost
Boost::serialization Boost::serialization
Boost::thread Boost::thread
) )
add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
add_custom_command(TARGET front-end-cal POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:front-end-cal>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:front-end-cal>)
target_link_libraries(front-end-cal target_link_libraries(front-end-cal
PUBLIC PUBLIC
${MAC_LIBRARIES} ${MAC_LIBRARIES}
@ -70,6 +65,10 @@ target_compile_definitions(front-end-cal
PUBLIC -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}" PUBLIC -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}"
) )
add_custom_command(TARGET front-end-cal POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:front-end-cal>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:front-end-cal>)
install(TARGETS front-end-cal install(TARGETS front-end-cal
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
COMPONENT "front-end-cal" COMPONENT "front-end-cal"