Improve Visual Studio and vcpkg support

This commit is contained in:
Jonathan White 2021-11-13 11:01:03 -05:00
parent e5065a01c8
commit 035757e228
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
4 changed files with 12 additions and 23 deletions

3
.gitattributes vendored
View File

@ -14,3 +14,6 @@ AppImage-Recipe.sh export-ignore
# binary files # binary files
*.ai binary *.ai binary
# Line endings harmony
* text=auto

1
.gitignore vendored
View File

@ -23,5 +23,6 @@ desktop.ini
# MSVC Files # MSVC Files
CMakeSettings.json CMakeSettings.json
CMakePresets.json
.vs/ .vs/
out/ out/

View File

@ -453,13 +453,13 @@ set(CMAKE_AUTORCC ON)
if(APPLE) if(APPLE)
set(CMAKE_MACOSX_RPATH TRUE) 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) if(NOT MACDEPLOYQT_EXE)
message(FATAL_ERROR "macdeployqt is required to build on macOS") message(FATAL_ERROR "macdeployqt is required to build on macOS")
endif() endif()
message(STATUS "Using macdeployqt: ${MACDEPLOYQT_EXE}") message(STATUS "Using macdeployqt: ${MACDEPLOYQT_EXE}")
elseif(WIN32) 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) if(NOT WINDEPLOYQT_EXE)
message(FATAL_ERROR "windeployqt is required to build on Windows") message(FATAL_ERROR "windeployqt is required to build on Windows")
endif() endif()

View File

@ -48,32 +48,17 @@
# BOTAN2_LIBRARIES - list of libraries to link # BOTAN2_LIBRARIES - list of libraries to link
# BOTAN2_VERSION - library version that was found, if any # 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 the headers
find_path(BOTAN2_INCLUDE_DIR find_path(BOTAN2_INCLUDE_DIR
NAMES botan/version.h NAMES botan/version.h
HINTS
${PC_BOTAN2_INCLUDEDIR}
${PC_BOTAN2_INCLUDE_DIRS}
PATH_SUFFIXES botan-2 PATH_SUFFIXES botan-2
) )
# find the library # find the library
find_library(BOTAN2_LIBRARY find_library(BOTAN2_LIBRARY NAMES botan-2 libbotan-2 botan)
NAMES botan-2 libbotan-2 botan
HINTS
${PC_BOTAN2_LIBDIR}
${PC_BOTAN2_LIBRARY_DIRS}
)
# determine the version # determine the version
if(PC_BOTAN2_VERSION) if(BOTAN2_INCLUDE_DIR AND EXISTS "${BOTAN2_INCLUDE_DIR}/botan/build.h")
set(BOTAN2_VERSION ${PC_BOTAN2_VERSION})
elseif(BOTAN2_INCLUDE_DIR AND EXISTS "${BOTAN2_INCLUDE_DIR}/botan/build.h")
file(STRINGS "${BOTAN2_INCLUDE_DIR}/botan/build.h" botan2_version_str file(STRINGS "${BOTAN2_INCLUDE_DIR}/botan/build.h" botan2_version_str
REGEX "^#define[\t ]+(BOTAN_VERSION_[A-Z]+)[\t ]+[0-9]+") REGEX "^#define[\t ]+(BOTAN_VERSION_[A-Z]+)[\t ]+[0-9]+")
@ -93,23 +78,23 @@ find_package_handle_standard_args(Botan2
VERSION_VAR BOTAN2_VERSION VERSION_VAR BOTAN2_VERSION
) )
if (BOTAN2_FOUND) if(BOTAN2_FOUND)
set(BOTAN2_INCLUDE_DIRS ${BOTAN2_INCLUDE_DIR} ${PC_BOTAN2_INCLUDE_DIRS}) set(BOTAN2_INCLUDE_DIRS ${BOTAN2_INCLUDE_DIR} ${PC_BOTAN2_INCLUDE_DIRS})
set(BOTAN2_LIBRARIES ${BOTAN2_LIBRARY}) set(BOTAN2_LIBRARIES ${BOTAN2_LIBRARY})
endif() endif()
if (BOTAN2_FOUND AND NOT TARGET Botan2::Botan2) if(BOTAN2_FOUND AND NOT TARGET Botan2::Botan2)
# create the new library target # create the new library target
add_library(Botan2::Botan2 UNKNOWN IMPORTED) add_library(Botan2::Botan2 UNKNOWN IMPORTED)
# set the required include dirs for the target # set the required include dirs for the target
if (BOTAN2_INCLUDE_DIRS) if(BOTAN2_INCLUDE_DIRS)
set_target_properties(Botan2::Botan2 set_target_properties(Botan2::Botan2
PROPERTIES PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BOTAN2_INCLUDE_DIRS}" INTERFACE_INCLUDE_DIRECTORIES "${BOTAN2_INCLUDE_DIRS}"
) )
endif() endif()
# set the required libraries for the target # set the required libraries for the target
if (EXISTS "${BOTAN2_LIBRARY}") if(EXISTS "${BOTAN2_LIBRARY}")
set_target_properties(Botan2::Botan2 set_target_properties(Botan2::Botan2
PROPERTIES PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LINK_INTERFACE_LANGUAGES "C"