Reputation: 15337
How do I create a CMakeLists.txt for gmock to configure only once?
I tried:
ADD_CUSTOM_TARGET( gmock DEPENDS ${CMAKE_CURRENT_LIST_DIR}/gmock-1.6.0/lib/.libs/libgmock.a COMMAND cd ${CMAKE_CURRENT_LIST_DIR}/gmock-1.6.0 && ./configure && make )
but this will do a ./configure every single time, even when I really only need to run it once.
As an aside, I'm open to using FIND_PACKAGE(), etc... for the long run so I don't need to make changes when updating gtest, but at this point, I'm just trying to get it to build without configuring every single time.
Upvotes: 1
Views: 463
Reputation: 7756
Do you want to have a build dependency on gtets or gmock source? If so, this thread on gtest mailing list may help. In short, simply ADD_DIRECTORY
with your gtest or gmock source code and then you can depend on public library targets defined there.
Upvotes: 2
Reputation: 12393
Split the configure and the make call of gmock into two separate custom_targets and don't forget to add a dependency to each of them.
That is for the configure-target maybe the configure.in or any other file from gmock which makes it necessary to re-run configure and the configure-target to the make-target.
Then the make-target should be in dependency to one of your targets and not to the libgmock.a (which is generated by the make call).
HTH
Upvotes: 1