|
| 1 | +cmake_minimum_required(VERSION 3.10) |
| 2 | +project(vdwreader) |
| 3 | +set(CMAKE_CXX_STANDARD 17) |
| 4 | +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") |
| 5 | + |
| 6 | +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 7 | + set(LINUX TRUE) |
| 8 | +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 9 | + set(DARWIN TRUE) |
| 10 | +elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") |
| 11 | + set(FREEBSD TRUE) |
| 12 | +endif() |
| 13 | + |
| 14 | +# checking if we are called in the correct way: |
| 15 | +# with a -B argument. and without a cache file in the source directory. |
| 16 | +if (CMAKE_CACHEFILE_DIR STREQUAL "${CMAKE_SOURCE_DIR}") |
| 17 | + message(FATAL_ERROR "\nUnexpected CMakeCache.txt file in the source directory. Please remove it.") |
| 18 | + return() |
| 19 | +endif() |
| 20 | + |
| 21 | +if (EXISTS ${CMAKE_BINARY_DIR}/CMakeLists.txt) |
| 22 | + message(FATAL_ERROR "\nRun cmake with an explicit -B buildpath") |
| 23 | + return() |
| 24 | +endif() |
| 25 | + |
| 26 | +if(MSVC) |
| 27 | + # /MP = multithreaded build |
| 28 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") |
| 29 | + # /utf-8 = utf8 source and execution |
| 30 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") |
| 31 | +endif() |
| 32 | + |
| 33 | +if (WIN32) |
| 34 | + add_definitions(-DNOMINMAX -DNOGDI) |
| 35 | +endif() |
| 36 | + |
| 37 | +add_library(itslib ../../itslib/src/stringutils.cpp) |
| 38 | +target_include_directories(itslib PUBLIC ../../itslib/include/itslib) |
| 39 | +target_compile_definitions(itslib PUBLIC _UNIX _NO_RAPI) |
| 40 | + |
| 41 | +#add_library(cpputils INTERFACE) |
| 42 | +#target_include_directories(cpputils INTERFACE ../../cpputils) |
| 43 | + |
| 44 | + |
| 45 | +find_package(OpenSSL REQUIRED) |
| 46 | +find_package(ZLIB REQUIRED) |
| 47 | + |
| 48 | +add_executable(vdwreader ${CMAKE_SOURCE_DIR}/vdwreader.cpp) |
| 49 | +target_link_libraries(vdwreader OpenSSL::Crypto) |
| 50 | +target_link_libraries(vdwreader ZLIB::ZLIB) |
| 51 | +target_link_libraries(vdwreader itslib) |
| 52 | +#target_link_libraries(vdwreader cpputils) |
| 53 | + |
| 54 | + |
0 commit comments