Enhance CMake configuration for yaze_config.h integration
- Updated `CMakeLists.txt` to improve the generation and inclusion of `yaze_config.h` by specifying source and binary directories. - Added include directories in various CMake files to ensure proper access to generated headers, enhancing build reliability and maintainability. - Set properties for the generated header to improve IDE integration and organization within the project structure.
This commit is contained in:
@@ -66,9 +66,22 @@ target_include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src/
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_sources(yaze PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/yaze_config.h)
|
||||
|
||||
# 4) Tell the IDE it’s generated
|
||||
set_source_files_properties(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/yaze_config.h
|
||||
PROPERTIES GENERATED TRUE
|
||||
)
|
||||
|
||||
# (Optional) put it under a neat filter in VS Solution Explorer
|
||||
source_group(TREE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/yaze_config.h)
|
||||
|
||||
# Conditionally add PNG include dirs if available
|
||||
if(PNG_FOUND)
|
||||
target_include_directories(yaze PUBLIC ${PNG_INCLUDE_DIRS})
|
||||
|
||||
@@ -46,6 +46,7 @@ if(NOT YAZE_MINIMAL_BUILD)
|
||||
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user