Skip to content

Commit 889b2a1

Browse files
committed
build: Use macOS sysroot, arch, minversion for generating bitcode
To solve a problem finding system headers when building with command line tools instead of Xcode. Replaces some commented out code, as this should be a more general solution to the same problem. Adding arch and minversion for completeness, not because of a particular known problem, but better to be sure everything matches up. Signed-off-by: Brecht Van Lommel <[email protected]>
1 parent 907ddce commit 889b2a1

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/cmake/llvm_macros.cmake

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,15 @@ function ( EMBED_LLVM_BITCODE_IN_CPP src_list suffix output_name list_to_append_
5454
NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_ENVIRONMENT_PATH)
5555
endif ()
5656

57-
58-
# Fix specific problem I had on new Apple systems (e.g. Mavericks) with
59-
# LLVM/libc++ installed -- for some reason, LLVM 3.4 wasn't finding it,
60-
# so in that specific case, append another -I to point it in the right
61-
# direction.
62-
#if (APPLE AND ${LLVM_BC_GENERATOR} MATCHES ".*clang.*")
63-
# exec_program ( "${LLVM_BC_GENERATOR}" ARGS --version OUTPUT_VARIABLE MY_CLANG_VERSION )
64-
# string (REGEX REPLACE "clang version ([0-9][.][0-9]+).*" "\\1" MY_CLANG_VERSION "${MY_CLANG_VERSION}")
65-
# if ((${MY_CLANG_VERSION} VERSION_GREATER "3.3")
66-
# AND (EXISTS "/usr/lib/libc++.dylib")
67-
# AND (EXISTS "/Library/Developer/CommandLineTools/usr/lib/c++/v1"))
68-
# set (LLVM_COMPILE_FLAGS ${LLVM_COMPILE_FLAGS} "-I/Library/Developer/CommandLineTools/usr/lib/c++/v1")
69-
# endif ()
70-
#endif ()
57+
if(APPLE)
58+
list (APPEND LLVM_COMPILE_FLAGS
59+
-isysroot ${CMAKE_OSX_SYSROOT}
60+
-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
61+
if(CMAKE_OSX_ARCHITECTURES)
62+
list (APPEND LLVM_COMPILE_FLAGS
63+
-arch ${CMAKE_OSX_ARCHITECTURES})
64+
endif()
65+
endif()
7166

7267
list (TRANSFORM include_dirs PREPEND -I
7368
OUTPUT_VARIABLE ALL_INCLUDE_DIRS)

0 commit comments

Comments
 (0)