My problem happens to be, that every time I regenerate my Project with CMake and try to build it afterwards with VisualStudio, it takes 2 tries, the first time it always fails, because of a library that can't be opened, but which is already there. The second time I build it, it works flawlessly.
I guess it's because of I let VisualStudio automatically pull and include that library and Something in my CMake file is in the wrong order, but I don't really know.
This is the CMake code that includes Asio and Websocket++ into the Project, the file VS can't open is the Asio.lib file in the last line. Websocket++ needs Asio to run.
ADD_DEFINITIONS(-DASIO_STANDALONE )
ADD_DEFINITIONS(-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_)
ADD_DEFINITIONS(-D_WEBSOCKETPP_CPP11_TYPE_TRAITS_)
Include(ExternalProject)
ExternalProject_Add(extasio
GIT_REPOSITORY https://github.com/tobiasrau/asio.git
GIT_TAG cmake)
ExternalProject_Add(extwebsocketpp
GIT_REPOSITORY https://github.com/TobiasPiontek/websocketpp.git)
include_directories(${EXTERNAL_INSTALL_LOCATION}/include "build/extwebsocketpp-prefix/src/extwebsocketpp/install/include" "build/extasio-prefix/src/extasio/include")
target_link_libraries(Test ${CMAKE_SOURCE_DIR}/build/extasio-prefix/src/extasio/lib/asio.lib)
thank you in advance, for the help
For being sure that
ExternalProjectis built before your executable, you need to add corresponded dependency:Similarly, for make sure one
ExternalProjectis build before another, specify dependency between them: