Skip to content

Commit

Permalink
(CFACT-232) Add dependency include dirs to LEATHERMAN_INCLUDE_DIRS
Browse files Browse the repository at this point in the history
Without this, including one of our headers which includes a dependency
header will fail, since the dependency header will not be on the
include path.
  • Loading branch information
Branan Riley committed Mar 4, 2015
1 parent 2cba167 commit e730660
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ add_leatherman_dir(locale)
add_leatherman_dir(logging)

list(REVERSE LEATHERMAN_LIBRARIES)
list(REMOVE_DUPLICATES LEATHERMAN_INCLUDE_DIRS)

export_var(LEATHERMAN_INCLUDE_DIRS)
export_var(LEATHERMAN_LIBRARIES)


if(LEATHERMAN_ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
Expand Down
13 changes: 12 additions & 1 deletion cmake/internal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ macro(add_leatherman_deps)
export_var(${deps_var})
endmacro()

# Usage: add_leatherman_includes(${DIR1} ${DIR2})
#
# Append to the LEATHERMAN_<LIBRARY>_INCLUDE variable
macro(add_leatherman_includes)
list(APPEND ${include_var} ${ARGV})
list(REMOVE_DUPLICATES ${include_var})
export_var(${include_var})
endmacro()

# Usage: leatherman_dependency("libname")
#
# Automatically handle include directories and library linking for the
Expand Down Expand Up @@ -49,7 +58,9 @@ macro(leatherman_dependency library)
endif()
if (NOT "" STREQUAL "${${dep_include}}")
debug("Adding ${${dep_include}} to include directories for ${dirname}")
include_directories(${${dep_include}})
list(APPEND ${include_var} ${${dep_include}})
list(REMOVE_DUPLICATES ${include_var})
export_var(${include_var})
endif()
else()
message(FATAL_ERROR "${library} not found as a dependency for ${dirname}")
Expand Down
2 changes: 1 addition & 1 deletion locale/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ endif()

find_package(Boost 1.54 REQUIRED COMPONENTS system filesystem thread ${PLATFORM_COMPONENTS})

include_directories(${Boost_INCLUDE_DIRS})
add_leatherman_includes(${Boost_INCLUDE_DIRS})
add_leatherman_deps("${Boost_THREAD_LIBRARY}" "${Boost_SYSTEM_LIBRARY}" "${Boost_FILESYSTEM_LIBRARY}")
if (WIN32)
add_leatherman_deps("${Boost_LOCALE_LIBRARY}")
Expand Down
2 changes: 1 addition & 1 deletion logging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
find_package(Boost 1.54 REQUIRED COMPONENTS log)

include_directories(${Boost_INCLUDE_DIRS})
add_leatherman_deps("${Boost_LOG_LIBRARY}")
add_leatherman_includes("${Boost_INCLUDE_DIRS}")

leatherman_dependency(nowide)
leatherman_dependency(locale)
Expand Down

0 comments on commit e730660

Please sign in to comment.