Skip to content

Commit

Permalink
TEst
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjenssen committed Feb 7, 2024
1 parent a7e1bc3 commit 9a443d3
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions ApplicationLibCode/UnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,14 @@ FetchContent_Declare(

FetchContent_MakeAvailable(googletest)

# ##############################################################################
# Copy required Dll/.so to output folder
# ##############################################################################

# create an empty library target that will be used to copy files to the build
# folder
add_library(ResInsightDummyTestTarget EXCLUDE_FROM_ALL empty.cpp)
set_property(TARGET ResInsightDummyTestTarget PROPERTY FOLDER "FileCopyTargets")
set_property(TARGET ResInsightDummyTestTarget PROPERTY FOLDER "FileCopyTargetsTest")

# create a custom target that copies the files to the build folder
foreach(riFileName ${RI_FILENAMES})
Expand All @@ -138,13 +142,13 @@ foreach(riFileName ${RI_FILENAMES})
$<TARGET_FILE_DIR:ResInsightDummyTestTarget>
)
endforeach()
add_custom_target(PreBuildFileCopyTesting ${copyCommands})
set_property(TARGET PreBuildFileCopyTesting PROPERTY FOLDER "FileCopyTargets")
add_custom_target(PreBuildFileCopyTest ${copyCommands})
set_property(TARGET PreBuildFileCopyTest PROPERTY FOLDER "FileCopyTargetsTest")

add_executable(ResInsight-tests ${SOURCE_UNITTEST_FILES} main.cpp)

# Make ResInsight-tests depend on the prebuild target.
add_dependencies(ResInsight-tests PreBuildFileCopyTesting)
add_dependencies(ResInsight-tests PreBuildFileCopyTest)

configure_file(
${CMAKE_CURRENT_LIST_DIR}/RiaTestDataDirectory.h.cmake
Expand Down Expand Up @@ -190,4 +194,12 @@ endif()

target_link_libraries(ResInsight-tests PUBLIC ${LINK_LIBRARIES} GTest::gtest)

if(MSVC)
add_custom_command( TARGET ResInsight-tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_RUNTIME_DLLS:ResInsight-tests>
$<TARGET_FILE_DIR:ResInsight-tests>
COMMAND_EXPAND_LISTS)
endif(MSVC)

add_test(NAME ResInsight-tests COMMAND ResInsight-tests)

0 comments on commit 9a443d3

Please sign in to comment.