Finish CMake transition

FossilOrigin-Name: 6a63f03686edee983ac265f330f278b6eb8a9f1c648aaef362fa7f062d168e21
This commit is contained in:
nekobit 2022-12-09 04:48:30 +00:00
parent b25d6a9df0
commit 9ddcac5306
2 changed files with 29 additions and 18 deletions

View File

@ -61,6 +61,7 @@ target_link_options(treebird PUBLIC
-lmastodont
)
# Read CMakeLists.txt in test file
#add_subdirectory(test)
@ -69,6 +70,7 @@ set(SRC_FILES
src/types.c
src/file-to-c/main.c
src/cookie.c
src/easprintf.c
src/error.c
src/memory.c
src/helpers.c
@ -87,7 +89,6 @@ append_and_def(treebird PUBLIC SRC_FILES
src/attachments.c
src/base_page.c
src/conversations.c
src/easprintf.c
src/emoji.c
src/emoji_reaction.c
src/global_cache.c

View File

@ -2,26 +2,36 @@
# the code doesn't compile correctly, for which you can do an `#ifdef' with the
# C Preprocessor
# ugly btw, just wanted to let you know
function(append_and_def TARGET SCOPE NAME ...)
set(Y)
foreach(I RANGE 3 ${ARGC})
# Convert to uppercase for the definition
list(GET ARGV ${I} I)
math(EXPR I "${I} - 1")
get_filename_component(I ${X} NAME_WE)
string(TOUPPER _TEMP ${I})
function(append_and_def TARGET SCOPE NAME)
math(EXPR LEN "${ARGC}-1")
foreach(I RANGE 3 ${LEN})
list(GET ARGV ${I} filename)
# Convert name partto uppercase for the definition
get_filename_component(name ${filename} NAME_WE)
string(TOUPPER ${name} file_up)
# get_target_property(
# targ_comp
# ${TARGET}
# INTERFACE_COMPILE_DEFINITIONS)
get_target_property(
targ_comp
${TARGET}
COMPILE_DEFINITIONS
)
# target_compile_definitions(${TARGET} ${SCOPE}
# ${targ_comp} -DCMP_ENABLE_${_TEMP})
if ("${targ_comp}" STREQUAL "targ_comp-NOTFOUND")
set_target_properties(
${TARGET}
PROPERTIES COMPILE_DEFINITIONS "${file_up}"
)
else()
set_target_properties(
${TARGET}
PROPERTIES COMPILE_DEFINITIONS "${targ_comp};${file_up}"
)
endif()
list(APPEND Y ${_TEMP})
# Will return copy of files
list(APPEND out_list ${filename})
endforeach()
return(PROPAGATE ${Y} ${SCOPE} ${X})
# Return
set(${NAME} ${out_list} PARENT_SCOPE)
endfunction()