CMakeLists.txt (1184B)
1 add_library(implementation SHARED implementation.cpp implementation_2.cpp) 2 target_link_libraries(implementation PUBLIC doctest) 3 4 add_library(dll SHARED dll.cpp) 5 target_link_libraries(dll implementation) 6 7 add_library(plugin SHARED plugin.cpp) 8 target_link_libraries(plugin implementation) 9 10 add_executable(executable_dll_and_plugin main.cpp) 11 target_link_libraries(executable_dll_and_plugin dll) 12 target_link_libraries(executable_dll_and_plugin implementation) 13 14 if(NOT WIN32) 15 target_link_libraries(executable_dll_and_plugin dl) 16 endif() 17 18 # have the executable depend on the plugin so it gets built as well when building/starting only the executable 19 add_dependencies(executable_dll_and_plugin plugin) 20 21 # group them together in a single folder inside IDEs 22 set_target_properties(implementation PROPERTIES FOLDER executable_dll_and_plugin) 23 set_target_properties(dll PROPERTIES FOLDER executable_dll_and_plugin) 24 set_target_properties(plugin PROPERTIES FOLDER executable_dll_and_plugin) 25 set_target_properties(executable_dll_and_plugin PROPERTIES FOLDER executable_dll_and_plugin) 26 27 doctest_add_test(NAME executable_dll_and_plugin COMMAND $<TARGET_FILE:executable_dll_and_plugin> --no-version)