mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use target gtest instead of GTEST_LIB and GTEST_INCLUDE_DIR
This simplifies usage of GoogleTest, since independent handling of GTEST_LIB and GTEST_INCLUDE_DIR is not necessary anymore. Additionally CMake creates a dependency now between target gtest and all test applications using it. This improves build process when building GoogleTest from source code. When any test application is built, GoogleTest library is automatically rebuilt if necessary now for instance.
This commit is contained in:
@@ -82,6 +82,13 @@ if (GTEST_SRC_DIR)
|
||||
target_compile_options(gtest PRIVATE -Wno-missing-declarations)
|
||||
endif()
|
||||
target_include_directories(gtest PUBLIC ${GTEST_INCLUDE_DIR} ${GTEST_SRC_DIR})
|
||||
else()
|
||||
add_library(gtest UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(gtest PROPERTIES
|
||||
IMPORTED_LOCATION ${GTEST_SHARED_LIB}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES ${GTEST_MAIN_LIB}
|
||||
)
|
||||
endif()
|
||||
if (GMOCK_SRC_DIR)
|
||||
set (lib_gmock_SOURCES ${GMOCK_SRC})
|
||||
|
||||
Reference in New Issue
Block a user