fix using pkg-config

This commit is contained in:
Martin Brodbeck 2018-08-10 10:45:50 +02:00
parent e0e0f641e2
commit 756a59aa6b
2 changed files with 13 additions and 6 deletions

View file

@ -24,8 +24,11 @@ set(CORE_SOURCES
)
add_library(core STATIC ${CORE_SOURCES})
target_link_libraries(core Boost::boost Boost::date_time sqlite3 ${XLNT_LIBRARY} ${JSONCPP_LIBRARY})
if (WIN32)
target_link_libraries(core Boost::boost Boost::date_time sqlite3 ${XLNT_LIBRARY} ${JSONCPP_LIBRARY})
target_link_libraries(core bcrypt)
else()
target_link_libraries(core Boost::boost Boost::date_time sqlite3 ${XLNT_LIBRARIES} ${JSONCPP_LIBRARIES})
endif()
target_include_directories(core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -2,17 +2,21 @@ set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.62 REQUIRED)
if (MINGW)
if(WIN32)
find_package(LibUSB REQUIRED)
else (MINGW)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
endif (MINGW)
pkg_check_modules(LibUSB REQUIRED libusb-1.0)
endif()
set(PRINTER_SOURCES
posprinter.cpp
)
add_library(printer STATIC ${PRINTER_SOURCES})
target_link_libraries(printer core ${LIBUSB_1_LIBRARIES})
if(WIN32)
target_link_libraries(printer core ${LibUSB_1_LIBRARIES})
else()
target_link_libraries(printer core ${LibUSB_LIBRARIES})
endif()
target_include_directories(printer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})