@@ -6,6 +6,16 @@ set(CMAKE_MODULE_PATH
66 "${CMAKE_CURRENT_SOURCE_DIR} /cmake/modules"
77 )
88
9+ enable_language (CXX)
10+ set (CMAKE_CXX_EXTENSIONS NO )
11+
12+ option (CPPINTEROP_USE_CLING "Use Cling as backend" OFF )
13+ option (CPPINTEROP_USE_REPL "Use clang-repl as backend" ON )
14+ option (CPPINTEROP_ENABLE_TESTING "Enable the CppInterOp testing infrastructure." ON )
15+
16+ if (CPPINTEROP_USE_CLING AND CPPINTEROP_USE_REPL)
17+ message (FATAL_ERROR "We can only use Cling (${CPPINTEROP_USE_CLING} =On) or Repl (CPPINTEROP_USE_REPL=On), but not both of them." )
18+ endif ()
919# If we are not building as a part of LLVM, build CppInterOp as a standalone
1020# project, using LLVM as an external library:
1121if ( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
@@ -54,17 +64,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
5464 endif ()
5565 endif ()
5666
57- enable_language (CXX)
58- set (CMAKE_CXX_EXTENSIONS NO )
5967include (GNUInstallDirs)
60- option (CPPINTEROP_USE_CLING "Use Cling as backend" OFF )
61- option (CPPINTEROP_USE_REPL "Use clang-repl as backend" ON )
62- option (CPPINTEROP_ENABLE_TESTING "Enable the CppInterOp testing infrastructure." ON )
63-
64- if (CPPINTEROP_USE_CLING AND CPPINTEROP_USE_REPL)
65- message (FATAL_ERROR "We can only use Cling (CPPINTEROP_USE_CLING=On) or Repl (CPPINTEROP_USE_REPL=On), but not both of them." )
66- endif ()
67-
6868 ## Define supported version of clang and llvm
6969
7070 set (CLANG_MIN_SUPPORTED 13.0)
@@ -293,16 +293,15 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
293293# In rare cases we might want to have clang installed in a different place
294294# than llvm and the header files should be found first (even though the
295295# LLVM_INCLUDE_DIRS) contain clang headers, too.
296- if (CPPINTEROP_USE_CLING)
296+ if (CPPINTEROP_USE_CLING)
297297 add_definitions (-DCPPINTEROP_USE_CLING)
298298 include_directories (SYSTEM ${CLING_INCLUDE_DIRS} )
299- else ()
300- if (NOT CPPINTEROP_USE_REPL)
301- message (FATAL_ERROR "We need either CPPINTEROP_USE_CLING or CPPINTEROP_USE_REPL" )
302- endif ()
299+ elseif (CPPINTEROP_USE_REPL)
303300 add_definitions (-DCPPINTEROP_USE_REPL)
301+ else ()
302+ message (FATAL_ERROR "We need either CPPINTEROP_USE_CLING or CPPINTEROP_USE_REPL" )
303+ endif ()
304304
305- endif (CPPINTEROP_USE_CLING)
306305include_directories (SYSTEM ${CLANG_INCLUDE_DIRS} )
307306include_directories (SYSTEM ${LLVM_INCLUDE_DIRS} )
308307separate_arguments (LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS} )
0 commit comments