<commit_before>#-------------------------------------------------------------------------------
#   fips_private.cmake
#   Private cmake macros (all the public stuff is in fips.cmake)
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
#   fisit_reset(target)
#   Reset the global tracker variables.
#
macro(fips_reset target)
    set(CurDir)
    set(CurSources)
    set(CurPyFiles)
    set(CurDependencies)
    set(CurLinkLibs)
    set(CurFrameworks)
    set(CurModuleName)
    set(CurLibraryName)
    set(CurAppName)
    set(CurAppType)
    set(CurImgFiles)
endmacro()

#-------------------------------------------------------------------------------
#   fips_apply_target_group(target)
#   Apply IDE group name to target.
#
macro(fips_apply_target_group target)
    if (NOT ${FIPS_TARGET_GROUP} STREQUAL "")
        set_target_properties(${target} PROPERTIES FOLDER ${FIPS_TARGET_GROUP})
    endif()
endmacro()

#-------------------------------------------------------------------------------
#   fips_setup_link_directories()
#   Setup the link library search paths.
#
macro(fips_setup_link_directories)
    if (EXISTS ${FIPS_PROJECT_DIR}/lib/${FIPS_PLATFORM_NAME})
        link_directories(${FIPS_PROJECT_DIR}/lib/${FIPS_PLATFORM_NAME})
    endif()
endmacro()

#-------------------------------------------------------------------------------
#   fips_recurse_deps(input output)
#
macro(fips_recurse_deps input output)
    list(APPEND ${output} ${input})
    get_property(sub_input GLOBAL PROPERTY ${input}_deps)
    foreach(dep ${sub_input})
        fips_recurse_deps(${dep} ${output})
    endforeach()
endmacro()

#-------------------------------------------------------------------------------
#   fips_resolve_dependencies(target)
#   Recursively resolve dependencies of a target.
#
macro(fips_resolve_dependencies target)
    set(resolvedDeps)
    get_property(input GLOBAL PROPERTY ${target}_deps)
    foreach(dep ${input})
        fips_recurse_deps(${dep} resolvedDeps)
    endforeach()

# NOTE: we do NOT remove dups, this simplifies the tricky linker order
# requirements on GCC
# FIXME: there must be a more elegant way...
#    if (resolvedDeps)
#       list(REMOVE_DUPLICATES resolvedDeps)
#    endif()
    if (FIPS_CMAKE_VERBOSE)
        message("${target} Dependencies: ${resolvedDeps}")
    endif()
    target_link_libraries(${target} ${resolvedDeps})
endmacro()

#-------------------------------------------------------------------------------
#   fips_recurse_libs(input output)
#
macro(fips_recurse_libs input output)
    list(APPEND ${output} ${input})
    get_property(sub_input GLOBAL PROPERTY ${input}_libs)
    foreach(lib ${sub_input})
        fips_recurse_libs(${lib} ${output})
    endforeach()
endmacro()

#-------------------------------------------------------------------------------
#   fips_resolve_linklibs(target)
#   Recursively resolve link-libs of a target.
#
macro(fips_resolve_linklibs target)<commit_msg>Better fix/hack for GCC link order problems<commit_after>#-------------------------------------------------------------------------------
#   fips_private.cmake
#   Private cmake macros (all the public stuff is in fips.cmake)
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
#   fisit_reset(target)
#   Reset the global tracker variables.
#
macro(fips_reset target)
    set(CurDir)
    set(CurSources)
    set(CurPyFiles)
    set(CurDependencies)
    set(CurLinkLibs)
    set(CurFrameworks)
    set(CurModuleName)
    set(CurLibraryName)
    set(CurAppName)
    set(CurAppType)
    set(CurImgFiles)
endmacro()

#-------------------------------------------------------------------------------
#   fips_apply_target_group(target)
#   Apply IDE group name to target.
#
macro(fips_apply_target_group target)
    if (NOT ${FIPS_TARGET_GROUP} STREQUAL "")
        set_target_properties(${target} PROPERTIES FOLDER ${FIPS_TARGET_GROUP})
    endif()
endmacro()

#-------------------------------------------------------------------------------
#   fips_setup_link_directories()
#   Setup the link library search paths.
#
macro(fips_setup_link_directories)
    if (EXISTS ${FIPS_PROJECT_DIR}/lib/${FIPS_PLATFORM_NAME})
        link_directories(${FIPS_PROJECT_DIR}/lib/${FIPS_PLATFORM_NAME})
    endif()
endmacro()

#-------------------------------------------------------------------------------
#   fips_recurse_deps(input output)
#
macro(fips_recurse_deps input output)
    list(APPEND ${output} ${input})
    get_property(sub_input GLOBAL PROPERTY ${input}_deps)
    foreach(dep ${sub_input})
        fips_recurse_deps(${dep} ${output})
    endforeach()
endmacro()

#-------------------------------------------------------------------------------
#   fips_resolve_dependencies(target)
#   Recursively resolve dependencies of a target.
#
macro(fips_resolve_dependencies target)
    set(resolvedDeps)
    get_property(input GLOBAL PROPERTY ${target}_deps)
    foreach(dep ${input})
        fips_recurse_deps(${dep} resolvedDeps)
    endforeach()
    if (resolvedDeps)
       list(REMOVE_DUPLICATES resolvedDeps)
    endif()
    if (FIPS_CMAKE_VERBOSE)
        message("${target} Dependencies: ${resolvedDeps}")
    endif()
    # NOTE: this little hack fixes the dependency-order problem
    # when linking with the GCC toolchain
    if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
        set(resolvedDeps ${resolvedDeps} ${resolvedDeps} ${resolvedDeps})
    endif()
    target_link_libraries(${target} ${resolvedDeps})
endmacro()

#-------------------------------------------------------------------------------
#   fips_recurse_libs(input output)
#
macro(fips_recurse_libs input output)
    list(APPEND ${output} ${input})
    get_property(sub_input GLOBAL PROPERTY ${input}_libs)
    foreach(lib ${sub_input})
        fips_recurse_libs(${lib} ${output})
    endforeach()
endmacro()

#-------------------------------------------------------------------------------
#   fips_resolve_linklibs(target)
#   Recursively resolve link-libs of a target.
#
macro(fips_resolve_linklibs target)
{'fraction_non_alphanumeric': 0.3116509509349529, 'fraction_numerical': 0.0, 'mean_word_length': 1.7044079515989627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1171096', 'n_tokens_mistral': 1797, 'n_tokens_neox': 1726, 'n_words': 337}