mirror of
https://github.com/nfc-tools/libnfc.git
synced 2025-12-23 18:50:05 +00:00
Add CMake options for Win32 to require PCRE
This commit is contained in:
parent
ef82a1e4d4
commit
eb90c5a8db
@ -88,6 +88,15 @@ IF(NOT WIN32)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
# Require PCRE for Win32
|
||||
IF (WIN32)
|
||||
FIND_PACKAGE(PCRE REQUIRED)
|
||||
IF(PCRE_INCLUDE_DIRS)
|
||||
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${PCRE_LIBRARY_DIRS})
|
||||
ENDIF(PCRE_INCLUDE_DIRS)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(PCSC_INCLUDE_DIRS)
|
||||
INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS})
|
||||
|
||||
40
cmake/modules/FindPCRE.cmake
Normal file
40
cmake/modules/FindPCRE.cmake
Normal file
@ -0,0 +1,40 @@
|
||||
# This CMake script wants to use pcre functionality needed for windows
|
||||
# compilation. However, since PCRE isn't really a default install location
|
||||
# there isn't much to search.
|
||||
#
|
||||
# Operating Systems Supported:
|
||||
# - Windows (requires MinGW)
|
||||
# Tested with Windows XP/Windows 7
|
||||
#
|
||||
# This should work for both 32 bit and 64 bit systems.
|
||||
#
|
||||
# Author: A. Lian <alex.lian@gmail.com>
|
||||
#
|
||||
|
||||
IF(WIN32)
|
||||
IF(NOT PCRE_FOUND)
|
||||
FIND_PATH(PCRE_INCLUDE_DIRS regex.h)
|
||||
FIND_LIBRARY(PCRE_LIBRARIES NAMES PCRE pcre)
|
||||
|
||||
IF(PCRE_INCLUDE_DIRS AND PCRE_LIBRARIES)
|
||||
SET(PCRE_FOUND TRUE)
|
||||
ENDIF(PCRE_INCLUDE_DIRS AND PCRE_LIBRARIES)
|
||||
ENDIF(NOT PCRE_FOUND)
|
||||
|
||||
IF(PCRE_FOUND)
|
||||
IF(NOT PCRE_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found PCRE: ${PCRE_LIBRARIES} ${PCRE_INCLUDE_DIRS}")
|
||||
ENDIF (NOT PCRE_FIND_QUIETLY)
|
||||
ELSE(PCRE_FOUND)
|
||||
IF(PCRE_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find PCRE")
|
||||
ENDIF(PCRE_FIND_REQUIRED)
|
||||
ENDIF(PCRE_FOUND)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG
|
||||
PCRE_LIBRARIES
|
||||
PCRE_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
ENDIF(WIN32)
|
||||
@ -2,5 +2,6 @@ EXTRA_DIST = \
|
||||
COPYING-CMAKE-SCRIPTS \
|
||||
FindLIBUSB.cmake \
|
||||
FindPCSC.cmake \
|
||||
FindPCRE.cmake \
|
||||
UseDoxygen.cmake \
|
||||
LibnfcDrivers.cmake
|
||||
|
||||
@ -8,6 +8,16 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/buses)
|
||||
|
||||
INCLUDE(LibnfcDrivers)
|
||||
|
||||
IF(WIN32)
|
||||
# Windows now requires regex, so we utilize PCRE
|
||||
# since Windows doesn't get the benefit of finding in CMake
|
||||
# it has to be added manually
|
||||
IF(PCRE_FOUND)
|
||||
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${PCRE_LIBRARY_DIRS})
|
||||
ENDIF(PCRE_FOUND)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(PCSC_FOUND)
|
||||
INCLUDE_DIRECTORIES(${PCSC_INCLUDE_DIRS})
|
||||
LINK_DIRECTORIES(${PCSC_LIBRARY_DIRS})
|
||||
@ -40,6 +50,10 @@ ENDIF(WIN32)
|
||||
SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 0)
|
||||
|
||||
IF(WIN32)
|
||||
IF(PCRE_FOUND)
|
||||
TARGET_LINK_LIBRARIES(nfc ${PCRE_LIBRARIES})
|
||||
ENDIF(PCRE_FOUND)
|
||||
|
||||
# On Windows the shared (runtime) library should be either in the same
|
||||
# directory as the excutables or in the path, we add it to same directory
|
||||
INSTALL(TARGETS nfc RUNTIME DESTINATION bin COMPONENT libraries)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user