Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmake: Replaced CMAKE_CURRENT_SOURCE_DIR with CMAKE_SOURCE_DIR #174
cr_add_subproejct didn't work correctly when Criterion was used as a git submoudle in another project as follows.
You can reproduce the problem by running a script.
When you run the script, you can see the following error messages:
I used CMake 3.5.1 on Xubuntu 16.04 for reproduction of the problem. You can probably reproduce the problem in other environments.
The cause of the problem was the use of CMAKE_SOURCE_DIR. CMAKE_SOURCE_DIR was expanded to the path to the top level of the source tree.
Due to the use of CMAKE_SOURCE_DIR, two
The first one is created in the root source directory by CMake and doesn't contains source files of submodules. The other is created in vendor/criterion by git-submodule command and contains source files of submodules.
As a result, CMake reports the above error messages.
The problem was fixed by replacing CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR which was expanded to the path to the source directory currently being processed.
By this patch, only one