mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
7d1cd11ba9
To avoid duplicated compilation for openmw translation units. Link openmw-lib to openmw-tests instead.
59 lines
1.3 KiB
CMake
59 lines
1.3 KiB
CMake
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
|
|
include_directories(SYSTEM ${GMOCK_INCLUDE_DIRS})
|
|
|
|
file(GLOB UNITTEST_SRC_FILES
|
|
main.cpp
|
|
|
|
options.cpp
|
|
|
|
mwworld/test_store.cpp
|
|
mwworld/testduration.cpp
|
|
mwworld/testtimestamp.cpp
|
|
|
|
mwdialogue/test_keywordsearch.cpp
|
|
|
|
mwscript/test_scripts.cpp
|
|
)
|
|
|
|
source_group(apps\\openmw-tests FILES ${UNITTEST_SRC_FILES})
|
|
|
|
openmw_add_executable(openmw-tests ${UNITTEST_SRC_FILES})
|
|
|
|
target_link_libraries(openmw-tests
|
|
GTest::GTest
|
|
GMock::GMock
|
|
openmw-lib
|
|
)
|
|
|
|
# Fix for not visible pthreads functions for linker with glibc 2.15
|
|
if (UNIX AND NOT APPLE)
|
|
target_link_libraries(openmw-tests ${CMAKE_THREAD_LIBS_INIT})
|
|
endif()
|
|
|
|
if (BUILD_WITH_CODE_COVERAGE)
|
|
target_compile_options(openmw-tests PRIVATE --coverage)
|
|
target_link_libraries(openmw-tests gcov)
|
|
endif()
|
|
|
|
target_compile_definitions(openmw-tests
|
|
PRIVATE OPENMW_DATA_DIR=u8"${CMAKE_CURRENT_BINARY_DIR}/data"
|
|
OPENMW_PROJECT_SOURCE_DIR=u8"${PROJECT_SOURCE_DIR}")
|
|
|
|
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
|
target_precompile_headers(openmw-tests PRIVATE
|
|
<boost/program_options/options_description.hpp>
|
|
|
|
<gtest/gtest.h>
|
|
|
|
<sol/sol.hpp>
|
|
|
|
<algorithm>
|
|
<filesystem>
|
|
<fstream>
|
|
<functional>
|
|
<memory>
|
|
<string>
|
|
<vector>
|
|
)
|
|
endif()
|