mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-04 13:29:02 +08:00
fb7ba25ab2
* libcaer linux/macos fix * Version update Co-authored-by: Rokas Jurevicius <rokas.jurevicius@inivation.com>
75 lines
2.6 KiB
Diff
75 lines
2.6 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 3b1937a..b9bc122 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -20,6 +20,8 @@ OPTION(ENABLE_SERIALDEV "Enable support for serial port devices using libserialp
|
|
OPTION(ENABLE_OPENCV "Enable support for frame enhancements using OpenCV" OFF)
|
|
OPTION(UDEV_INSTALL "Install udev rules on Linux" ON)
|
|
OPTION(EXAMPLES_INSTALL "Build and install examples" OFF)
|
|
+OPTION(ENABLE_BINDIR_INSTALLATION "Split archive and binary installation targets [required for vcpkg installation]" OFF)
|
|
+OPTION(BUILD_SHARED_LIBS "Build libcaer as a shared library" ON)
|
|
|
|
# Cross-compile support
|
|
IF(NOT USER_LOCAL_PREFIX)
|
|
@@ -50,7 +52,7 @@ MESSAGE(STATUS "Base libraries: ${BASE_LIBS}")
|
|
INCLUDE(FindPkgConfig)
|
|
|
|
# Required: basic USB devices support
|
|
-IF(CC_MSVC)
|
|
+IF(ENABLE_BINDIR_INSTALLATION)
|
|
FIND_PACKAGE(libusb CONFIG REQUIRED)
|
|
ELSE()
|
|
PKG_CHECK_MODULES(
|
|
@@ -98,7 +100,7 @@ INCLUDE(CMakePackageConfigHelpers)
|
|
WRITE_BASIC_CONFIG_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION}
|
|
COMPATIBILITY SameMajorVersion)
|
|
SET(include_dirs ${CMAKE_INSTALL_INCLUDEDIR})
|
|
-IF(CC_MSVC)
|
|
+IF(ENABLE_BINDIR_INSTALLATION)
|
|
SET(export_destination ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
|
|
ELSE()
|
|
SET(export_destination ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index 377a556..8461627 100644
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -19,6 +19,10 @@ IF(NOT CC_MSVC)
|
|
SET(LIBCAER_COMPILE_OPTIONS "-Wno-unused-function")
|
|
ENDIF()
|
|
|
|
+IF(OS_MACOS)
|
|
+ LIST(APPEND LIBCAER_COMPILE_OPTIONS "-Wno-implicit-function-declaration")
|
|
+ENDIF()
|
|
+
|
|
SET(LIBCAER_LINK_LIBRARIES_PRIVATE ${BASE_LIBS})
|
|
|
|
IF(OS_LINUX)
|
|
@@ -54,6 +58,9 @@ ENDIF()
|
|
|
|
IF(CC_MSVC)
|
|
LIST(APPEND LIBCAER_SOURCES ../thirdparty/simple-stdatomic/stdatomic.c)
|
|
+ENDIF()
|
|
+
|
|
+IF(ENABLE_BINDIR_INSTALLATION)
|
|
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS})
|
|
LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE ${LIBUSB_LIBRARIES})
|
|
ELSE()
|
|
@@ -63,7 +70,7 @@ ENDIF()
|
|
# Set full RPATH
|
|
SET(CMAKE_INSTALL_RPATH ${USER_LOCAL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
|
|
|
-ADD_LIBRARY(caer SHARED ${LIBCAER_SOURCES})
|
|
+ADD_LIBRARY(caer ${LIBCAER_SOURCES})
|
|
IF(CC_MSVC)
|
|
# This flag needs to be propagated down to depending targets to avoid compilation errors
|
|
TARGET_COMPILE_OPTIONS(caer INTERFACE -DWIN32_LEAN_AND_MEAN=ON)
|
|
@@ -94,7 +101,7 @@ IF(ENABLE_STATIC)
|
|
|
|
SET_TARGET_PROPERTIES(caerStatic PROPERTIES OUTPUT_NAME caer)
|
|
|
|
- IF(OS_WINDOWS)
|
|
+ IF(ENABLE_BINDIR_INSTALLATION)
|
|
INSTALL(
|
|
TARGETS caerStatic
|
|
EXPORT libcaer-exports
|