@@ -45,13 +45,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
4545  option (USE_CLING "Use Cling as backend"  OFF )
4646  option (USE_REPL "Use clang-repl as backend"  OFF )
4747
48-   if  (USE_CLING)
49-     add_definitions (-DUSE_CLING)
50-   endif ()
51-   if  (USE_REPL)
52-     add_definitions (-DUSE_REPL)
53-   endif ()
54- 
5548  if  (USE_CLING AND  USE_REPL)
5649    message (FATAL_ERROR "We can only use Cling (USE_CLING=On) or Repl (USE_REPL=On), but not both of them." )
5750  endif ()
@@ -226,53 +219,60 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
226219  # Fix bug in some AddLLVM.cmake implementation (-rpath "" problem) 
227220  set (LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR} /${CMAKE_CFG_INTDIR} /lib${LLVM_LIBDIR_SUFFIX} )
228221
229-   include (AddLLVM)
230-   include (HandleLLVMOptions)
231- 
232-   set (CMAKE_INCLUDE_CURRENT_DIR  ON )
222+   set ( CPPINTEROP_BUILT_STANDALONE 1 )
223+ endif ()
233224
234-   # In rare cases we might want to have clang installed in a different place 
235-   # than llvm and the header files should be found first (even though the 
236-   # LLVM_INCLUDE_DIRS) contain clang headers, too. 
237-   if  (USE_CLING)
238-     include_directories (SYSTEM  ${CLING_INCLUDE_DIRS} )
239-   endif (USE_CLING)
240-   include_directories (SYSTEM  ${CLANG_INCLUDE_DIRS} )
241-   include_directories (SYSTEM  ${LLVM_INCLUDE_DIRS} )
242-   separate_arguments (LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS} )
243-   add_definitions (${LLVM_DEFINITIONS_LIST} )
225+ include (AddLLVM)
226+ include (HandleLLVMOptions)
244227
245-   if  (USE_CLING)
246-     message (STATUS  "CLING_INCLUDE_DIRS: ${CLING_INCLUDE_DIRS} " )
247-   endif (USE_CLING)
248-   message (STATUS  "CLANG_INCLUDE_DIRS: ${CLANG_INCLUDE_DIRS} " )
249-   message (STATUS  "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS} " )
250-   message (STATUS  "LLVM_DEFINITIONS_LIST: ${LLVM_DEFINITIONS_LIST} " )
251- 
252-   # If the llvm sources are present add them with higher priority. 
253-   if  (LLVM_BUILD_MAIN_SRC_DIR)
254-     # LLVM_INCLUDE_DIRS contains the include paths to both LLVM's source and 
255-     # build directories. Since we cannot just include ClangConfig.cmake (see 
256-     # fixme above) we have to do a little more work to get the right include 
257-     # paths for clang. 
258-     # 
259-     # FIXME: We only support in-tree builds of clang, that is clang being built 
260-     # in llvm_src/tools/clang. 
261-     include_directories (SYSTEM  ${LLVM_BUILD_MAIN_SRC_DIR} /tools/clang/include /)
262- 
263-     if  (NOT  LLVM_BUILD_BINARY_DIR )
264-       message (FATAL "LLVM_BUILD_* values should be available for the build tree" )
265-     endif ()
228+ set (CMAKE_INCLUDE_CURRENT_DIR  ON )
266229
267-     include_directories (SYSTEM  ${LLVM_BUILD_BINARY_DIR} /tools/clang/include /)
230+ # In rare cases we might want to have clang installed in a different place 
231+ # than llvm and the header files should be found first (even though the 
232+ # LLVM_INCLUDE_DIRS) contain clang headers, too. 
233+ if  (USE_CLING)
234+   add_definitions (-DUSE_CLING)
235+   include_directories (SYSTEM  ${CLING_INCLUDE_DIRS} )
236+   else ()
237+   if  (NOT  USE_REPL)
238+   message (FATAL_ERROR "We need either USE_CLING or USE_REPL" )
239+   endif ()
240+   add_definitions (-DUSE_REPL)
241+ 
242+ endif (USE_CLING)
243+ include_directories (SYSTEM  ${CLANG_INCLUDE_DIRS} )
244+ include_directories (SYSTEM  ${LLVM_INCLUDE_DIRS} )
245+ separate_arguments (LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS} )
246+ add_definitions (${LLVM_DEFINITIONS_LIST} )
247+ 
248+ if  (USE_CLING)
249+   message (STATUS  "CLING_INCLUDE_DIRS: ${CLING_INCLUDE_DIRS} " )
250+ endif (USE_CLING)
251+ message (STATUS  "CLANG_INCLUDE_DIRS: ${CLANG_INCLUDE_DIRS} " )
252+ message (STATUS  "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS} " )
253+ message (STATUS  "LLVM_DEFINITIONS_LIST: ${LLVM_DEFINITIONS_LIST} " )
254+ 
255+ # If the llvm sources are present add them with higher priority. 
256+ if  (LLVM_BUILD_MAIN_SRC_DIR)
257+   # LLVM_INCLUDE_DIRS contains the include paths to both LLVM's source and 
258+   # build directories. Since we cannot just include ClangConfig.cmake (see 
259+   # fixme above) we have to do a little more work to get the right include 
260+   # paths for clang. 
261+   # 
262+   # FIXME: We only support in-tree builds of clang, that is clang being built 
263+   # in llvm_src/tools/clang. 
264+   include_directories (SYSTEM  ${LLVM_BUILD_MAIN_SRC_DIR} /tools/clang/include /)
265+ 
266+   if  (NOT  LLVM_BUILD_BINARY_DIR )
267+     message (FATAL "LLVM_BUILD_* values should be available for the build tree" )
268268  endif ()
269269
270-   set (CMAKE_LIBRARY_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR} /lib/)
271-   set (CMAKE_RUNTIME_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR} /bin/)
272- 
273-   set ( CPPINTEROP_BUILT_STANDALONE 1 )
270+   include_directories (SYSTEM  ${LLVM_BUILD_BINARY_DIR} /tools/clang/include /)
274271endif ()
275272
273+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR} /lib/)
274+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR} /bin/)
275+ 
276276## Code Coverage Configuration 
277277add_library (coverage_config INTERFACE )
278278option (CODE_COVERAGE "Enable coverage reporting"  OFF )
0 commit comments