File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ add_library(libjsonnet SHARED ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE})
3434add_dependencies (libjsonnet md5 stdlib)
3535target_link_libraries (libjsonnet md5 nlohmann_json::nlohmann_json ryml)
3636
37+ # Version extraction logic duplicated in ../cpp/CMakeLists.txt
38+ # TODO: Put this logic somewhere else.
3739file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR} /../include /libjsonnet.h JSONNET_VERSION_DEF
3840 REGEX "[#]define[ \t ]+LIB_JSONNET_VERSION[ \t ]+" )
3941string (REGEX REPLACE ".*\" v([^\" ]+)\" .*" "\\ 1" JSONNET_VERSION ${JSONNET_VERSION_DEF} )
Original file line number Diff line number Diff line change @@ -12,10 +12,17 @@ add_library(libjsonnet++ SHARED ${LIBJSONNETPP_HEADERS} ${LIBJSONNETPP_SOURCE})
1212add_dependencies (libjsonnet++ jsonnet)
1313target_link_libraries (libjsonnet++ libjsonnet)
1414
15+ # Version extraction logic duplicated from ../core/CMakeLists.txt
16+ # TODO: Put this logic somewhere else.
17+ file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR} /../include /libjsonnet.h JSONNET_VERSION_DEF
18+ REGEX "[#]define[ \t ]+LIB_JSONNET_VERSION[ \t ]+" )
19+ string (REGEX REPLACE ".*\" v([^\" ]+)\" .*" "\\ 1" JSONNET_VERSION ${JSONNET_VERSION_DEF} )
20+ message ("Extracted Jsonnet version: " ${JSONNET_VERSION} )
21+
1522# CMake prepends CMAKE_SHARED_LIBRARY_PREFIX to shared libraries, so without
1623# this step the output would be |liblibjsonnet|.
1724set_target_properties (libjsonnet++ PROPERTIES OUTPUT_NAME jsonnet++
18- VERSION "0.21.0 "
25+ VERSION "${JSONNET_VERSION} "
1926 SOVERSION "0"
2027 PUBLIC_HEADER "${LIB_HEADER} " )
2128install (TARGETS libjsonnet++
You can’t perform that action at this time.
0 commit comments