1
- # Windows MinGW workarounds
2
1
IF (WIN32 )
2
+ # Windows workarounds
3
3
SET (WINDOWS_SOURCES ../contrib/win32 /stdlib.c)
4
- INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} /../contrib/win32 )
5
-
6
- # Add in the rc for version information in the dll
7
- LIST (APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_BINARY_DIR} /../windows/libnfc.rc)
8
- IF (NOT MINGW)
9
- LIST (APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR} /../contrib/win32 /nfc_msvc.def)
10
- ENDIF ()
4
+ # def and rc files for Windows
5
+ SET (RC_COMMENT "${PACKAGE_NAME} library" )
6
+ SET (RC_INTERNAL_NAME ${PACKAGE_NAME} )
7
+ SET (RC_ORIGINAL_NAME ${PACKAGE_NAME} .dll)
8
+ SET (RC_FILE_TYPE VFT_DLL)
9
+ SET (RC_FILE_FLAGS 0x0)
10
+ IF (LIBNFC_DEBUG_MODE)
11
+ SET (RC_FILE_FLAGS VS_FF_DEBUG)
12
+ ENDIF (LIBNFC_DEBUG_MODE)
13
+ CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR} /../contrib/win32 /version .rc.in ${CMAKE_CURRENT_BINARY_DIR} /libnfc.rc)
14
+ CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR} /../contrib/win32 /libnfc.def.in ${CMAKE_CURRENT_BINARY_DIR} /libnfc.def)
15
+ LIST (APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_BINARY_DIR} /libnfc.rc)
16
+ LIST (APPEND WINDOWS_SOURCES ${CMAKE_CURRENT_BINARY_DIR} /libnfc.def)
11
17
ENDIF (WIN32 )
12
18
13
19
# Library's chips
@@ -66,9 +72,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
66
72
67
73
IF (LIBNFC_LOG)
68
74
IF (WIN32 )
69
- IF (MINGW)
70
- SET (CMAKE_C_FLAGS "-fgnu89-inline ${CMAKE_C_FLAGS} " )
71
- ENDIF (MINGW)
72
75
LIST (APPEND LIBRARY_SOURCES log .c ../contrib/win32 /libnfc/log -internal .c)
73
76
ELSE (WIN32 )
74
77
LIST (APPEND LIBRARY_SOURCES log .c log -internal .c)
@@ -93,24 +96,8 @@ SET_TARGET_PROPERTIES(nfc PROPERTIES SOVERSION 6 VERSION 6.0.0)
93
96
IF (WIN32 )
94
97
# Libraries that are windows specific
95
98
TARGET_LINK_LIBRARIES (nfc wsock32)
96
- IF (MINGW)
97
- ADD_CUSTOM_COMMAND (
98
- OUTPUT libnfc.lib
99
- COMMAND ${DLLTOOL} -d ${CMAKE_CURRENT_SOURCE_DIR} /../contrib/win32 /nfc.def -l ${CMAKE_CURRENT_BINARY_DIR} /libnfc.lib ${CMAKE_CURRENT_BINARY_DIR} /libnfc.dll
100
- DEPENDS nfc ${CMAKE_CURRENT_SOURCE_DIR} /../contrib/win32 /nfc.def
101
- )
102
- ADD_CUSTOM_TARGET (win32lib ALL DEPENDS libnfc.lib)
103
- ELSE ()
104
- ADD_LIBRARY (win32lib ALIAS nfc)
105
- ENDIF ()
106
-
107
- # On Windows the shared (runtime) library should be either in the same
108
- # directory as the excutables or in the path, we add it to same directory
109
- INSTALL (TARGETS nfc RUNTIME DESTINATION bin COMPONENT libraries)
110
-
111
- # At compile time we need the .LIB file, we place it in the lib directory
112
- INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR} /libnfc.lib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
113
- ELSE (WIN32 )
114
- INSTALL (TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
99
+ # Ensure consistent lib prefix
100
+ SET_TARGET_PROPERTIES (nfc PROPERTIES PREFIX lib)
115
101
ENDIF (WIN32 )
116
102
103
+ INSTALL (TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
0 commit comments