-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Add ability to do standalone build examples
- Loading branch information
1 parent
5c242dd
commit 5c75096
Showing
4 changed files
with
156 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Distributed under the OSI-approved BSD 3-Clause License. See LICENSE | ||
# file accompanying BAG source for details. | ||
|
||
#[=======================================================================[.rst: | ||
FindBAG | ||
------- | ||
Finds the BAG library. | ||
Imported Targets | ||
^^^^^^^^^^^^^^^^ | ||
This module provides the following imported targets, if found: | ||
``BAG::BAG`` | ||
The baglib library | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
This will define the following variables: | ||
``BAG_FOUND`` | ||
True if the system has the BAG library. | ||
``BAG_VERSION`` | ||
The version of the BAG library which was found. | ||
``BAG_INCLUDE_DIRS`` | ||
Include directories needed to use BAG. | ||
``BAG_LIBRARIES`` | ||
Libraries needed to link to BAG. | ||
Cache Variables | ||
^^^^^^^^^^^^^^^ | ||
The following cache variables may also be set: | ||
``BAG_INCLUDE_DIR`` | ||
The directory containing ``bag_dataset.h``. | ||
``BAG_LIBRARY`` | ||
The path to the BAG library. | ||
#]=======================================================================] | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(PC_BAG QUIET BAG) | ||
|
||
find_path(BAG_INCLUDE_DIR | ||
NAMES bag_dataset.h | ||
PATHS ${PC_BAG_INCLUDE_DIRS} | ||
PATH_SUFFIXES | ||
include | ||
include/bag | ||
include/BAG | ||
include/baglib | ||
) | ||
find_library(BAG_LIBRARY | ||
NAMES baglib | ||
PATHS ${PC_BAG_LIBRARY_DIRS} | ||
) | ||
|
||
set(BAG_VERSION ${PC_BAG_VERSION}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(BAG | ||
FOUND_VAR BAG_FOUND | ||
REQUIRED_VARS | ||
BAG_LIBRARY | ||
BAG_INCLUDE_DIR | ||
VERSION_VAR BAG_VERSION | ||
) | ||
|
||
#if(BAG_FOUND) | ||
# if(NOT TARGET BAG::BAG) | ||
# add_library(BAG::BAG UNKNOWN IMPORTED) | ||
# endif() | ||
# if(BAG_LIBRARY_RELEASE) | ||
# set_property(TARGET BAG::BAG APPEND PROPERTY | ||
# IMPORTED_CONFIGURATIONS RELEASE | ||
# ) | ||
# set_target_properties(BAG::BAG PROPERTIES | ||
# IMPORTED_LOCATION_RELEASE "${BAG_LIBRARY_RELEASE}" | ||
# ) | ||
# endif() | ||
# if(BAG_LIBRARY_DEBUG) | ||
# set_property(TARGET BAG::BAG APPEND PROPERTY | ||
# IMPORTED_CONFIGURATIONS DEBUG | ||
# ) | ||
# set_target_properties(BAG::BAG PROPERTIES | ||
# IMPORTED_LOCATION_DEBUG "${BAG_LIBRARY_DEBUG}" | ||
# ) | ||
# endif() | ||
# set_target_properties(BAG::BAG PROPERTIES | ||
# INTERFACE_COMPILE_OPTIONS "${PC_BAG_CFLAGS_OTHER}" | ||
# INTERFACE_INCLUDE_DIRECTORIES "${BAG_INCLUDE_DIR}" | ||
# ) | ||
#endif() | ||
|
||
if(BAG_FOUND) | ||
set(BAG_LIBRARIES ${BAG_LIBRARY}) | ||
set(BAG_INCLUDE_DIRS ${BAG_INCLUDE_DIR}) | ||
set(BAG_DEFINITIONS ${PC_BAG_CFLAGS_OTHER}) | ||
endif() | ||
|
||
mark_as_advanced( | ||
BAG_INCLUDE_DIR | ||
BAG_LIBRARY | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters