blob: f10d79edbfabe5036ffbfbcab8a340dea4b3abac (
plain)
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
|
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@
# User-configurable options.
option(BUILD_JSONNET "Build jsonnet command-line tool." ON)
option(BUILD_JSONNETFMT "Build jsonnetfmt command-line tool." ON)
+option(BUILD_CLI_SHARED "Build command-line tools against shared lib" OFF)
option(BUILD_TESTS "Build and run jsonnet tests." ON)
option(USE_SYSTEM_GTEST "Use system-provided gtest library" OFF)
set(GLOBAL_OUTPUT_PATH_SUFFIX "" CACHE STRING
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -2,16 +2,28 @@
if (BUILD_JSONNET OR BUILD_TESTS)
add_executable(jsonnet ${LIBJSONNET_SOURCE} jsonnet.cpp utils.cpp)
- add_dependencies(jsonnet libjsonnet_static)
- target_link_libraries(jsonnet libjsonnet_static)
+ if (BUILD_CLI_SHARED)
+ add_dependencies(jsonnet libjsonnet)
+ target_link_libraries(jsonnet libjsonnet)
+ else()
+ add_dependencies(jsonnet libjsonnet_static)
+ target_link_libraries(jsonnet libjsonnet_static)
+ endif()
+
install(TARGETS jsonnet DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
if (BUILD_JSONNETFMT OR BUILD_TESTS)
add_executable(jsonnetfmt ${LIBJSONNET_SOURCE} jsonnetfmt.cpp utils.cpp)
- add_dependencies(jsonnetfmt libjsonnet_static)
- target_link_libraries(jsonnetfmt libjsonnet_static)
+
+ if (BUILD_CLI_SHARED)
+ add_dependencies(jsonnetfmt libjsonnet)
+ target_link_libraries(jsonnetfmt libjsonnet)
+ else()
+ add_dependencies(jsonnetfmt libjsonnet_static)
+ target_link_libraries(jsonnetfmt libjsonnet_static)
+ endif()
install(TARGETS jsonnetfmt DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
|