Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if(MSVC)
set(LIBSBP_CFLAGS "/Wall" CACHE STRING "Compile flags for libsbp.")
else()
set(LIBSBP_CFLAGS "-Wall -Werror" CACHE STRING "Compile flags for libsbp.")
link_directories("/usr/local/lib")
endif()

add_subdirectory(src)
Expand Down
16 changes: 14 additions & 2 deletions c/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@ endif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
FILE(GLOB generated_c_sources auto*.c)
add_executable(test_libsbp check_main.c check_edc.c check_sbp.c ${generated_c_sources})

target_link_libraries(test_libsbp ${TEST_LIBS})
target_link_libraries(test_libsbp PRIVATE ${TEST_LIBS})
set_target_properties(test_libsbp PROPERTIES
C_STANDARD 99
C_STANDARD_REQUIRED ON)

if(MSVC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would likely solve the issue on PBR(P) side

Suggested change
if(MSVC)
if(MSVC OR CROSS_COMPILING)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether any other compiler would also break, so I've made a change to only add /usr/local/* on apple platforms

target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/)
else()
target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/ /usr/local/include/)
target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/)
Copy link
Contributor

@benjaminaltieri benjaminaltieri Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm need to comment on a separate line..

if(APPLE)
# Some libraries are available in non-standard places on apple.
target_include_directories(test_libsbp PRIVATE /usr/local/include)

# This is not a great way of doing this, but the proper cmake function
# target_link_directories() was introduced in version 3.13 and we need to support
# older versions for the moment. We can use target_link_libraries to pass arbitrary
# linker flags, making sure that this instance is well protected and only applies
# to a single platform. Don't use the extant link_directories() function since
# that leaks the path to other targets.
target_link_libraries(test_libsbp PRIVATE "-L/usr/local/lib")
endif()
endif()

add_custom_command(
Expand Down