Skip to content

Commit

Permalink
Improve Visual Studio and vcpkg support
Browse files Browse the repository at this point in the history
  • Loading branch information
droidmonkey committed Nov 16, 2021
1 parent e5065a0 commit 035757e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ AppImage-Recipe.sh export-ignore

# binary files
*.ai binary

# Line endings harmony
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ desktop.ini

# MSVC Files
CMakeSettings.json
CMakePresets.json
.vs/
out/
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ set(CMAKE_AUTORCC ON)

if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE)
find_program(MACDEPLOYQT_EXE macdeployqt HINTS ${Qt5_PREFIX}/bin ENV PATH)
find_program(MACDEPLOYQT_EXE macdeployqt HINTS ${Qt5_PREFIX}/bin ${Qt5_PREFIX}/tools/qt5/bin ENV PATH)
if(NOT MACDEPLOYQT_EXE)
message(FATAL_ERROR "macdeployqt is required to build on macOS")
endif()
message(STATUS "Using macdeployqt: ${MACDEPLOYQT_EXE}")
elseif(WIN32)
find_program(WINDEPLOYQT_EXE windeployqt HINTS ${Qt5_PREFIX}/bin ${Qt5_PREFIX}/tools/qt5/debug/bin ENV PATH)
find_program(WINDEPLOYQT_EXE windeployqt HINTS ${Qt5_PREFIX}/bin ${Qt5_PREFIX}/tools/qt5/bin ENV PATH)
if(NOT WINDEPLOYQT_EXE)
message(FATAL_ERROR "windeployqt is required to build on Windows")
endif()
Expand Down
27 changes: 6 additions & 21 deletions cmake/FindBotan2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,17 @@
# BOTAN2_LIBRARIES - list of libraries to link
# BOTAN2_VERSION - library version that was found, if any

# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
pkg_check_modules(PC_BOTAN2 QUIET botan-2)

# find the headers
find_path(BOTAN2_INCLUDE_DIR
NAMES botan/version.h
HINTS
${PC_BOTAN2_INCLUDEDIR}
${PC_BOTAN2_INCLUDE_DIRS}
PATH_SUFFIXES botan-2
)

# find the library
find_library(BOTAN2_LIBRARY
NAMES botan-2 libbotan-2 botan
HINTS
${PC_BOTAN2_LIBDIR}
${PC_BOTAN2_LIBRARY_DIRS}
)
find_library(BOTAN2_LIBRARY NAMES botan-2 libbotan-2 botan)

# determine the version
if(PC_BOTAN2_VERSION)
set(BOTAN2_VERSION ${PC_BOTAN2_VERSION})
elseif(BOTAN2_INCLUDE_DIR AND EXISTS "${BOTAN2_INCLUDE_DIR}/botan/build.h")
if(BOTAN2_INCLUDE_DIR AND EXISTS "${BOTAN2_INCLUDE_DIR}/botan/build.h")
file(STRINGS "${BOTAN2_INCLUDE_DIR}/botan/build.h" botan2_version_str
REGEX "^#define[\t ]+(BOTAN_VERSION_[A-Z]+)[\t ]+[0-9]+")

Expand All @@ -93,23 +78,23 @@ find_package_handle_standard_args(Botan2
VERSION_VAR BOTAN2_VERSION
)

if (BOTAN2_FOUND)
if(BOTAN2_FOUND)
set(BOTAN2_INCLUDE_DIRS ${BOTAN2_INCLUDE_DIR} ${PC_BOTAN2_INCLUDE_DIRS})
set(BOTAN2_LIBRARIES ${BOTAN2_LIBRARY})
endif()

if (BOTAN2_FOUND AND NOT TARGET Botan2::Botan2)
if(BOTAN2_FOUND AND NOT TARGET Botan2::Botan2)
# create the new library target
add_library(Botan2::Botan2 UNKNOWN IMPORTED)
# set the required include dirs for the target
if (BOTAN2_INCLUDE_DIRS)
if(BOTAN2_INCLUDE_DIRS)
set_target_properties(Botan2::Botan2
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BOTAN2_INCLUDE_DIRS}"
)
endif()
# set the required libraries for the target
if (EXISTS "${BOTAN2_LIBRARY}")
if(EXISTS "${BOTAN2_LIBRARY}")
set_target_properties(Botan2::Botan2
PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
Expand Down

0 comments on commit 035757e

Please sign in to comment.