This is my CMakeLists.txt:
set(CMAKE_VERBOSE_MAKEFILE ON)
cmake_minimum_required(VERSION 3.8)
project(spider)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_executable(spider ${SOURCE_FILES})
target_link_libraries(spider ${Boost_LIBRARIES})
target_link_libraries(spider Threads::Threads)
target_link_libraries(spider
${Boost_PROGRAM_OPTIONS_LIBRARIES}
${Boost_FILESYSTEM_LIBRARIES}
${Boost_SYSTEM_LIBRARIES}
)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lboost_system -DBOOST_SYSTEM_NO_DEPRECATED" )
This are my includes files from main.cpp:
#include <iostream>
#include <boost/array.hpp>
#include <boost/asio.hpp>
using boost::asio::ip::udp;
I tried downloading and building boost, it causes tons of trobules, so I decided to use boost which comes with cygwin installer. I do have boost_system and boost in my /include folder, so I don't have to setup boost in my Cmakelists.txt:
The question is what to do with the error:
/usr/include/boost/system/error_code.hpp:322: undefined reference to `boost::system::system_category()'
As you can see, I've tried -lboost_system and -DBOOST_SYSTEM_NO_DEPRECATED, the flags are passed to g++:
/usr/bin/c++.exe -lboost_system -DBOOST_SYSTEM_NO_DEPRECATED -g -Wl,--enable-auto-import CMakeFiles/spider.dir/main.cpp.o -o spider.exe -Wl,--out-implib,libspider.dll.a -Wl,--major-image-version,0,--minor-image-version,0
but this doesn't help. Any ideas ?
