Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update CMake file to loop through all examples in the examples directory
  • Loading branch information
ikorotkin committed Nov 17, 2025
commit 15d06444d7c19f81e79ca8f2f57aa7491b669af0
18 changes: 8 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)

######## Build examples ########

set(EXAMPLE_LIST "quick_start" "simple_dae" "perovskite_model" "flame_propagation" "jacobian_shape" "jacobian_compare")

include_directories(${PROJECT_SOURCE_DIR})

foreach(EXAMPLE_NAME ${EXAMPLE_LIST})

FILE(GLOB SOURCES ${PROJECT_SOURCE_DIR}/examples/${EXAMPLE_NAME}/*.cpp)

add_executable(${EXAMPLE_NAME} ${SOURCES})

install(TARGETS ${EXAMPLE_NAME} DESTINATION bin)
file(GLOB EXAMPLE_DIRS RELATIVE ${PROJECT_SOURCE_DIR}/examples ${PROJECT_SOURCE_DIR}/examples/*)

foreach(EXAMPLE_NAME ${EXAMPLE_DIRS})
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/examples/${EXAMPLE_NAME})
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/examples/${EXAMPLE_NAME}/*.cpp)
add_executable(${EXAMPLE_NAME} ${SOURCES})
install(TARGETS ${EXAMPLE_NAME} DESTINATION bin)
endif()
endforeach()

######## Build tests ########
Expand All @@ -28,7 +26,7 @@ set(PROJECT_TEST "dae-cpp-test")
include(CTest)
enable_testing()

FILE(GLOB SOURCES_TEST ${PROJECT_SOURCE_DIR}/tests/test_*.cpp)
file(GLOB SOURCES_TEST ${PROJECT_SOURCE_DIR}/tests/test_*.cpp)

add_executable(${PROJECT_TEST} ${SOURCES_TEST})

Expand Down