[PATCH] D21827: [CMake] Make -fmodules-local-submodule-visibility optional.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 13:46:53 PDT 2016


beanz added a comment.

I have one minor suggestion that would make the code cleaner.

Right now, you construct the module flags both before and after the check. What if instead you put the following code under the `if(LLVM_ENABLE_MODULES)` line:

  set(module_flags "-fmodules -Xclang -fmodules-cache-path=module.cache")
  if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    # On Darwin -fmodules does not imply -fcxx-modules.
    set(module_flags "${module_flags} -fcxx-modules")
  endif()
  if (LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY)
    set(module_flags "${module_flags} -fmodules-local-submodule-visibility")
  endif()

Then you can replace the first place you construct the modules flags with:

  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${module_flags}")

And the second place you construct the flags with just:

  append("${module_flags}" CMAKE_CXX_FLAGS)

-Chris


http://reviews.llvm.org/D21827





More information about the llvm-commits mailing list