Skip to content

Commit

Permalink
build: add export config for find_package, ref #180
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Nov 7, 2024
1 parent 77eb74a commit 9f0dff5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ set(namespace ac::)
export(EXPORT ac-local-targets
NAMESPACE ${namespace}
)
configure_file(
ac-local-config-export.in.cmake
ac-local-config.cmake
@ONLY
)

install(EXPORT ac-local-targets
NAMESPACE ${namespace}
Expand Down
23 changes: 23 additions & 0 deletions ac-local-config-export.in.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) Borislav Stanimirov
# SPDX-License-Identifier: MIT
#
include(${CMAKE_CURRENT_LIST_DIR}/ac-local-targets.cmake)
message(STATUS "ac-local dev @CMAKE_BUILD_TYPE@ found in ${CMAKE_CURRENT_LIST_DIR}")

if(WIN32 AND CMAKE_RUNTIME_OUTPUT_DIRECTORY)
# on windows we need to have the dlls in the runtime directory
# so that the executables can find them
if(NOT EXISTS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ac-local.dll)
# we're making symlinks, so only do it once
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_LIST_DIR}/bin/ac-local.dll
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ac-local.dll
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_LIST_DIR}/bin/ac-jalog.dll
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ac-jalog.dll
COMMAND_ERROR_IS_FATAL ANY
)
endif()
endif()

0 comments on commit 9f0dff5

Please sign in to comment.