Skip to content
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

Use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR #1

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

traversaro
Copy link
Contributor

This simplifies the use of the library in an downstream CMake project using the FetchContent CMake module (https://cmake.org/cmake/help/latest/module/FetchContent.html).

This simplifies the use of the library in an downstream CMake project using the FetchContent CMake module (https://cmake.org/cmake/help/latest/module/FetchContent.html).
@markaren
Copy link
Member

markaren commented Sep 5, 2018

Before I merge this, can you explain the difference between the variables?

@traversaro
Copy link
Contributor Author

See https://cgold.readthedocs.io/en/latest/tutorials/cmake-sources/subdirectories.html#source-variables for more info.

Now they correspond, but if I embed FMI4cpp in my project, using FetchContent, git submodules or even by copy-pasting it, and if I add the FMI4cpp to the build with add_subdirectory, CMAKE_SOURCE_DIR will now refer to the root directory of my project, not anymore to the root directory of FMI4cpp, so list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") will not have its intended behavior.

@markaren markaren merged commit e6bb580 into NTNU-IHB:master Sep 5, 2018
@traversaro traversaro deleted the patch-1 branch September 5, 2018 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants