llvm.org GIT mirror llvm / ab6ed64
When building with LLVM_ENABLE_MODULES, put the module cache into the build directory. This is important for build bots to avoid filling up /tmp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266571 91177308-0d34-0410-b5e6-96231b3b80d8 Richard Smith 4 years ago
1 changed file(s) with 18 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
137137 message(WARNING "${flag} is not supported.")
138138 endif()
139139 endfunction()
140
141 if (LLVM_ENABLE_MODULES)
142 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
143 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules -Xclang -fmodules-local-submodule-visibility")
144 # Check that we can build code with modules enabled, and that repeatedly
145 # including still manages to respect NDEBUG properly.
146 CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
147 #include
148 #define NDEBUG
149 #include
150 int main() { assert(this code is not compiled); }"
151 CXX_SUPPORTS_MODULES)
152 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
153 if (CXX_SUPPORTS_MODULES)
154 append_if(CXX_SUPPORTS_MODULES "-fmodules -Xclang -fmodules-local-submodule-visibility" CMAKE_CXX_FLAGS)
155 else()
156 message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
157 endif()
158 endif(LLVM_ENABLE_MODULES)
159140
160141 if( LLVM_ENABLE_PIC )
161142 if( XCODE )
489470 message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
490471 endif()
491472 endif()
473 if (LLVM_ENABLE_MODULES)
474 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
475 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules -Xclang -fmodules-local-submodule-visibility -fmodules-cache-path=module.cache")
476 # Check that we can build code with modules enabled, and that repeatedly
477 # including still manages to respect NDEBUG properly.
478 CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
479 #include
480 #define NDEBUG
481 #include
482 int main() { assert(this code is not compiled); }"
483 CXX_SUPPORTS_MODULES)
484 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
485 if (CXX_SUPPORTS_MODULES)
486 append_if(CXX_SUPPORTS_MODULES "-fmodules -Xclang -fmodules-local-submodule-visibility -fmodules-cache-path=module.cache" CMAKE_CXX_FLAGS)
487 else()
488 message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
489 endif()
490 endif(LLVM_ENABLE_MODULES)
492491 endif( MSVC )
493492
494493 macro(append_common_sanitizer_flags)