Skip to content

Commit

Permalink
Fix OpenMP and CMAKE_CXX_FLAGS library transitivity. openMVG#1176
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoulon committed Aug 23, 2018
1 parent 5532a30 commit ea72b66
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ MACRO(UNIT_TEST NAMESPACE NAME EXTRA_LIBS)
${CMAKE_SOURCE_DIR}/third_party)
target_link_libraries(${NAMESPACE}_test_${NAME}
${EXTRA_LIBS} # Extra libs MUST be first.
CppUnitLite ${OPENMVG_LIBRARY_DEPENDENCIES})
CppUnitLite)
add_test(NAME ${NAMESPACE}_test_${NAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND $<TARGET_FILE:${NAMESPACE}_test_${NAME}>)
target_compile_definitions(${NAMESPACE}_test_${NAME}
Expand Down
2 changes: 1 addition & 1 deletion src/nonFree/sift/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif()
add_definitions(-DVL_DISABLE_THREADS)

include_directories(./vl)
set(FEATS
set(FEATS
vl/generic.c
vl/imopv_sse2.c
vl/sift.c
Expand Down
2 changes: 1 addition & 1 deletion src/openMVG/cameras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set_property(TARGET openMVG_camera APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:include>")

target_compile_features(openMVG_camera INTERFACE ${CXX11_FEATURES})
target_link_libraries(openMVG_camera INTERFACE openMVG_numeric)
target_link_libraries(openMVG_camera INTERFACE openMVG_numeric ${OPENMVG_LIBRARY_DEPENDENCIES})
install(TARGETS openMVG_camera DESTINATION lib EXPORT openMVG-targets)

UNIT_TEST(openMVG Camera_Pinhole openMVG_camera)
Expand Down
6 changes: 5 additions & 1 deletion src/openMVG/features/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ list(REMOVE_ITEM features_files_sources ${REMOVEFILESUNITTEST})
set_source_files_properties(${features_files_sources} PROPERTIES LANGUAGE CXX)
add_library(openMVG_features ${features_files_sources} ${features_files_headers})
target_compile_features(openMVG_features INTERFACE ${CXX11_FEATURES})
string(REPLACE " " ";" REPLACED_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
target_compile_options(openMVG_features INTERFACE ${REPLACED_CMAKE_CXX_FLAGS})
target_include_directories(openMVG_features
PUBLIC
$<BUILD_INTERFACE:${EIGEN_INCLUDE_DIRS}>
Expand All @@ -28,7 +30,9 @@ target_include_directories(openMVG_features
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/openMVG>
)
target_link_libraries(openMVG_features LINK_PRIVATE openMVG_fast ${STLPLUS_LIBRARY})
target_link_libraries(openMVG_features
PRIVATE openMVG_fast ${STLPLUS_LIBRARY}
PUBLIC ${OPENMVG_LIBRARY_DEPENDENCIES})
if (MSVC)
set_target_properties(openMVG_features PROPERTIES COMPILE_FLAGS "/bigobj")
target_compile_options(openMVG_features PUBLIC "-D_USE_MATH_DEFINES")
Expand Down
1 change: 1 addition & 0 deletions src/openMVG/image/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ target_compile_features(openMVG_image INTERFACE ${CXX11_FEATURES})
target_link_libraries(openMVG_image
PUBLIC
openMVG_numeric
${OPENMVG_LIBRARY_DEPENDENCIES}
PRIVATE
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
Expand Down
1 change: 1 addition & 0 deletions src/openMVG/matching/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ target_include_directories(openMVG_matching
target_link_libraries(openMVG_matching
PRIVATE
${STLPLUS_LIBRARY}
${OPENMVG_LIBRARY_DEPENDENCIES}
PUBLIC
openMVG_features
Threads::Threads
Expand Down
3 changes: 2 additions & 1 deletion src/openMVG/matching_image_collection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ target_compile_features(openMVG_matching_image_collection INTERFACE ${CXX11_FEAT
target_link_libraries(openMVG_matching_image_collection
PUBLIC
openMVG_matching
openMVG_multiview)
openMVG_multiview
${OPENMVG_LIBRARY_DEPENDENCIES})
target_include_directories(openMVG_matching_image_collection
PUBLIC
$<INSTALL_INTERFACE:include>
Expand Down
2 changes: 2 additions & 0 deletions src/openMVG/numeric/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ add_library(openMVG_numeric
${numeric_files_header}
${numeric_files_cpp})
target_compile_features(openMVG_numeric INTERFACE ${CXX11_FEATURES})
string(REPLACE " " ";" REPLACED_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
target_compile_options(openMVG_numeric INTERFACE ${REPLACED_CMAKE_CXX_FLAGS})
target_include_directories(openMVG_numeric
PUBLIC
$<BUILD_INTERFACE:${EIGEN_INCLUDE_DIRS}>
Expand Down
1 change: 1 addition & 0 deletions src/openMVG/sfm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ target_link_libraries(openMVG_sfm
openMVG_graph
openMVG_matching
openMVG_multiview
${OPENMVG_LIBRARY_DEPENDENCIES}
)

target_link_libraries(openMVG_sfm
Expand Down
1 change: 1 addition & 0 deletions src/openMVG/system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set_property(TARGET openMVG_system PROPERTY FOLDER OpenMVG/OpenMVG)
install(TARGETS openMVG_system DESTINATION lib/ EXPORT openMVG-targets)

add_library(openMVG_progress_test INTERFACE)
target_link_libraries(openMVG_progress_test INTERFACE ${OPENMVG_LIBRARY_DEPENDENCIES})
target_include_directories(openMVG_progress_test INTERFACE ${EIGEN_INCLUDE_DIRS})

UNIT_TEST(openMVG progress "openMVG_system;openMVG_progress_test;openMVG_testing")

0 comments on commit ea72b66

Please sign in to comment.