unitTests - use internal library object instead of recompiling sources
This commit is contained in:
parent
18ab34b030
commit
5a8511545f
@ -1,22 +1,5 @@
|
||||
find_package(GTest REQUIRED)
|
||||
|
||||
get_target_property(exiv2lib_SOURCES exiv2lib SOURCES)
|
||||
get_target_property(exiv2lib_int_SOURCES exiv2lib_int SOURCES)
|
||||
get_target_property(exiv2lib_COMPILE_DEFINITIONS exiv2lib COMPILE_DEFINITIONS)
|
||||
get_target_property(exiv2lib_INCLUDE_DIRECTORIES exiv2lib INCLUDE_DIRECTORIES)
|
||||
get_target_property(exiv2lib_LINK_LIBRARIES exiv2lib LINK_LIBRARIES)
|
||||
|
||||
set(unit_tests_exiv2lib_SOURCES)
|
||||
foreach(source IN LISTS exiv2lib_SOURCES exiv2lib_int_SOURCES)
|
||||
if(source MATCHES "\.(c|cpp|h|hpp)$")
|
||||
if(source MATCHES ".*/.*")
|
||||
list(APPEND unit_tests_exiv2lib_SOURCES "${source}")
|
||||
else()
|
||||
list(APPEND unit_tests_exiv2lib_SOURCES "../src/${source}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_executable(unit_tests
|
||||
mainTestRunner.cpp
|
||||
test_DateValue.cpp
|
||||
@ -34,7 +17,7 @@ add_executable(unit_tests
|
||||
test_tiffheader.cpp
|
||||
test_types.cpp
|
||||
test_LangAltValueRead.cpp
|
||||
${unit_tests_exiv2lib_SOURCES}
|
||||
$<TARGET_OBJECTS:exiv2lib_int>
|
||||
)
|
||||
|
||||
target_compile_definitions(unit_tests
|
||||
@ -43,18 +26,9 @@ target_compile_definitions(unit_tests
|
||||
TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data"
|
||||
)
|
||||
|
||||
if (exiv2lib_COMPILE_DEFINITIONS)
|
||||
target_compile_definitions(unit_tests PRIVATE ${exiv2lib_COMPILE_DEFINITIONS})
|
||||
endif ()
|
||||
|
||||
target_include_directories(unit_tests SYSTEM
|
||||
PRIVATE
|
||||
${exiv2lib_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
|
||||
target_link_libraries(unit_tests
|
||||
PRIVATE
|
||||
${exiv2lib_LINK_LIBRARIES}
|
||||
exiv2lib
|
||||
GTest::GTest
|
||||
GTest::Main
|
||||
)
|
||||
@ -66,7 +40,6 @@ endif()
|
||||
|
||||
target_include_directories(unit_tests
|
||||
PRIVATE
|
||||
${GTEST_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
@ -74,10 +47,6 @@ set_target_properties(unit_tests PROPERTIES
|
||||
COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
|
||||
)
|
||||
|
||||
if (USING_CONAN)
|
||||
target_compile_definitions(unit_tests PRIVATE ${CONAN_COMPILE_DEFINITIONS_GTEST})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "/ignore:4099")
|
||||
endif()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user