-
Notifications
You must be signed in to change notification settings - Fork 97
Don't use hardcoded include/link paths #701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
woodfell
merged 2 commits into
master
from
woodfell/hardcoded_link_include_paths_prevent_crosscompiling
Jun 13, 2019
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
| 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/) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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( | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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