-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Revert removal of asio find module
Explicitely prefer config mode search over find module for asio.
- Loading branch information
1 parent
8859c56
commit 170557a
Showing
3 changed files
with
55 additions
and
0 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
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,46 @@ | ||
################################################################################ | ||
# Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # | ||
# # | ||
# This software is distributed under the terms of the # | ||
# GNU Lesser General Public Licence (LGPL) version 3, # | ||
# copied verbatim in the file "LICENSE" # | ||
################################################################################ | ||
|
||
find_path(asio_INCLUDE_DIR | ||
NAMES asio.hpp | ||
PATH_SUFFIXES include | ||
) | ||
|
||
if(asio_INCLUDE_DIR) | ||
find_file(asio_VERSION_HEADER "asio/version.hpp" | ||
${asio_INCLUDE_DIR} | ||
NO_DEFAULT_PATH | ||
) | ||
endif() | ||
|
||
if(asio_VERSION_HEADER) | ||
file(READ "${asio_VERSION_HEADER}" _asio_VERSION_HEADER_CONTENT) | ||
string(REGEX MATCH "#define ASIO_VERSION ([0-9]+)" _MATCH "${_asio_VERSION_HEADER_CONTENT}") | ||
set(asio_VERSION_MACRO ${CMAKE_MATCH_1}) | ||
math(EXPR asio_VERSION_MAJOR "${asio_VERSION_MACRO} / 100000") | ||
math(EXPR asio_VERSION_MINOR "${asio_VERSION_MACRO} / 100 % 1000") | ||
math(EXPR asio_VERSION_PATCH "${asio_VERSION_MACRO} % 100") | ||
set(asio_VERSION "${asio_VERSION_MAJOR}.${asio_VERSION_MINOR}.${asio_VERSION_PATCH}") | ||
endif() | ||
|
||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(asio | ||
REQUIRED_VARS asio_INCLUDE_DIR | ||
VERSION_VAR asio_VERSION | ||
HANDLE_COMPONENTS | ||
) | ||
|
||
if(asio_FOUND AND NOT TARGET asio::asio) | ||
add_library(asio::asio INTERFACE IMPORTED) | ||
set_target_properties(asio::asio PROPERTIES | ||
INTERFACE_COMPILE_DEFINITIONS "ASIO_STANDALONE" | ||
INTERFACE_INCLUDE_DIRECTORIES "${asio_INCLUDE_DIR}" | ||
) | ||
endif() | ||
|