<commit_before>###############################################################################
option(WRAP_ITK_USE_SYSTEM_GCCXML "Use system gccxml. If OFF, gccxml is built as an external project." OFF)

if(WRAP_ITK_USE_SYSTEM_GCCXML)
  find_package(GCCXML REQUIRED)
  set(GCCXML ${GCCXML} CACHE INTERNAL "gccxml executable.")
else()
  include(ExternalProject)
  # build gccxml as an external project
  if(WIN32)
    # windows build requires an extra step after the install. We use the test to run that step
    set(test TEST_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gccxml/bin/gccxml_vcconfig.bat)
    set(ext .exe)
  else()
    set(test )
    set(ext )
  endif()
  ExternalProject_add(GCC_XML
  CVS_REPOSITORY ":pserver:<EMAIL>:/cvsroot/GCC_XML"
  CVS_MODULE "gccxml"
#  CVS_TAG -r ITK-3-20
  UPDATE_COMMAND ""
  PREFIX gccxml
  CMAKE_ARGS
    -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
    -DCMAKE_CXX_COMPILER_ARG1:STRING=${CMAKE_CXX_COMPILER_ARG1}
    -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
    -DCMAKE_C_COMPILER_ARG1:STRING=${CMAKE_C_COMPILER_ARG1}
    -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
    -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
    -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
    -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/gccxml/
    -DBUILD_EXAMPLES:BOOL=OFF
    -DBUILD_TESTING:BOOL=OFF
  ${test}
  )
  set(GCCXML ${CMAKE_CURRENT_BINARY_DIR}/gccxml/bin/gccxml${ext} CACHE INTERNAL "gccxml executable." FORCE)
endif()

###############################################################################
# install the files requires for gccxml
if(NOT EXTERNAL_WRAP_ITK_PROJECT)
  WRAP_ITK_INSTALL(/Configuration/Languages/GccXML CMakeLists.txt)
  WRAP_ITK_INSTALL(/Configuration/Languages/GccXML gcc_xml.inc.in)
  WRAP_ITK_INSTALL(/Configuration/Languages/GccXML wrap_.cxx.in)
endif(NOT EXTERNAL_WRAP_ITK_PROJECT)


###############################################################################
# hide cable swig dir in external projects - it is safer to use the same as the
# one used to build wrapitk
if(EXTERNAL_WRAP_ITK_PROJECT)
  mark_as_advanced(GCCXML)
endif(EXTERNAL_WRAP_ITK_PROJECT)


###############################################################################
# store the current dir, so it can be reused later
set(WRAP_ITK_GCCXML_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "gccxml source dir")
set(WRAP_ITK_GCCXML_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "gccxml binary dir")


set(WRAPPER_MASTER_INDEX_OUTPUT_DIR "${PROJECT_BINARY_DIR}/Typedefs")
set(WRAPPER_SWIG_LIBRARY_OUTPUT_DIR "${PROJECT_BINARY_DIR}/SWIG")

<commit_msg>ENH: make possible to switch from system gccxml to EP in cmake gui<commit_after>###############################################################################
option(WRAP_ITK_USE_SYSTEM_GCCXML "Use system gccxml. If OFF, gccxml is built as an external project." OFF)

set(gccxml_ep ${CMAKE_CURRENT_BINARY_DIR}/gccxml/bin/gccxml)
if(WIN32)
  set(gccxml_ep "${gccxml_ep}.exe")
endif()

if(WRAP_ITK_USE_SYSTEM_GCCXML)
  # the path set for the EP build prevents find_package to do its job
  if("${GCCXML}" STREQUAL "${gccxml_ep}")
    unset(GCCXML CACHE)
  endif()
  find_package(GCCXML REQUIRED)
  set(GCCXML ${GCCXML} CACHE FILEPATH "gccxml executable." FORCE)
else()
  include(ExternalProject)
  # build gccxml as an external project
  if(WIN32)
    # windows build requires an extra step after the install. We use the test to run that step
    set(test TEST_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gccxml/bin/gccxml_vcconfig.bat)
  else()
    set(test )
  endif()
  ExternalProject_add(GCC_XML
  CVS_REPOSITORY ":pserver:<EMAIL>:/cvsroot/GCC_XML"
  CVS_MODULE "gccxml"
#  CVS_TAG -r ITK-3-20
  UPDATE_COMMAND ""
  PREFIX gccxml
  CMAKE_ARGS
    -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
    -DCMAKE_CXX_COMPILER_ARG1:STRING=${CMAKE_CXX_COMPILER_ARG1}
    -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
    -DCMAKE_C_COMPILER_ARG1:STRING=${CMAKE_C_COMPILER_ARG1}
    -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
    -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
    -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
    -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/gccxml/
    -DBUILD_EXAMPLES:BOOL=OFF
    -DBUILD_TESTING:BOOL=OFF
  ${test}
  )
  set(GCCXML ${gccxml_ep} CACHE FILEPATH "gccxml executable." FORCE)
endif()

###############################################################################
# install the files requires for gccxml
if(NOT EXTERNAL_WRAP_ITK_PROJECT)
  WRAP_ITK_INSTALL(/Configuration/Languages/GccXML CMakeLists.txt)
  WRAP_ITK_INSTALL(/Configuration/Languages/GccXML gcc_xml.inc.in)
  WRAP_ITK_INSTALL(/Configuration/Languages/GccXML wrap_.cxx.in)
endif(NOT EXTERNAL_WRAP_ITK_PROJECT)


###############################################################################
# hide cable swig dir in external projects - it is safer to use the same as the
# one used to build wrapitk
if(EXTERNAL_WRAP_ITK_PROJECT)
  mark_as_advanced(GCCXML)
endif(EXTERNAL_WRAP_ITK_PROJECT)


###############################################################################
# store the current dir, so it can be reused later
set(WRAP_ITK_GCCXML_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "gccxml source dir")
set(WRAP_ITK_GCCXML_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "gccxml binary dir")


set(WRAPPER_MASTER_INDEX_OUTPUT_DIR "${PROJECT_BINARY_DIR}/Typedefs")
set(WRAPPER_SWIG_LIBRARY_OUTPUT_DIR "${PROJECT_BINARY_DIR}/SWIG")


{'fraction_non_alphanumeric': 0.19886778670562455, 'fraction_numerical': 0.003652300949598247, 'mean_word_length': 6.813124108416548, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 38}, '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': '1880682', 'n_tokens_mistral': 2071, 'n_tokens_neox': 1900, 'n_words': 351}