diff --git a/CMakeLists.txt b/CMakeLists.txt index 92c819002..82cf2bd22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,23 +108,17 @@ add_subdirectory(osdep) add_subdirectory(root) add_subdirectory(go/native) -set( - zt_osdep - zt_core - zt_controller - zt_go_native -) - -if(WIN32) - set(libs ${libs} wsock32 ws2_32 rpcrt4 iphlpapi) -else(WIN32) - set(libs ${libs} pthread) -endif(WIN32) - #if(BUILD_CENTRAL_CONTROLLER) # set(libs ${libs} rabbitmq-static ${PostgreSQL_LIBRARIES}) #endif(BUILD_CENTRAL_CONTROLLER) +set( + zt_osdep + zt_core + zt_controller + zt_go_native +) + add_custom_target(zerotier ALL WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/go COMMAND rm -f ../build/zerotier && go build -trimpath -ldflags -s -o ../build/zerotier cmd/zerotier/zerotier.go diff --git a/node/CMakeLists.txt b/node/CMakeLists.txt index b908133c0..b54c76704 100644 --- a/node/CMakeLists.txt +++ b/node/CMakeLists.txt @@ -90,6 +90,12 @@ add_library(${PROJECT_NAME} STATIC ${core_src} ${core_headers}) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}) +if(WIN32) + set(libs ${libs} wsock32 ws2_32 rpcrt4 iphlpapi) +else(WIN32) + set(libs ${libs} pthread) +endif(WIN32) + add_executable(zt_core_tests Tests.h Tests.cpp) target_compile_definitions(zt_core_tests PRIVATE ZT_ENABLE_TESTS=1 ZT_STANDALONE_TESTS=1) target_link_libraries(zt_core_tests zt_core ${libs})