Files
CMake/Tests/RunCMake/CXXModules/NinjaDependInfoCompileDatabase.cmake
Ben Boeckel 050f891d81 Tests: choose an explicit FULL strategy in tests expecting it
Since it can be set in the environment when running the test suite,
guard tests which are sensitive to intermediate directory strategy
changes with explicit settings.
2025-07-29 08:06:30 -04:00

57 lines
1.6 KiB
CMake

set(CMAKE_INTERMEDIATE_DIR_STRATEGY FULL CACHE STRING "" FORCE)
# Fake out that we have dyndep; we only need to generate, not actually build
# here.
set(CMAKE_CXX_SCANDEP_SOURCE "")
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "73194a1d-c0b5-41b9-9190-a4512925e192")
enable_language(CXX)
if (NOT CMAKE_GENERATOR MATCHES "Ninja")
message(FATAL_ERROR
"This test requires a 'Ninja' generator to be used.")
endif ()
add_library(ninja-compiledb-public)
target_sources(ninja-compiledb-public
PRIVATE
sources/module-impl.cxx
sources/module-internal-part-impl.cxx
sources/module-part-impl.cxx
PUBLIC
FILE_SET modules TYPE CXX_MODULES
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/sources"
FILES
sources/module.cxx
sources/module-part.cxx
FILE_SET internal_partitions TYPE CXX_MODULES FILES
sources/module-internal-part.cxx)
target_compile_features(ninja-compiledb-public
PRIVATE
cxx_std_20)
set_property(TARGET ninja-compiledb-public
PROPERTY EXPORT_BUILD_DATABASE 1)
add_library(ninja-compiledb-private)
target_sources(ninja-compiledb-private
PRIVATE
sources/module-impl.cxx
sources/module-internal-part-impl.cxx
sources/module-part-impl.cxx
PRIVATE
FILE_SET modules TYPE CXX_MODULES
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/sources"
FILES
sources/module.cxx
sources/module-part.cxx
FILE_SET internal_partitions TYPE CXX_MODULES FILES
sources/module-internal-part.cxx)
target_compile_features(ninja-compiledb-private
PRIVATE
cxx_std_20)
set_property(TARGET ninja-compiledb-private
PROPERTY EXPORT_BUILD_DATABASE 1)