Commit 8a1f2ad0 authored by Thibaut ROMAIN's avatar Thibaut ROMAIN
Browse files

BUG: Try linking with boost from find_package

parent 76330f0f
Pipeline #8657 failed with stages
in 77 minutes and 40 seconds
......@@ -23,22 +23,22 @@ project(TutorialsExamples)
find_package (Boost REQUIRED COMPONENTS filesystem date_time)
add_executable(FilteringPipeline FilteringPipeline.cxx)
target_link_libraries(FilteringPipeline ${OTB_LIBRARIES})
target_link_libraries(FilteringPipeline ${OTB_LIBRARIES} ${Boost_LIBRARIES})
  • Shouldn't this dependency be declared on the exact OTB libraries that depend on boost in order that depending programs (and libraries) don't have to redeclare that dependency?

    While I can't exactly remember the syntax, I know that CMake permits to declare such things.

  • Yes exactly, Boost_LIBRARIES should be included in OTB_LIBRARIES, but i don't know why it cannot find Boost at this step, so I tried to add a find_package again, to have the right libraries to link to. I don't know why the Tu build_examples does not find boost libraries, because in the logs CMake correctly finds boost :
    -- Found Boost: C:/build/otb/build_packages/tests/OTB-sar_metadata_refactoring-76330f0f-Win64/include/boost-1_72 (found version "1.72.0") found components: filesystem date_time

    And Later : CMake Error at C:/build/otb/build_packages/tests/OTB-sar_metadata_refactoring-76330f0f-Win64/lib/cmake/OTB-7.4/OTBApplicationMacros.cmake:28 (add_library):

    Target "otbapp_ApplicationExample" links to target "Boost::filesystem" but
    the target was not found.  Perhaps a find_package() call is missing for an
    IMPORTED target, or an ALIAS target is missing?

    Call Stack (most recent call first):

    Application/CMakeLists.txt:25 (otb_create_application)
Please register or sign in to reply
add_executable(HelloWorldOTB HelloWorldOTB.cxx)
target_link_libraries(HelloWorldOTB ${OTB_LIBRARIES})
target_link_libraries(HelloWorldOTB ${OTB_LIBRARIES} ${Boost_LIBRARIES})
add_executable(Multispectral Multispectral.cxx)
target_link_libraries(Multispectral ${OTB_LIBRARIES})
target_link_libraries(Multispectral ${OTB_LIBRARIES} ${Boost_LIBRARIES})
add_executable(OrthoFusion OrthoFusion.cxx)
target_link_libraries(OrthoFusion ${OTB_LIBRARIES})
target_link_libraries(OrthoFusion ${OTB_LIBRARIES} ${Boost_LIBRARIES})
add_executable(Pipeline Pipeline.cxx)
target_link_libraries(Pipeline ${OTB_LIBRARIES})
target_link_libraries(Pipeline ${OTB_LIBRARIES} ${Boost_LIBRARIES})
add_executable(ScalingPipeline ScalingPipeline.cxx)
target_link_libraries(ScalingPipeline ${OTB_LIBRARIES})
target_link_libraries(ScalingPipeline ${OTB_LIBRARIES} ${Boost_LIBRARIES})
if(BUILD_TESTING)
find_package (Boost REQUIRED COMPONENTS filesystem date_time unit_test_framework)
......
......@@ -29,9 +29,9 @@ set(OTBBoost_INCLUDE_DIRS ${OTBBoost_SOURCE_DIR}/src)
# named 'unit_testing_framework' is used in two tests.
# why drag a semi-standard c++ library for use in two tests?.
# Update OTB 8.0: link with boost libraries as boost::date_time and boost::filesystem are used extensively in core modules.
if(Boost_LIBRARIES)
set(OTBBoost_LIBRARIES "${Boost_LIBRARIES}")
endif()
#if(Boost_LIBRARIES)
# set(OTBBoost_LIBRARIES "${Boost_LIBRARIES}")
#endif()
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" CACHE INTERNAL "" FORCE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment