Page MenuHomePhorge

CMakeLists.txt
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

CMakeLists.txt

cmake_minimum_required(VERSION 3.31.6)
project(BBDD_Manipulation_Package)
# 1) A header-only target that exposes include/
# Anything that links to this gets -I<project>/include automatically.
add_library(project_headers INTERFACE)
target_include_directories(project_headers
INTERFACE
${CMAKE_SOURCE_DIR}/include
)
# Optional: set a default C++ standard for all targets made below
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# 2) Discover all example source files (top-level .cpp files in examples/)
# Use CONFIGURE_DEPENDS so 'cmake --build .' picks up new files after re-configure.
file(GLOB EXAMPLE_SOURCES
CONFIGURE_DEPENDS
${CMAKE_SOURCE_DIR}/examples/*.cpp)
# 3) Create an executable per example file and link include paths via project_headers
foreach(example_src IN LISTS EXAMPLE_SOURCES)
get_filename_component(example_name "${example_src}" NAME_WE)
add_executable(${example_name} "${example_src}")
# Link the header-only interface to inherit include/ (and any future compile defs/opts)
target_link_libraries(${example_name} PRIVATE project_headers)
# Optional: place example binaries into build/examples/
set_target_properties(${example_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples"
)
endforeach()
############################################# Generate Doxygen Documentation
# Option to build docs
option(BUILD_DOC "Build API documentation with Doxygen" ON)
if(BUILD_DOC)
find_package(Doxygen QUIET)
if(NOT DOXYGEN_FOUND)
message(WARNING "Doxygen not found. Set BUILD_DOC=OFF or install Doxygen.")
else()
# Graphviz (dot) for diagrams — optional
find_program(DOT_EXE dot)
set(DOXYGEN_HAVE_DOT "NO")
if(DOT_EXE)
set(DOXYGEN_HAVE_DOT "YES")
endif()
configure_file(
"${CMAKE_SOURCE_DIR}/Doxyfile.in"
"${CMAKE_BINARY_DIR}/Doxyfile"
@ONLY
)
# docs target
add_custom_target(docs
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/Doxyfile"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
# Optional: convenience target to clean generated docs
add_custom_target(docs-clean
COMMAND "${CMAKE_COMMAND}" -E rm -rf "${DOXYGEN_OUTPUT_DIR}"
COMMENT "Removing generated documentation in ${DOXYGEN_OUTPUT_DIR}"
VERBATIM
)
endif()
endif()

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 7, 6:53 AM (8 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
400077
Default Alt Text
CMakeLists.txt (2 KB)

Event Timeline