summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CXXModules/VisualStudioNoSyntheticTargets.cmake
blob: e5e178d31148a114242332b62839e089255678ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
enable_language(CXX)

if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
  message(FATAL_ERROR
    "This test requires a 'Visual Studio' generator to be used.")
endif ()

add_library(imported-cxx-modules IMPORTED INTERFACE)
target_sources(imported-cxx-modules
  INTERFACE
    FILE_SET modules TYPE CXX_MODULES
    BASE_DIRS
      "${CMAKE_CURRENT_SOURCE_DIR}/sources"
    FILES
      sources/module-simple.cxx)
set_target_properties(imported-cxx-modules PROPERTIES
  IMPORTED_CONFIGURATIONS DEBUG
  IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  IMPORTED_CXX_MODULES_COMPILE_FEATURES "cxx_std_20"
  INTERFACE_COMPILE_FEATURES "cxx_std_20"
  IMPORTED_CXX_MODULES_DEBUG "simple=${CMAKE_CURRENT_SOURCE_DIR}/sources/module-simple.cxx")

add_executable(vs-use-imported-cxx-modules
  sources/module-simple-use.cxx)
target_link_libraries(vs-use-imported-cxx-modules
  PRIVATE
    imported-cxx-modules)