mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 13:03:45 +02:00
CMake error if go not found
This commit is contained in:
parent
cb342bfb12
commit
df9483408d
1 changed files with 14 additions and 2 deletions
|
@ -12,6 +12,18 @@ else()
|
||||||
cmake_policy(VERSION 3.15)
|
cmake_policy(VERSION 3.15)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_program(
|
||||||
|
GO go
|
||||||
|
HINTS "/usr/local/go" "C:/go/bin"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT GO)
|
||||||
|
message(FATAL_ERROR "Golang not found")
|
||||||
|
else(NOT GO)
|
||||||
|
message(STATUS "Found Golang at ${GO}")
|
||||||
|
endif(NOT GO)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(default_build_type "Release")
|
set(default_build_type "Release")
|
||||||
|
|
||||||
|
@ -121,8 +133,8 @@ file(GLOB go_src
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/zerotier_cgo.h ${CMAKE_BINARY_DIR}/zerotier_cgo.a
|
OUTPUT ${CMAKE_BINARY_DIR}/zerotier_cgo.h ${CMAKE_BINARY_DIR}/zerotier_cgo.a
|
||||||
COMMAND go build -buildmode=c-archive -o ${CMAKE_BINARY_DIR}/zerotier_cgo.a ${CMAKE_SOURCE_DIR}/cmd/zerotier/zerotier.go
|
COMMAND ${GO} build -buildmode=c-archive -o ${CMAKE_BINARY_DIR}/zerotier_cgo.a ${CMAKE_SOURCE_DIR}/cmd/zerotier/zerotier.go
|
||||||
IMPLICIT_DEPENDS go ${go_src}
|
IMPLICIT_DEPENDS ${go_src}
|
||||||
COMMENT "Compiling Go Code..."
|
COMMENT "Compiling Go Code..."
|
||||||
)
|
)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
|
|
Loading…
Add table
Reference in a new issue