diff --git a/cmake/pcscd.cmake b/cmake/pcscd.cmake index 42226938..5acac389 100644 --- a/cmake/pcscd.cmake +++ b/cmake/pcscd.cmake @@ -92,27 +92,25 @@ macro (find_pcscd) endif(PCSC_FOUND) endif() - if(${PCSC_LIB} NOT STREQUAL "") + if(NOT ${PCSC_LIB} STREQUAL "") message("Checking for PCSC with custom lib") find_file(PCSC_WINSCARD_H_FOUND PCSC/winscard.h) - if(${PCSC_DIR} NOT STREQUAL "") - set(PCSC_CUSTOM_LIBS "-Wl,-L${PCSC_DIR} -Wl,-l${PCSC_LIB} -Wl,-rpath,${PCSC_DIR}") - else(${PCSC_DIR} NOT STREQUAL "") - set(PCSC_CUSTOM_LIBS "-Wl,-l${PCSC_LIB}") - endif(${PCSC_DIR} NOT STREQUAL "") - set(CMAKE_C_FLAGS ${PCSC_CFLAGS} ${CMAKE_C_FLAGS}) - set(PCSC_LIBRARIES ${PCSC_LIBRARIES} ${PCSC_CUSTOM_LIBS}) - unset(PCSC_MACOSX_LIBS) - unset(PCSC_WIN_LIBS) - unset(PCSC_LIBS) - endif(${PCSC_LIB} NOT STREQUAL "") + if(NOT ${PCSC_DIR} STREQUAL "") + set(PCSC_CUSTOM_LIBS "-L${PCSC_DIR} -l${PCSC_LIB} -Wl,-rpath,${PCSC_DIR}") + else(NOT ${PCSC_DIR} STREQUAL "") + set(PCSC_CUSTOM_LIBS "-l${PCSC_LIB}") + endif(NOT ${PCSC_DIR} STREQUAL "") + message("PCSC_CUSTOM_LIBS: ${PCSC_CUSTOM_LIBS}") + message("PCSC_LIBRARIES: ${PCSC_LIBRARIES}") + set(PCSC_LIBRARIES ${PCSC_CUSTOM_LIBS} ${PCSC_LIBRARIES}) + endif(NOT ${PCSC_LIB} STREQUAL "") string(REPLACE ";" " " PCSC_CFLAGS "${PCSC_CFLAGS}") if(${BACKEND} STREQUAL ${BACKEND_ARG_PCSC} OR ${BACKEND} STREQUAL ${BACKEND_ARG_WIN} OR ${BACKEND} STREQUAL ${BACKEND_ARG_MAC} OR - ${PCSC_LIB} NOT STREQUAL "") + NOT ${PCSC_LIB} STREQUAL "") set(BACKEND_PCSC ON) else() message (FATAL_ERROR "cannot find PCSC library") diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f44d009f..f13526a3 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -62,7 +62,7 @@ endif() # static library if(BUILD_STATIC_LIB) add_library(ykpiv STATIC ${SOURCE}) - target_link_libraries(ykpiv ${LIBCRYPTO_LIBRARIES} ${PCSC_LIBRARIES} ${PCSC_WIN_LIBS} ${PCSC_MACOSX_LIBS} ${PCSC_CUSTOM_LIBS} ${ZLIB_LIBS}) + target_link_libraries(ykpiv ${LIBCRYPTO_LIBRARIES} ${PCSC_LIBRARIES} ${ZLIB_LIBS}) set_target_properties (ykpiv PROPERTIES COMPILE_FLAGS "-DSTATIC ") if(WIN32) set_target_properties(ykpiv PROPERTIES OUTPUT_NAME ykpiv_static) @@ -72,7 +72,7 @@ endif(BUILD_STATIC_LIB) # dynamic library add_library(ykpiv_shared SHARED ${SOURCE}) -target_link_libraries(ykpiv_shared ${LIBCRYPTO_LIBRARIES} ${PCSC_LIBRARIES} ${PCSC_WIN_LIBS} ${PCSC_MACOSX_LIBS} ${PCSC_CUSTOM_LIBS} ${ZLIB_LIBS}) +target_link_libraries(ykpiv_shared ${LIBCRYPTO_LIBRARIES} ${PCSC_LIBRARIES} ${ZLIB_LIBS}) set_target_properties(ykpiv_shared PROPERTIES SOVERSION ${SO_VERSION} VERSION ${VERSION}) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set_target_properties(ykpiv_shared PROPERTIES INSTALL_RPATH "${YKPIV_INSTALL_LIB_DIR}")