Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install and export commands #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ project(raylib-tmx
)

# Include Directory
add_subdirectory(include)
add_subdirectory(src)

# Examples
Expand Down
4 changes: 0 additions & 4 deletions include/CMakeLists.txt

This file was deleted.

30 changes: 28 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
function(export_library lib_name)
install(TARGETS ${lib_name}
EXPORT "${lib_name}Config"
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(DIRECTORY ../include/ DESTINATION include)

export(EXPORT "${lib_name}Config"
FILE "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}Config.cmake"
)
install(EXPORT "${lib_name}Config"
FILE "${lib_name}Config.cmake"
DESTINATION lib/cmake/${lib_name}
)
endfunction()

# raylib
find_package(raylib QUIET)
if (NOT raylib_FOUND)
Expand Down Expand Up @@ -44,12 +62,20 @@ endif()

if(RAYLIB_TMX)
add_library(raylib-tmx STATIC raylib-tmx.c)
target_include_directories(raylib-tmx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_include_directories(raylib-tmx PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(raylib-tmx PUBLIC ${RAYLIB_TMX_DEPS})
export_library("raylib-tmx")
endif()

if(RAYLIB_TMX_SHARED)
add_library(raylib-tmx-shared SHARED raylib-tmx.c)
target_include_directories(raylib-tmx-shared PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_include_directories(raylib-tmx-shared PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(raylib-tmx-shared PUBLIC ${RAYLIB_TMX_DEPS})
export_library("raylib-tmx-shared")
endif()