You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Library 3 depends on 2 and 1. Library 2 depends on 1 lib. All this is assembled using cmake files. I want to create a top level doctest folder. Tests must have access to all libraries and code in the App.
At the same time, I would like to independently run tests and the application itself. We are using IDE (vscode, clion) to work with the project. I don't fully understand how I can approach solving the problem better as I don't have much experience with cmake and doctest.
So far, we have made a variable with option() that determines whether to build the App as executable or as lib. In the second case, we connect the application as a library to the tests and reassign the main() function to doctest (#define DOCTEST_CONFIG_IMPLEMENT). It seems inconvenient to me, because you have to manually change the variable and reset the cmake cache. Or change it manually in the cache file.
./CMakeLists.txt
...
option(COMMON_TESTING "Enable unit testing"ON)
if(NOT COMMON_TESTING)
message(STATUS "Unit testing is OFF")
else()
message(STATUS "Unit testing is ON")
add_subdirectory(tests)
endif()
....
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!
I am a novice programmer, so I ask you to take it with understanding to a banal question) I'm trying to include
doctest
in an existing project.Now it has the following structure:
Library 3 depends on 2 and 1. Library 2 depends on 1 lib. All this is assembled using
cmake
files. I want to create a top leveldoctest
folder. Tests must have access to all libraries and code in the App.At the same time, I would like to independently run tests and the application itself. We are using IDE (vscode, clion) to work with the project. I don't fully understand how I can approach solving the problem better as I don't have much experience with cmake and doctest.
So far, we have made a variable with option() that determines whether to build the App as
executable
or aslib
. In the second case, we connect the application as a library to the tests and reassign the main() function to doctest (#define DOCTEST_CONFIG_IMPLEMENT
). It seems inconvenient to me, because you have to manually change the variable and reset the cmake cache. Or change it manually in the cache file../CMakeLists.txt
./App_folder/CMakeLists.txt
Beta Was this translation helpful? Give feedback.
All reactions