[llvm] r274244 - [CMake] Add an LLVM_ENABLE_MODULE_DEBUGGING flag for building with -gmodules.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 10:15:44 PDT 2016


Author: adrian
Date: Thu Jun 30 12:15:44 2016
New Revision: 274244

URL: http://llvm.org/viewvc/llvm-project?rev=274244&view=rev
Log:
[CMake] Add an LLVM_ENABLE_MODULE_DEBUGGING flag for building with -gmodules.
This flag is only effective in builds with debug info and modules.
The default is On for Darwin only.

rdar://problem/27019000

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=274244&r1=274243&r2=274244&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu Jun 30 12:15:44 2016
@@ -284,8 +284,10 @@ option(LLVM_ENABLE_PIC "Build Position-I
 option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
 option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." ON)
   option(LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY "Compile with -fmodules-local-submodule-visibility." OFF)
 else()
+  option(LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." OFF)
   option(LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY "Compile with -fmodules-local-submodule-visibility." ON)
 endif()
 option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=274244&r1=274243&r2=274244&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Jun 30 12:15:44 2016
@@ -473,6 +473,11 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE
     if (LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
       set(module_flags "${module_flags} -Xclang -fmodules-local-submodule-visibility")
     endif()
+    if (LLVM_ENABLE_MODULE_DEBUGGING AND
+        ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
+         (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
+      set(module_flags "${module_flags} -gmodules")
+    endif()
     set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${module_flags}")
 
     # Check that we can build code with modules enabled, and that repeatedly




More information about the llvm-commits mailing list