Fix build with CMake
- Fix library finding ('nfc' instead of 'libnfc'); - Generate config.h from template on non-win32 platforms; - While here, include protection for config.h in several files.
This commit is contained in:
parent
358df7759a
commit
565ee18b8e
25 changed files with 94 additions and 24 deletions
|
@ -9,12 +9,23 @@ find_package(LIBNFC REQUIRED)
|
|||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
IF(WIN32)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_windows.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_windows.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/contrib/win32)
|
||||
find_library(WINSOCK_LIB libws2_32.a)
|
||||
set(LIBS ${LIBS} ${WINSOCK_LIB})
|
||||
ELSE(WIN32)
|
||||
include(CheckIncludeFiles)
|
||||
check_include_files("sys/endian.h" HAVE_SYS_ENDIAN_H)
|
||||
check_include_files("endian.h" HAVE_ENDIAN_H)
|
||||
check_include_files("byteswap.h" HAVE_BYTESWAP_H)
|
||||
check_include_files("CoreFoundation/CoreFoundation.h" HAVE_COREFOUNDATION_COREFOUNDATION_H)
|
||||
set(_XOPEN_SOURCE 600)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config_posix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
|
||||
ENDIF(WIN32)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||
add_definitions("-DHAVE_CONFIG_H")
|
||||
|
||||
if(MINGW)
|
||||
# force MinGW-w64 in 32bit mode
|
||||
add_definitions("-m32")
|
||||
|
|
13
cmake/config_posix.h.cmake
Normal file
13
cmake/config_posix.h.cmake
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
#ifndef __CONFIG_POSIX_H__
|
||||
#define __CONFIG_POSIX_H__
|
||||
|
||||
#cmakedefine _XOPEN_SOURCE @_XOPEN_SOURCE@
|
||||
|
||||
#cmakedefine HAVE_SYS_ENDIAN_H @_HAVE_SYS_ENDIAN_H@
|
||||
#cmakedefine HAVE_ENDIAN_H @_HAVE_ENDIAN_H@
|
||||
#cmakedefine HAVE_BYTESWAP_H @_HAVE_BYTESWAP_H@
|
||||
#cmakedefine HAVE_COREFOUNDATION_COREFOUNDATION_H @_HAVE_COREFOUNDATION_COREFOUNDATION_H@
|
||||
|
||||
#endif /* !__CONFIG_POSIX_H__ */
|
||||
|
|
@ -9,7 +9,7 @@ message("libnfc install dir: " ${LIBNFC_INSTALL_DIR})
|
|||
find_path(LIBNFC_INCLUDE_DIRS NAMES nfc/nfc.h PATHS ${LIBNFC_INSTALL_DIR}/include)
|
||||
message("libnfc include dir found: " ${LIBNFC_INCLUDE_DIRS})
|
||||
|
||||
find_library(LIBNFC_LIBRARIES libnfc PATHS ${LIBNFC_INSTALL_DIR}/lib)
|
||||
find_library(LIBNFC_LIBRARIES nfc PATHS ${LIBNFC_INSTALL_DIR}/lib)
|
||||
message("libnfc library found: " ${LIBNFC_LIBRARIES})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
* Document Identifier 130410
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
* No. M624-E01-20
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#ifndef __FREEFARE_INTERNAL_H__
|
||||
#define __FREEFARE_INTERNAL_H__
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <openssl/des.h>
|
||||
|
||||
|
|
|
@ -27,7 +27,10 @@
|
|||
* Storing NFC Forum data in Mifare Standard 1k/4k
|
||||
* Rev. 1.1 - 21 August 2007
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
*
|
||||
* /dev/brain
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
* Rev. 1.1 — 21 August 2007
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
* http://ridrix.wordpress.com/2009/09/19/mifare-desfire-communication-example/
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
* http://www.scnf.org.uk/smartstore/LASSeO%20docs/DESFIRE%20Specification%20V1%200.pdf
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
* May 2005
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
* March 2003
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
* 2007-07-09
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
|
|
Loading…
Reference in a new issue