Skip to content

Commit 5f1ade9

Browse files
committed
fix license file copy on multi-config generators
1 parent 68c1296 commit 5f1ade9

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,3 @@ configure_file(cmake/llama.pc.in
252252

253253
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/llama.pc"
254254
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
255-
256-
#
257-
# copy the license files
258-
#
259-
260-
# Check if running in GitHub Actions
261-
if(DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true")
262-
message(STATUS "Running inside GitHub Actions - copying license files")
263-
264-
# Copy all files from licenses/ to build/bin/
265-
file(GLOB LICENSE_FILES "${CMAKE_SOURCE_DIR}/licenses/*")
266-
foreach(LICENSE_FILE ${LICENSE_FILES})
267-
get_filename_component(FILENAME ${LICENSE_FILE} NAME)
268-
configure_file(${LICENSE_FILE} "${CMAKE_BINARY_DIR}/bin/${FILENAME}" COPYONLY)
269-
endforeach()
270-
endif()
271-

common/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,27 @@ endif ()
144144
target_include_directories(${TARGET} PUBLIC .)
145145
target_compile_features (${TARGET} PUBLIC cxx_std_17)
146146
target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} PUBLIC llama Threads::Threads)
147+
148+
149+
#
150+
# copy the license files
151+
#
152+
153+
# Check if running in GitHub Actions
154+
if (DEFINED ENV{GITHUB_ACTIONS} AND "$ENV{GITHUB_ACTIONS}" STREQUAL "true")
155+
message(STATUS "Running inside GitHub Actions - copying license files")
156+
157+
# Copy all files from licenses/ to build/bin/
158+
file(GLOB LICENSE_FILES "${CMAKE_SOURCE_DIR}/licenses/*")
159+
foreach(LICENSE_FILE ${LICENSE_FILES})
160+
get_filename_component(FILENAME ${LICENSE_FILE} NAME)
161+
add_custom_command(
162+
POST_BUILD
163+
TARGET ${TARGET}
164+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
165+
"${LICENSE_FILE}"
166+
"$<TARGET_FILE_DIR:llama>/${FILENAME}"
167+
COMMENT "Copying ${FILENAME} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
168+
message(STATUS "Copying ${LICENSE_FILE} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${FILENAME}")
169+
endforeach()
170+
endif()

0 commit comments

Comments
 (0)