Skip to content

Commit

Permalink
Merge pull request #9 from arpg/private_linkage
Browse files Browse the repository at this point in the history
Updates def_library.
  • Loading branch information
chachi committed Jun 23, 2014
2 parents b96bf1b + 6329abc commit 6df470a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions CMakeModules/def_library.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include(CMakeParseArguments)
include(SetSourceFlags)

function(def_library lib)

string(TOUPPER ${lib} LIB)

set(LIB_OPTIONS)
Expand Down Expand Up @@ -62,11 +62,11 @@ function(def_library lib)
endif()

if(lib_DEPENDS)
target_link_libraries(${lib} ${lib_DEPENDS})
target_link_libraries(${lib} PRIVATE ${lib_DEPENDS})
endif()

if(lib_LINK_LIBS)
target_link_libraries(${lib} ${lib_LINK_LIBS})
target_link_libraries(${lib} PRIVATE ${lib_LINK_LIBS})
endif()

if(ANDROID)
Expand All @@ -75,7 +75,7 @@ function(def_library lib)
if(NOT GNUSTL_SHARED_LIBRARY)
message(FATAL_ERROR "Could not find required GNU STL shared library.")
endif()
target_link_libraries(${lib} log android z -pthread ${GNUSTL_SHARED_LIBRARY})
target_link_libraries(${lib} PRIVATE log android z -pthread ${GNUSTL_SHARED_LIBRARY})
endif()

if(lib_PACKAGE)
Expand Down
32 changes: 17 additions & 15 deletions CMakeModules/export_package.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#######################################################################################
# export_package.cmake - Functions for easy package exporting #
# #
# export_package - Takes a package name and the following optional arguments: #
# - TARGETS: A list of all the targets to export with this package #
# - DEPENDS: A list of all the targets that this package depends #
# on from outside its directory #
# - VERSION: A version string for the package #
# - INCLUDE_DIRS: The include directories to export. #
# - LINK_DIRS: The link directories where libraries can be found #
# - LIBRARIES: The libraries to export in ${package}_LIBRARIES #
# - LIBRARY: A library to export in ${package}_LIBRARY #
#######################################################################################
#######################################################################################
# export_package.cmake - Functions for easy package exporting #
# #
# export_package - Takes a package name and the following optional arguments: #
# - TARGETS: A list of all the targets to export with this package #
# - DEPENDS: A list of all the targets that this package depends #
# on from outside its directory #
# - VERSION: A version string for the package #
# - INCLUDE_DIRS: The include directories to export. #
# - LINK_DIRS: The link directories where libraries can be found #
# - LIBRARIES: The libraries to export in ${package}_LIBRARIES #
# - LIBRARY: A library to export in ${package}_LIBRARY #
#######################################################################################
include(CMakeParseArguments)

get_filename_component(modules_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
Expand All @@ -28,13 +28,17 @@ function(export_package package)
"${ARGN}"
)

set(CMAKECONFIG_INSTALL_DIR "lib/cmake/${package}")
option(EXPORT_${package}
"Should the ${package} package be exported for use by other software" ON)

# Version information
if(PACKAGE_VERSION)
configure_file(${modules_dir}/PackageConfigVersion.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${package}ConfigVersion.cmake" @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${package}ConfigVersion.cmake"
DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
endif()

# Build tree config
Expand All @@ -52,7 +56,6 @@ function(export_package package)
export(PACKAGE ${package})
endif()

set(CMAKECONFIG_INSTALL_DIR "lib/cmake/${package}")
file(RELATIVE_PATH REL_INCLUDE_DIR
"${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR}"
"${CMAKE_INSTALL_PREFIX}/include")
Expand All @@ -69,6 +72,5 @@ function(export_package package)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${package}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${package}ConfigVersion.cmake"
DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
endfunction()

0 comments on commit 6df470a

Please sign in to comment.