diff --git a/changes/sdk/pr.249.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.249.gh.OpenXR-SDK-Source.md new file mode 100644 index 000000000..3ef0d63f8 --- /dev/null +++ b/changes/sdk/pr.249.gh.OpenXR-SDK-Source.md @@ -0,0 +1,4 @@ +--- +- issue.231.gh.OpenXR-SDK-Source +--- +loader: Fix building OpenXR-SDK with CMake's multi-config Ninja generator. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a09d63605..cec8f5ccf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -419,10 +419,16 @@ set(GENERATED_OUTPUT) set(GENERATED_DEPENDS) run_xr_xml_generate(utility_source_generator.py xr_generated_dispatch_table.h) run_xr_xml_generate(utility_source_generator.py xr_generated_dispatch_table.c) -add_custom_target(xr_global_generated_files DEPENDS ${GENERATED_DEPENDS}) +if(GENERATED_DEPENDS) + add_custom_target(xr_global_generated_files DEPENDS ${GENERATED_DEPENDS}) +else() + add_custom_target(xr_global_generated_files) +endif() + set_target_properties(xr_global_generated_files PROPERTIES FOLDER ${CODEGEN_FOLDER}) set(COMMON_GENERATED_OUTPUT ${GENERATED_OUTPUT}) +set(COMMON_GENERATED_DEPENDS ${GENERATED_DEPENDS}) if(NOT MSVC) include(CheckCXXCompilerFlag) include(CheckCCompilerFlag) diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt index b386fb90d..8638bc6a6 100644 --- a/src/loader/CMakeLists.txt +++ b/src/loader/CMakeLists.txt @@ -31,6 +31,7 @@ endif() # List of all files externally generated outside of the loader that the loader # needs to build with. set(LOADER_EXTERNAL_GEN_FILES ${COMMON_GENERATED_OUTPUT}) +set(LOADER_EXTERNAL_GEN_DEPENDS ${COMMON_GENERATED_DEPENDS}) run_xr_xml_generate(loader_source_generator.py xr_generated_loader.hpp) run_xr_xml_generate(loader_source_generator.py xr_generated_loader.cpp) @@ -86,7 +87,9 @@ else() endif() set_target_properties(openxr_loader PROPERTIES FOLDER ${LOADER_FOLDER}) -set_source_files_properties(${LOADER_EXTERNAL_GEN_FILES} PROPERTIES GENERATED TRUE) +if(LOADER_EXTERNAL_GEN_DEPENDS) + set_source_files_properties(${LOADER_EXTERNAL_GEN_DEPENDS} PROPERTIES GENERATED TRUE) +endif() add_dependencies(openxr_loader generate_openxr_header xr_global_generated_files) target_include_directories( openxr_loader