Skip to content

Commit

Permalink
Fix issue with older CMake when building FIPS static using Ninja buil…
Browse files Browse the repository at this point in the history
…d system (aws#1362)
  • Loading branch information
skmcgrail authored Dec 19, 2023
1 parent c64288b commit a787042
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions cmake/go.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@ function(go_executable dest package)
cmake_policy(SET CMP0116 OLD)
endif()

set(depfile "${CMAKE_CURRENT_BINARY_DIR}/${dest}.d")
add_custom_command(OUTPUT ${dest}
COMMAND ${GO_EXECUTABLE} build
-o ${CMAKE_CURRENT_BINARY_DIR}/${dest} ${package}
COMMAND ${GO_EXECUTABLE} run ${godeps} -format depfile
-target ${target} -pkg ${package} -out ${depfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${godeps} ${CMAKE_SOURCE_DIR}/go.mod
DEPFILE ${depfile})
if(CMAKE_VERSION VERSION_LESS "3.7")
add_custom_command(OUTPUT ${dest}
COMMAND ${GO_EXECUTABLE} build
-o ${CMAKE_CURRENT_BINARY_DIR}/${dest} ${package}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CMAKE_SOURCE_DIR}/go.mod)
else()
set(depfile "${CMAKE_CURRENT_BINARY_DIR}/${dest}.d")
add_custom_command(OUTPUT ${dest}
COMMAND ${GO_EXECUTABLE} build
-o ${CMAKE_CURRENT_BINARY_DIR}/${dest} ${package}
COMMAND ${GO_EXECUTABLE} run ${godeps} -format depfile
-target ${target} -pkg ${package} -out ${depfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${godeps} ${CMAKE_SOURCE_DIR}/go.mod
DEPFILE ${depfile})
endif()
endif()
endfunction()

0 comments on commit a787042

Please sign in to comment.