So what is the reason for delaying the compilation of the .cpp files? Is it due to the possible compiler differences? If so, you could look at generator expressions to attach compiler requirements to your Mock libraries.
It might be best to provide a more complete example of what you are trying to do. On Mon, Mar 30, 2015 at 4:10 PM, Miller Henry <[email protected]> wrote: > I develop a shared library that gets imported into a number of > applications (scattered across a number of different repositories). To aid > in testing we provide some mocks and fakes, made available by a cmake > export files. > > This works okay, but it isn’t right: google mock doesn’t guarantee binary > compatibility if compile flags are not exactly the same, and less so if the > version is different between our library and the application. There are a > couple new features in google mock that I’d like to use, but I cannot > upgrade without also upgrading all the users of the library at the same > time: this is a difficult task (both technically and politically) > > I know I’m going to have to face the technical and political issue, but > I’d like to solve this problem completely so I don’t hit it again. The > solution I’d like to install the .cpp files, and have cmake add those files > to the build, but only build the ones that are actually used in the > project. The actually used is somewhat important as building the library > for the mocks is fairly expensive. > > That is in the main CMakeLists.txt > Find_package(MyLibrary) > Then in a test someplace > Target_link_libraries(SomeTest, MyLibraryMock) > > I’m stuck though, I can’t think of any way to actually implement this. > Can anyone offer some suggestions, or a different way to accomplish this? > > The idea of putting the functions inline in the header will not work: we > have benchmark data showing that doing this adds significantly to the > compile time of the project when doing an incremental build (the TDD cycle > becomes too long). > > > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
