2017-03-20 01:03:53 +03:00
#------------------------------------------------------------------------------
# CLING - the C++ LLVM-based InterpreterG :)
#
# This file is dual-licensed: you can choose to license it under the University
# of Illinois Open Source License or the GNU Lesser General Public License. See
# LICENSE.TXT for details.
#------------------------------------------------------------------------------
2017-03-20 00:46:38 +03:00
cmake_minimum_required ( VERSION 3.5 )
2017-06-19 16:43:00 +03:00
# Keep symbols for JIT resolution
set ( LLVM_NO_DEAD_STRIP 1 )
2017-03-20 17:27:07 +03:00
# Cling needs at least C++11; so does this demo.
2017-03-20 00:46:38 +03:00
set ( CMAKE_CXX_STANDARD 11 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
2017-03-20 17:27:07 +03:00
if ( CMAKE_PROJECT_NAME )
# Building as part of cling; all CMake variables are set.
else ( )
# Building as separate project.
project ( cling-demo )
2017-03-20 00:46:38 +03:00
2017-03-20 17:27:07 +03:00
# This project needs cling.
find_package ( cling REQUIRED )
endif ( )
2017-03-20 00:46:38 +03:00
2017-03-20 17:27:07 +03:00
# The project has one binary:
2017-03-20 00:46:38 +03:00
add_executable ( cling-demo cling-demo.cpp )
2017-03-20 17:27:07 +03:00
# ...which links against clingInterpreter (and its dependencies).
2017-03-20 00:46:38 +03:00
target_link_libraries ( cling-demo clingInterpreter )
# Provide LLVMDIR to cling-demp.cpp:
target_compile_options ( cling-demo PUBLIC -DLLVMDIR= "${LLVM_INSTALL_PREFIX}" -I ${ LLVM_INSTALL_PREFIX } /include )
2017-06-19 16:43:00 +03:00
set_target_properties ( cling-demo
P R O P E R T I E S E N A B L E _ E X P O R T S 1 )
2018-03-22 15:34:29 +03:00
if ( MSVC )
set_target_properties ( cling-demo PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS 1 )
set_property ( TARGET cling-demo APPEND_STRING PROPERTY LINK_FLAGS
" / E X P O R T : ? s e t V a l u e N o A l l o c @ i n t e r n a l @ r u n t i m e @ c l i n g @ @ Y A X P E A X 0 0 D _ K @ Z
/ E X P O R T : ? s e t V a l u e N o A l l o c @ i n t e r n a l @ r u n t i m e @ c l i n g @ @ Y A X P E A X 0 0 D M @ Z
/ E X P O R T : c l i n g _ r u n t i m e _ i n t e r n a l _ t h r o w I f I n v a l i d P o i n t e r " )
endif ( )