Hi folks,
I am struggling to understand what the problem is with this:
find_program (GO go)
set (GOPATH "${CMAKE_CURRENT_BINARY_DIR}/go")
file (MAKE_DIRECTORY ${GOPATH})
set (sources ${CMAKE_CURRENT_SOURCE_DIR}/callback_generator.go)
set (build_command ${GO} build)
set (output callback_generator${CMAKE_EXECUTABLE_SUFFIX})
add_custom_command (OUTPUT ${output}
COMMAND ${CMAKE_COMMAND} -E env GOPATH=${GOPATH}
CGO_CFLAGS=${CMAKE_CGO_CFLAGS} ${build_command} -o ${output} ${CMAKE_GO_FLAGS}
${sources}
DEPENDS ${sources}
VERBATIM)
add_custom_target (callback_generator_target DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${output})
add_executable (callback_generator IMPORTED)
set_target_properties (callback_generator
PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${output}
)
add_dependencies (callback_generator callback_generator_target)
add_custom_target (server ALL DEPENDS callback_generator)
which gives this error:
cmake --version
cmake --version
cmake version 3.14.3
cmake -G "MinGW Makefiles" ..\..
cmake -G "MinGW Makefiles" ..\..
-- Configuring done
CMake Error: The inter-target dependency graph contains the following strongly
connected component (cycle):
"callback_generator_target" of type UTILITY
depends on "callback_generator_target" (strong)
The component contains at least one cycle consisting of strong dependencies
(created by add_dependencies) that cannot be broken.
The set_target_properties () call seems to be part of the problem but I
don't understand why.
Regards
Bill Somerville.
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake