-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
59 lines (41 loc) · 1.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 2.6)
project(jvar)
include_directories("${CMAKE_SOURCE_DIR}/include/")
link_directories("${CMAKE_SOURCE_DIR}/lib/")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
set(LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/lib/")
option(CXX11 "Enable C++11 support" OFF)
message(STATUS "CXX11 = " ${CXX11})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall -Wextra -Wno-unused-parameter -Wno-variadic-macros -Wno-ignored-qualifiers")
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
endif(CXX11)
message(STATUS "CMAKE_CXX_FLAGS = " ${CMAKE_CXX_FLAGS})
option(AUTOADDPROP "Enable adding properties on assignment, without using addProperty" OFF)
message(STATUS "AUTOADDPROP = " ${AUTOADDPROP})
if(AUTOADDPROP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAUTOADDPROP")
endif(AUTOADDPROP)
add_library(jvar STATIC src/str.cpp src/util.cpp src/arr.cpp src/var.cpp src/json.cpp)
add_executable(ex_basics example/basics.cpp)
target_link_libraries(ex_basics jvar )
add_executable(ex_arrays example/arrays.cpp)
target_link_libraries(ex_arrays jvar)
add_executable(ex_objs example/objs.cpp)
target_link_libraries(ex_objs jvar)
add_executable(ex_printv example/printv.cpp)
target_link_libraries(ex_printv jvar)
add_executable(ex_jsonparse example/jsonparse.cpp)
target_link_libraries(ex_jsonparse jvar)
add_executable(ex_func example/func.cpp)
target_link_libraries(ex_func jvar)
add_executable(ex_misc example/misc.cpp)
target_link_libraries(ex_misc jvar)
install (TARGETS jvar
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
install (DIRECTORY include/ DESTINATION include/jvar)