Think cmake is figured out

This commit is contained in:
Ian Roddis
2021-06-03 21:22:00 -03:00
parent 850d177ff5
commit d7b32ce03a
3 changed files with 16 additions and 11 deletions

View File

@@ -1,19 +1,23 @@
project(pistache) project(pistache)
include(ExternalProject) include(ExternalProject)
set(PISTACHE_BINARY_DIR ${THIRD_PARTY_DIR}/pistache) ExternalProject_Add(PistacheDownload
PREFIX third_party
ExternalProject_Add(${PROJECT_NAME}_extern
GIT_REPOSITORY https://github.com/pistacheio/pistache.git GIT_REPOSITORY https://github.com/pistacheio/pistache.git
GIT_TAG master GIT_TAG master
BINARY_DIR ${PISTACHE_BINARY_DIR}
INSTALL_COMMAND "" INSTALL_COMMAND ""
) )
add_library(${PROJECT_NAME} STATIC IMPORTED) set(PISTACHE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/third_party/src/PistacheDownload/include)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_extern) set(PISTACHE_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/third_party/src/PistacheDownload-build/src)
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORTED_LOCATION "${PISTACHE_BINARY_DIR}/lib/libpistache.a") add_library(${PROJECT_NAME} SHARED IMPORTED)
add_dependencies(${PROJECT_NAME} $PistacheDownload)
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORTED_LOCATION "${PISTACHE_LIB_DIR}/libpistache.a")
#add_library(${PROJECT_NAME} STATIC IMPORTED)
#set_target_properties(${PROJECT_NAME} PROPERTIES IMPORTED_LOCATION "${PISTACHE_BINARY_DIR}/lib/libpistache.a")
#file(MAKE_DIRECTORY "${PISTACHE_BINARY_DIR}/include") #file(MAKE_DIRECTORY "${PISTACHE_BINARY_DIR}/include")
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE "${PISTACHE_BINARY_DIR}/include/") #target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE "${PISTACHE_BINARY_DIR}/include/")

View File

@@ -4,6 +4,7 @@ project(daggy)
file(GLOB SOURCES src/*.cpp) file(GLOB SOURCES src/*.cpp)
add_library(${PROJECT_NAME} STATIC ${SOURCES}) add_library(${PROJECT_NAME} STATIC ${SOURCES})
include_directories(${PISTACHE_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PUBLIC include)
add_dependencies(${PROJECT_NAME} pistache)
target_link_libraries(${PROJECT_NAME} pistache pthread) target_link_libraries(${PROJECT_NAME} pistache pthread)
add_dependencies(${PROJECT_NAME} PistacheDownload)

View File

@@ -9,7 +9,7 @@
namespace daggy { namespace daggy {
class Server { class Server {
public: public:
Server(Address addr) Server(Pistache::Address addr)
: endpoint_(addr) : endpoint_(addr)
, desc("Daggy API", "0.1") , desc("Daggy API", "0.1")
{} {}
@@ -23,7 +23,7 @@ namespace daggy {
Pistache::Http::Endpoint endpoint_; Pistache::Http::Endpoint endpoint_;
Pistache::Rest::Description desc_; Pistache::Rest::Description desc_;
Pistache::Router router_; Pistache::Http::Router router_;
}; };
} }