Skip to content

Commit 2fca28b

Browse files
cdluminatesparkprime
authored andcommitted
CMake: various improvements
1 parent 1443157 commit 2fca28b

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Travis CI runs CMake 2.8.7 so we are pinned to that verison.
22
cmake_minimum_required(VERSION 2.8.7)
33
include(ExternalProject)
4+
include(GNUInstallDirs)
45

56
# User-configurable options.
67
option(BUILD_JSONNET "Build jsonnet command-line tool." ON)
@@ -95,13 +96,12 @@ include_directories(
9596
third_party/json
9697
core)
9798

98-
install(DIRECTORY include DESTINATION include)
99-
10099
if (BUILD_TESTS)
101100
# Set JSONNET_BIN variable required for regression tests.
102101
file(TO_NATIVE_PATH ${GLOBAL_OUTPUT_PATH}/jsonnet JSONNET_BIN)
103102
endif()
104103

104+
add_subdirectory(include)
105105
add_subdirectory(stdlib)
106106
add_subdirectory(third_party/md5)
107107
add_subdirectory(core)

cmd/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ if (BUILD_JSONNET OR BUILD_TESTS)
55
add_dependencies(jsonnet libjsonnet_static)
66
target_link_libraries(jsonnet libjsonnet_static)
77

8-
install(TARGETS jsonnet DESTINATION bin)
9-
endif()
8+
install(TARGETS jsonnet DESTINATION "${CMAKE_INSTALL_BINDIR}")
9+
endif()

core/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@ target_link_libraries(libjsonnet md5)
3535
# CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without
3636
# this step the output would be |liblibjsonnet|.
3737
set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet
38-
VERSION 0.12.1 SOVERSION 0)
39-
install(TARGETS libjsonnet DESTINATION lib)
38+
VERSION "0.12.1"
39+
SOVERSION "0"
40+
PUBLIC_HEADER "${LIB_HEADER}")
41+
install(TARGETS libjsonnet
42+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
43+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
44+
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
4045

4146
# Static library for jsonnet command-line tool.
4247
add_library(libjsonnet_static STATIC ${LIBJSONNET_SOURCE})
4348
add_dependencies(libjsonnet_static md5 stdlib)
4449
target_link_libraries(libjsonnet_static md5)
4550
set_target_properties(libjsonnet_static PROPERTIES OUTPUT_NAME jsonnet)
51+
install(TARGETS libjsonnet_static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
4652

4753
# Tests
4854

include/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ set(LIB_HEADER
22
${LIB_HEADER}
33
${CMAKE_CURRENT_SOURCE_DIR}/libjsonnet.h
44
${CMAKE_CURRENT_SOURCE_DIR}/libjsonnet++.h
5-
PARENT_SCOPE)
5+
${CMAKE_CURRENT_SOURCE_DIR}/libjsonnet_fmt.h
6+
PARENT_SCOPE)

0 commit comments

Comments
 (0)