metaforce/hecl/bintoc/CMakeLists.txt

63 lines
2.1 KiB
CMake
Raw Normal View History

2017-12-06 20:09:27 -08:00
if(NOT CMAKE_CROSSCOMPILING)
add_executable(bintoc bintoc.c)
2020-03-03 23:41:03 -08:00
target_include_directories(bintoc PRIVATE ${ZLIB_INCLUDE_DIR})
2020-03-01 22:59:31 -08:00
target_link_libraries(bintoc ${ZLIB_LIBRARIES})
2018-10-06 19:53:57 -07:00
function(bintoc out in sym)
2015-09-01 19:31:33 -07:00
if(IS_ABSOLUTE ${out})
set(theOut ${out})
else()
set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out})
endif()
if(IS_ABSOLUTE ${in})
set(theIn ${in})
else()
set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in})
endif()
2018-09-08 14:34:37 -07:00
get_filename_component(outDir ${theOut} DIRECTORY)
file(MAKE_DIRECTORY ${outDir})
2015-09-01 19:31:33 -07:00
add_custom_command(OUTPUT ${theOut}
COMMAND $<TARGET_FILE:bintoc> ARGS ${theIn} ${theOut} ${sym}
2017-12-28 23:56:31 -08:00
DEPENDS ${theIn} bintoc)
2018-10-06 19:53:57 -07:00
endfunction()
2020-03-01 22:59:31 -08:00
function(bintoc_compress out in sym)
if(IS_ABSOLUTE ${out})
set(theOut ${out})
else()
set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out})
endif()
if(IS_ABSOLUTE ${in})
set(theIn ${in})
else()
set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in})
endif()
get_filename_component(outDir ${theOut} DIRECTORY)
file(MAKE_DIRECTORY ${outDir})
add_custom_command(OUTPUT ${theOut}
COMMAND $<TARGET_FILE:bintoc> ARGS --compress ${theIn} ${theOut} ${sym}
DEPENDS ${theIn} bintoc)
endfunction()
2017-12-06 20:09:27 -08:00
##################
# Package Export #
##################
# Add all targets to the build-tree export set
export(TARGETS bintoc FILE "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE hecl-bintoc)
# Create the atdnaConfig.cmake
# ... for the build tree
configure_file(hecl-bintocConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocConfig.cmake" @ONLY)
# ... for the install tree
configure_file(hecl-bintocConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hecl-bintocConfig.cmake" @ONLY)
# ... for both
configure_file(hecl-bintocConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocConfigVersion.cmake" @ONLY)
else()
# Use native if cross compiling
find_package(hecl-bintoc REQUIRED)
endif()