GoogleMock CMake overrides 'BUILD_SHARED_LIBS' variable (gmock 1.8.0 release)

88 views
Skip to first unread message

Alex Shaver

unread,
Dec 1, 2016, 1:45:52 PM12/1/16
to Google C++ Mocking Framework
I have a project where I have set BUILD_SHARED_LIBS ON at the top level. I have placed status messages around the 'option(BUILD_SHARED_LIBS "..." OFF' line of googlemock's CMakeLists.txt. Build shared libs is on before the line, and off after the line. This feels like the wrong kind of behaviour. Shouldn't it check to see if the variable is set, and if not set, then set something itself? 

In the build after running cmake once, it builds static libraries, which it then complains about not being linkable. But seemingly after running cmake again, it builds shared libraries (and the status messages report that build shared libs is ON both before and after the option line)

This is a fairly standard cmake build setup, but there's one change that may be relevant to my situation is that I'm building the googlemock as a 'subdirectory' but it's external to the main project repo 
(ie, in one level of the repo, I call 'add_subdirectory(${DEPENDENCIES}/googletest-release-1.8.0 ${CMAKE_CURRENT_BINARY_DIR}/googletest-build)'
Reply all
Reply to author
Forward
0 new messages