98 lines
4.5 KiB
Diff
98 lines
4.5 KiB
Diff
|
help cmake find headers when cross-compiling
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 0d807ea62..aa2057c43 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -146,25 +146,25 @@ endif()
|
||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/library_config/libcjson.pc.in"
|
||
|
"${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" @ONLY)
|
||
|
|
||
|
-install(FILES cJSON.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/cjson")
|
||
|
-install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
|
||
|
+install(FILES cJSON.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cjson")
|
||
|
+install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||
|
install(TARGETS "${CJSON_LIB}"
|
||
|
EXPORT "${CJSON_LIB}"
|
||
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
|
||
|
- LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
|
||
|
- RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}"
|
||
|
- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}"
|
||
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||
|
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||
|
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||
|
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||
|
)
|
||
|
if (BUILD_SHARED_AND_STATIC_LIBS)
|
||
|
install(TARGETS "${CJSON_LIB}-static"
|
||
|
EXPORT "${CJSON_LIB}"
|
||
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
|
||
|
- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}"
|
||
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||
|
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||
|
)
|
||
|
endif()
|
||
|
if(ENABLE_TARGET_EXPORT)
|
||
|
# export library information for CMake projects
|
||
|
- install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
||
|
+ install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON")
|
||
|
endif()
|
||
|
|
||
|
if(ENABLE_CJSON_VERSION_SO)
|
||
|
@@ -199,23 +199,23 @@ if(ENABLE_CJSON_UTILS)
|
||
|
|
||
|
install(TARGETS "${CJSON_UTILS_LIB}"
|
||
|
EXPORT "${CJSON_UTILS_LIB}"
|
||
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
|
||
|
- LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
|
||
|
- RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}"
|
||
|
- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}"
|
||
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||
|
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||
|
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||
|
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||
|
)
|
||
|
if (BUILD_SHARED_AND_STATIC_LIBS)
|
||
|
install(TARGETS "${CJSON_UTILS_LIB}-static"
|
||
|
EXPORT "${CJSON_UTILS_LIB}"
|
||
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
|
||
|
- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}"
|
||
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||
|
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||
|
)
|
||
|
endif()
|
||
|
- install(FILES cJSON_Utils.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/cjson")
|
||
|
- install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson_utils.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
|
||
|
+ install(FILES cJSON_Utils.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cjson")
|
||
|
+ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson_utils.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||
|
if(ENABLE_TARGET_EXPORT)
|
||
|
# export library information for CMake projects
|
||
|
- install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
||
|
+ install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON")
|
||
|
endif()
|
||
|
|
||
|
if(ENABLE_CJSON_VERSION_SO)
|
||
|
@@ -238,7 +238,7 @@ if(ENABLE_TARGET_EXPORT)
|
||
|
# Install package config files
|
||
|
install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake
|
||
|
${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake
|
||
|
- DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
||
|
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON")
|
||
|
endif()
|
||
|
|
||
|
option(ENABLE_CJSON_TEST "Enable building cJSON test" ON)
|
||
|
diff --git a/library_config/cJSONConfig.cmake.in b/library_config/cJSONConfig.cmake.in
|
||
|
index 909f7a9ae..206566b39 100644
|
||
|
--- a/library_config/cJSONConfig.cmake.in
|
||
|
+++ b/library_config/cJSONConfig.cmake.in
|
||
|
@@ -2,8 +2,8 @@
|
||
|
set(CJSON_UTILS_FOUND @ENABLE_CJSON_UTILS@)
|
||
|
|
||
|
# The include directories used by cJSON
|
||
|
-set(CJSON_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
|
||
|
-set(CJSON_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
|
||
|
+set(CJSON_INCLUDE_DIRS "@CMAKE_INSTALL_INCLUDEDIR@")
|
||
|
+set(CJSON_INCLUDE_DIR "@CMAKE_INSTALL_INCLUDEDIR@")
|
||
|
|
||
|
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||
|
|