-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
CMake: RAPIDJSON_BUILD_THIRDPARTY_GTEST option added. #309
Conversation
This option specifies whether to build GTest from thirdparty/gtest submodule or not. test/CMakeLists.txt reworked to build GTest from sources (submodule or installed on the system).
I would like to invite @jollyroger to review on this. |
Sure, it would be great if someone will review this. I see several options here:
I'm not sure if all these options make sense, probably it's enough to use thirdparty/gtest. |
GTest was distributed along with pre-built library up till squeeze in Debian and up till lucid in Ubuntu. It is still distributed as a pre-built library in Fedora although there was a request somewhere to distribute full project source code as recommended by upstream developers (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726021) Debian squeeze and Ubuntu lucid are both very old. Support for lucid ends in 10 days. Support for squeeze will end in February, 2016 (there's only minor security support left, though all other support was dropped on the 31th of May, 2014). Thus I don't think there's a problem with lucid support (I dare you try and build RapidJSON with libgtest-dev version 1.3.0 distributed with lucid or with 1.5.0 distributed with squeeze). I wrote You make a valid point saying that there is a possibility to find sources and headers in different places and that was done precisely because Debian/Ubuntu distributions install headers and sources in different places(as stated in the comments to the
As a last resort for the users, they could always override path problems by setting variables directly during |
As for options @shindo mentioned:
|
@jollyroger, thank you! I didn't think of specifying GTEST_SOURCE_DIR and GTEST_INCLUDE_DIR with -D option, this can actually solve most problems. I encountered a problem with the current scripts on Lucid when headers were found in /usr/include and sources in thirdparty/gtest. I'm just not sure if installed libgtest-dev should have higher priority than thirdparty/gtest. |
If that is the case, then it would be enough to set |
Well, yes, I agree with you. But changing internal variables this way looks dirty (still possible, and I'll go with it). As a user I want to control the behaviour of the build process like:
Of course, with the least possible amount of options to change. This is just my thoughts and expectations from the build scripts. I'll accept your solution, thanks. |
@shindo , see my implementation for your request (#312). It implements the 1st and 3dr option. It is not possible however to use custom gtest installation without setting |
This option specifies whether to build GTest from thirdparty/gtest submodule or not.
test/CMakeLists.txt reworked to build GTest from sources (submodule or installed on the system).
Actually GTest almost always should be built from thirdparty submodule, but one may want to use installed GTest sources (UNIX-only, right?).
The problem with FindGTestSrc.cmake was that it searches for sources and headers separately, and it's possible to find thirdparty submodule's sources and installed headers which are of different GTest version (eg. on Ubuntu Lucid GTest packages do not provide source, just headers and built libraries).
With RAPIDJSON_BUILD_THIRDPARTY_GTEST option set ON we use submodule's sources and headers only.
If this option is not set we search for sources and headers with hint pathes set to default UNIX values.