Thursday, 15 January 2015

cmake - How to set BUILD_SHARED_LIBS for included directory -



cmake - How to set BUILD_SHARED_LIBS for included directory -

i have basic cmake project uses google test. want build dll, , cmakelists.txt file in gtest indicates build_shared_libs needs set in order gtest built shared library.

my problem cannot figure out how set build_shared_libs shows up. if utilize cmake-gui set value in cache, indeed see generated build effort create dll.

below cmakelists.txt. appreciate suggestions on how create set build_shared_libs.

cmake_minimum_required(version 3.0 fatal_error) project(myproj) set(build_shared_libs on) add_executable(myproj main.cpp) add_library(mylib static mylib.cpp) target_link_libraries(myproj mylib) add_subdirectory(gtest-1.7.0)

google test build shared library (dll) if build_shared_libs set. hence want set in cmakelists.txt file. know how create own library shared, can't figure out how set variable in way gtest cmakelists.txt file sees it.

in code

add_library(mylib static mylib.cpp) // code static lib

change above line

add_library(mylib shared mylib.cpp) // shared lib added

cmake

No comments:

Post a Comment