Add target to build syncthing executable (like the syncthing library)
This commit is contained in:
parent
8b922166dd
commit
9dc5ad7ceb
|
@ -177,7 +177,20 @@ add_custom_command(
|
|||
"${CMAKE_RANLIB}" "${SYNCTHINGINTERNAL_LIBRARY_PATH}"
|
||||
DEPENDS ${SRC_FILES_SYNCTHING}
|
||||
WORKING_DIRECTORY "${SYNCTHING_PATH}"
|
||||
COMMENT "Building Syncthing itself")
|
||||
COMMENT "Building Syncthing itself (as library)")
|
||||
|
||||
# add target to compile Syncthing as standalone executable (helpful for testing)
|
||||
set(SYNCTHING_EXECUTABLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/syncthing")
|
||||
add_custom_target(syncthing_executable
|
||||
COMMAND
|
||||
"CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "AR=${CMAKE_C_COMPILER_AR}" "GOOS=${GO_TARGET_OS}"
|
||||
"CGO_CFLAGS=${CGO_CFLAGS}" "CGO_CXXFLAGS=${CGO_CXXFLAGS}" "CGO_LDFLAGS=${CGO_LDFLAGS}" "GOARCH=${GO_TARGET_ARCH}"
|
||||
"CGO_ENABLED=1" "GO111MODULE=on" "GOPATH=${GO_DEVELOPMENT_PATH}" "GOFLAGS=${GO_FLAGS}" "${GO_BIN}" build -v
|
||||
-buildmode exe -o "${SYNCTHING_EXECUTABLE_PATH}" -ldflags "${GO_LINKER_FLAGS}" ./cmd/syncthing
|
||||
DEPENDS ${SRC_FILES_SYNCTHING}
|
||||
WORKING_DIRECTORY "${SYNCTHING_PATH}"
|
||||
COMMENT "Building Syncthing itself (as executable, ${SYNCTHING_EXECUTABLE_PATH})"
|
||||
)
|
||||
|
||||
# find c++utilities to use CMake modules and headers from it privately
|
||||
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
||||
|
|
Loading…
Reference in New Issue