Skip to content

Commit

Permalink
Fix cmake_package install being broken because of wrong include path.
Browse files Browse the repository at this point in the history
The TARGET_INCLUDE_DIRECTORIES from inside the
IF(JSONCPP_WITH_CMAKE_PACKAGE) block was removed, since it only needs to
be set once.

In addition the CMAKE_VERSION check was simplified.
  • Loading branch information
Gachapen committed Jan 6, 2015
1 parent f44278c commit 748328a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/lib_json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,15 @@ ADD_LIBRARY( jsoncpp_lib ${JSONCPP_LIB_TYPE}
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp )
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR} )

IF(CMAKE_VERSION VERSION_EQUAL 2.8.11 OR CMAKE_VERSION VERSION_GREATER 2.8.11)
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib
PUBLIC ${JSONCPP_INCLUDE_DIR}
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
)
ENDIF(CMAKE_VERSION VERSION_EQUAL 2.8.11 OR CMAKE_VERSION VERSION_GREATER 2.8.11)
ENDIF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)

# Install instructions for this target
IF(JSONCPP_WITH_CMAKE_PACKAGE)
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib
PUBLIC $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSON_INCLUDE_DIR}>
)
SET(INSTALL_EXPORT EXPORT jsoncpp)
ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
SET(INSTALL_EXPORT)
Expand Down

0 comments on commit 748328a

Please sign in to comment.