提交 a7edafc4 编写于 作者: L liaogang

add cc_test

上级 00441a90
...@@ -28,10 +28,12 @@ if(NOT CMAKE_Go_COMPILER) ...@@ -28,10 +28,12 @@ if(NOT CMAKE_Go_COMPILER)
NAMES go NAMES go
PATHS ${Go_BIN_PATH} PATHS ${Go_BIN_PATH}
) )
EXEC_PROGRAM(${CMAKE_Go_COMPILER} ARGS version OUTPUT_VARIABLE GOLANG_VERSION) if(CMAKE_Go_COMPILER)
STRING(REGEX MATCH "go[0-9]+.[0-9]+.[0-9]+[ /A-Za-z0-9]*" VERSION "${GOLANG_VERSION}") EXEC_PROGRAM(${CMAKE_Go_COMPILER} ARGS version OUTPUT_VARIABLE GOLANG_VERSION)
message("-- The Golang compiler identification is ${VERSION}") STRING(REGEX MATCH "go[0-9]+[.0-9]*[ /A-Za-z0-9]*" VERSION "${GOLANG_VERSION}")
message("-- Check for working Golang compiler: ${CMAKE_Go_COMPILER}") message("-- The Golang compiler identification is ${VERSION}")
message("-- Check for working Golang compiler: ${CMAKE_Go_COMPILER}")
endif()
endif() endif()
endif() endif()
......
...@@ -163,8 +163,9 @@ function(go_library TARGET_NAME) ...@@ -163,8 +163,9 @@ function(go_library TARGET_NAME)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
add_custom_target(${TARGET_NAME}_lib ALL DEPENDS ${TARGET_NAME}_timestamp ${go_library_DEPS}) add_custom_target(${TARGET_NAME}_lib ALL DEPENDS ${TARGET_NAME}_timestamp ${go_library_DEPS})
add_library(${TARGET_NAME} STATIC IMPORTED) add_library(${TARGET_NAME} STATIC IMPORTED)
set_target_properties(${TARGET_NAME} PROPERTIES set_property(TARGET ${TARGET_NAME} PROPERTY
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}) IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}")
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_lib)
endfunction(go_library) endfunction(go_library)
function(go_binary TARGET_NAME) function(go_binary TARGET_NAME)
......
...@@ -9,7 +9,7 @@ add_subdirectory(pserver) ...@@ -9,7 +9,7 @@ add_subdirectory(pserver)
add_subdirectory(trainer) add_subdirectory(trainer)
add_subdirectory(scripts) add_subdirectory(scripts)
if(${CMAKE_Go_COMPILER}) if(CMAKE_Go_COMPILER)
add_subdirectory(go) add_subdirectory(go)
endif() endif()
......
...@@ -2,12 +2,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) ...@@ -2,12 +2,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
go_library(adder SRCS adder.go) go_library(adder SRCS adder.go)
# cc_test(cgo_test cc_test(cgo_test
# SRCS SRCS
# cgo_test.cc cgo_test.cc
# DEPS DEPS
# adder) adder)
add_executable(cgo_test cgo_test.cc)
add_dependencies(cgo_test adder)
target_link_libraries(cgo_test ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} adder)
add_test(cgo_test cgo_test)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册