Skip to content

Commit

Permalink
Explicitly link libc++
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Oxoby committed Oct 19, 2020
1 parent e846873 commit f659367
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions recipes/ignition-math/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ find_package(ignition-math${IGN_MATH_MAJOR_VER} REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ignition-math${IGN_MATH_MAJOR_VER}::ignition-math${IGN_MATH_MAJOR_VER})

# When using clang in Linux with libc++, it seems that we need to explicitly link "libc++"
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
string(FIND CMAKE_EXE_LINKER_FLAGS "-stdlib=libc++" LIBCPP)
if (NOT ${LIBCPP} EQUAL -1)
target_link_libraries(${PROJECT_NAME} "c++")
endif()
endif()

0 comments on commit f659367

Please sign in to comment.