Fix the target_include_directories. (#162)

The Boost include directory was not correctly added, and the
headers of the project where always looked up at the source or
build directory, not where they are installed.
master
Wolfgang Hess 2016-12-14 17:54:53 +01:00 committed by GitHub
parent 0937f4f515
commit 3caf5a4b52
2 changed files with 8 additions and 5 deletions

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
cmake_minimum_required (VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(cartographer) project(cartographer)
set(CARTOGRAPHER_MAJOR_VERSION 1) set(CARTOGRAPHER_MAJOR_VERSION 1)

View File

@ -73,7 +73,7 @@ macro(_common_compile_stuff VISIBILITY)
if(ARG_USES_BOOST) if(ARG_USES_BOOST)
target_include_directories("${NAME}" SYSTEM ${VISIBILITY} target_include_directories("${NAME}" SYSTEM ${VISIBILITY}
"{Boost_INCLUDE_DIRS}") "${Boost_INCLUDE_DIRS}")
target_link_libraries("${NAME}" PUBLIC ${Boost_LIBRARIES}) target_link_libraries("${NAME}" PUBLIC ${Boost_LIBRARIES})
endif() endif()
@ -122,8 +122,11 @@ macro(_common_compile_stuff VISIBILITY)
# Add the binary directory first, so that port.h is included after it has # Add the binary directory first, so that port.h is included after it has
# been generated. # been generated.
target_include_directories("${NAME}" ${VISIBILITY} "${CMAKE_BINARY_DIR}") target_include_directories("${NAME}" ${VISIBILITY}
target_include_directories("${NAME}" ${VISIBILITY} "${CMAKE_SOURCE_DIR}") $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
# Figure out where to install the header. The logic goes like this: either # Figure out where to install the header. The logic goes like this: either
# the header is in the current binary directory (i.e. generated, like port.h) # the header is in the current binary directory (i.e. generated, like port.h)
@ -159,7 +162,7 @@ function(google_combined_library NAME)
set(MULTI_VALUE_ARGS SRCS) set(MULTI_VALUE_ARGS SRCS)
cmake_parse_arguments(ARG "" "" "${MULTI_VALUE_ARGS}" ${ARGN}) cmake_parse_arguments(ARG "" "" "${MULTI_VALUE_ARGS}" ${ARGN})
# Cmake requires a source file for each library, so we create a dummy file # CMake requires a source file for each library, so we create a dummy file
# that is empty. Its creation depends on all libraries we want to include in # that is empty. Its creation depends on all libraries we want to include in
# our combined static library, i.e. it will be touched whenever any of them # our combined static library, i.e. it will be touched whenever any of them
# change, which means that our combined library is regenerated. # change, which means that our combined library is regenerated.