Skip to content

Commit

Permalink
Update CMakeLists.txt to fix vcpkg issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zieckey committed May 28, 2017
1 parent bd62c32 commit 39d7e23
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 71 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ message (STATUS "LIBRARY_OUTPUT_PATH " ${LIBRARY_OUTPUT_PATH})

add_subdirectory (evpp)
add_subdirectory (apps)
add_subdirectory (test)
add_subdirectory (examples)
add_subdirectory (benchmark)
if (NOT EVPP_VCPKG_BUILD)
add_subdirectory (test)
add_subdirectory (examples)
add_subdirectory (benchmark)
endif ()

set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
Expand Down
39 changes: 2 additions & 37 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,8 @@ link_directories("/home/s/safe/lib" ${PROJECT_BUILD_DIR}/lib)
else(UNIX)
set(LIBRARIES evpp_static event glog)
link_directories(${PROJECT_SOURCE_DIR}/vsprojects/bin/${CMAKE_BUILD_TYPE}/
${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/
${PROJECT_SOURCE_DIR}/3rdparty/glog-0.3.4/${CMAKE_BUILD_TYPE})
${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/)
endif(UNIX)

add_subdirectory(evnsq)

#----------------------------------------
# evmc
set(CMAKE_C_FLAGS -std=gnu99)
file(GLOB evmc_SRCS evmc/*.cc
evmc/*.h
${PROJECT_SOURCE_DIR}/3rdparty/libhashkit/*.c)
file(GLOB evmc_PUBLIC_HEADERS evmc/*.h)

add_library(evmc SHARED ${evmc_SRCS})
target_link_libraries(evmc ${LIBRARIES})

add_library(evmc_static STATIC ${evmc_SRCS})
target_link_libraries(evmc_static ${LIBRARIES})

add_executable(evmc_test evmc/test/mcpool_test.cc)
target_link_libraries(evmc_test evmc_static ${LIBRARIES})

set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
include (packages)
set_target_properties (
evmc evnsq PROPERTIES
VERSION "${PACKAGE_VERSION}"
SOVERSION "${PACKAGE_SOVERSION}"
)

#----------------------------------------
# install
install (
TARGETS evmc evmc_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

install (FILES ${evmc_PUBLIC_HEADERS} DESTINATION "include/evmc")
add_subdirectory(evmc)
39 changes: 39 additions & 0 deletions apps/evmc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

set(CMAKE_C_FLAGS -std=gnu99)
file(GLOB evmc_SRCS *.cc
*.h
${PROJECT_SOURCE_DIR}/3rdparty/libhashkit/*.c)
file(GLOB evmc_PUBLIC_HEADERS *.h)

add_library(evmc_static STATIC ${evmc_SRCS})
target_link_libraries(evmc_static ${LIBRARIES})

if (UNIX)
add_library(evmc SHARED ${evmc_SRCS})
target_link_libraries(evmc ${LIBRARIES})

set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
include (packages)
set_target_properties (
evmc evnsq PROPERTIES
VERSION "${PACKAGE_VERSION}"
SOVERSION "${PACKAGE_SOVERSION}"
)

install (
TARGETS evmc
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (UNIX)

install (
TARGETS evmc_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install (FILES ${evmc_PUBLIC_HEADERS} DESTINATION "include/evmc")


if (NOT EVPP_VCPKG_BUILD)
add_subdirectory(test)
endif ()
3 changes: 3 additions & 0 deletions apps/evmc/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

add_executable(evmc_test mcpool_test.cc)
target_link_libraries(evmc_test evmc_static ${LIBRARIES})
52 changes: 25 additions & 27 deletions apps/evnsq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@

# evnsq
file(GLOB evnsq_SRCS *.cc evnsq/*.h)
file(GLOB evnsq_SRCS *.cc *.h)
file(GLOB evnsq_PUBLIC_HEADERS *.h)

add_library(evnsq SHARED ${evnsq_SRCS})
target_link_libraries(evnsq ${LIBRARIES})

add_library(evnsq_static STATIC ${evnsq_SRCS})
target_link_libraries(evnsq_static ${LIBRARIES})

#----------------------------------------
# install
if (UNIX)
add_library(evnsq SHARED ${evnsq_SRCS})
target_link_libraries(evnsq ${LIBRARIES})

set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
include (packages)
set_target_properties (
evnsq PROPERTIES
VERSION "${PACKAGE_VERSION}"
SOVERSION "${PACKAGE_SOVERSION}"
)

install (
TARGETS evnsq
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif (UNIX)

install (
TARGETS evnsq evnsq_static
TARGETS evnsq_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

install (FILES ${evnsq_PUBLIC_HEADERS} DESTINATION "include/evnsq")



#----------------------------------------
# unit tests
add_executable(evnsq_tail evnsqtail/main.cc)
target_link_libraries(evnsq_tail evnsq_static ${LIBRARIES})


set (unittest_evnsq_producer_with_auth_SRCS test/producer_with_auth/main.cc)
if (WIN32)
list (APPEND unittest_evnsq_producer_with_auth_SRCS ${PROJECT_SOURCE_DIR}/3rdparty/win32code/getopt/getopt.c)
list (APPEND unittest_evnsq_producer_with_auth_SRCS ${PROJECT_SOURCE_DIR}/3rdparty/win32code/getopt/getopt_long.c)
endif (WIN32)

add_executable(unittest_evnsq_producer_with_auth ${unittest_evnsq_producer_with_auth_SRCS})
target_link_libraries(unittest_evnsq_producer_with_auth evnsq_static ${LIBRARIES})

if (NOT EVPP_VCPKG_BUILD)
add_subdirectory(evnsqtail)
add_subdirectory(test)
endif ()
2 changes: 2 additions & 0 deletions apps/evnsq/evnsqtail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_executable(evnsq_tail main.cc)
target_link_libraries(evnsq_tail evnsq_static ${LIBRARIES})
1 change: 1 addition & 0 deletions apps/evnsq/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(producer_with_auth)
10 changes: 10 additions & 0 deletions apps/evnsq/test/producer_with_auth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

set (unittest_evnsq_producer_with_auth_SRCS main.cc)
if (WIN32)
list (APPEND unittest_evnsq_producer_with_auth_SRCS ${PROJECT_SOURCE_DIR}/3rdparty/win32code/getopt/getopt.c)
list (APPEND unittest_evnsq_producer_with_auth_SRCS ${PROJECT_SOURCE_DIR}/3rdparty/win32code/getopt/getopt_long.c)
endif (WIN32)

add_executable(unittest_evnsq_producer_with_auth ${unittest_evnsq_producer_with_auth_SRCS})
target_link_libraries(unittest_evnsq_producer_with_auth evnsq_static ${LIBRARIES})

2 changes: 1 addition & 1 deletion vsprojects/libevpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<ClInclude Include="..\evpp\libevent.h" />
<ClInclude Include="..\evpp\event_watcher.h" />
<ClInclude Include="..\evpp\listener.h" />
<ClInclude Include="..\evpp\log_config.h" />
<ClInclude Include="..\evpp\logging.h" />
<ClInclude Include="..\evpp\memmem.h" />
<ClInclude Include="..\evpp\platform_config.h" />
<ClInclude Include="..\evpp\server_status.h" />
Expand Down
6 changes: 3 additions & 3 deletions vsprojects/libevpp.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@
<ClInclude Include="..\evpp\sockets.h">
<Filter>tcp</Filter>
</ClInclude>
<ClInclude Include="..\evpp\log_config.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\evpp\platform_config.h">
<Filter>common</Filter>
</ClInclude>
Expand Down Expand Up @@ -246,5 +243,8 @@
<ClInclude Include="..\evpp\libevent.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="..\evpp\logging.h">
<Filter>common</Filter>
</ClInclude>
</ItemGroup>
</Project>

0 comments on commit 39d7e23

Please sign in to comment.