Hash :
d1036201
Author :
Date :
2022-06-18T16:10:38
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
set(CLI_INCLUDES
"${libgit2_BINARY_DIR}/src/util"
"${libgit2_SOURCE_DIR}/src/util"
"${libgit2_SOURCE_DIR}/src/cli"
"${libgit2_SOURCE_DIR}/include")
if(WIN32 AND NOT CYGWIN)
file(GLOB CLI_SRC_OS win32/*.c)
list(SORT CLI_SRC_OS)
else()
file(GLOB CLI_SRC_OS unix/*.c)
list(SORT CLI_SRC_OS)
endif()
file(GLOB CLI_SRC_C *.c *.h)
list(SORT CLI_SRC_C)
#
# The CLI currently needs to be statically linked against libgit2 because
# the utility library uses libgit2's thread-local error buffers. TODO:
# remove this dependency and allow us to dynamically link against libgit2.
#
if(BUILD_CLI STREQUAL "dynamic")
set(CLI_LIBGIT2_LIBRARY libgit2package)
else()
set(CLI_LIBGIT2_OBJECTS $<TARGET_OBJECTS:libgit2>)
endif()
#
# Compile and link the CLI
#
add_executable(git2_cli ${CLI_SRC_C} ${CLI_SRC_OS} ${CLI_OBJECTS}
$<TARGET_OBJECTS:util>
${CLI_LIBGIT2_OBJECTS}
${LIBGIT2_DEPENDENCY_OBJECTS})
target_link_libraries(git2_cli ${CLI_LIBGIT2_LIBRARY} ${LIBGIT2_SYSTEM_LIBS})
set_target_properties(git2_cli PROPERTIES C_STANDARD 90)
set_target_properties(git2_cli PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
ide_split_sources(git2_cli)
target_include_directories(git2_cli PRIVATE ${CLI_INCLUDES})
if(MSVC_IDE)
# Precompiled headers
set_target_properties(git2_cli PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
set_source_files_properties(win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
endif()
install(TARGETS git2_cli RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})