fsfw/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt
Robin Mueller ade15ad16d
tests can now be built as part of FSFW
This PR refactores the tests so they are built as part of the FSFW.
This is done by adding Catch2 with the FetchContent directive.

A future implementation might also use a system installation of Catch2
by first checking whether Catch2 can already be found as a package

The custom configuration folder testcfg was moved from the user folder
to the actual unittest folder.

The tests can be built by setting the CMake FSFW_BUILD_UNITTESTS option
to TRUE/ON. They are built with the static library and dropped inside
the build folders fsfw directory.
2021-10-07 13:24:46 +02:00

28 lines
1019 B
CMake

target_sources(${FSFW_TEST_TGT} PRIVATE
ipc/MissionMessageTypes.cpp
pollingsequence/PollingSequenceFactory.cpp
)
# Add include paths for the executable
target_include_directories(${FSFW_TEST_TGT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
# These translation files are actually not that relevant for the tests. However, the FSFW tests
# compile against a user-configured variant of the FSFW, which might be configured to include
# translation information. Therefore, empty dummy translation files are compiled here
# so the tests compile in any case.
# If a special translation file for object IDs exists, compile it.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
target_sources(${FSFW_TEST_TGT} PRIVATE
objects/translateObjects.cpp
)
endif()
# If a special translation file for events exists, compile it.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
target_sources(${FSFW_TEST_TGT} PRIVATE
events/translateEvents.cpp
)
endif()