<commit_before># examples/tcl/CMakeLists.txt
### Process this file with cmake to produce Makefile
###
# Copyright (C) 2006 <NAME>
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# PLplot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

set(tcl_FILES
README.tcldemos
plgrid.tcl
plot.dat
plot.tcl
r.dat
stats.log
tcldemos.tcl
)

set(tcl_STRING_INDICES
"01"
"02"
"03"
"04"
"05"
"06"
"07"
"08"
"09"
"10"
"11"
"12"
"13"
"14"
"15"
"16"
"17"
"18"
"19"
"20"
"21"
"22"
"23"
"24"
"25"
"26"
"27"
"28"
"29"
"30"
"31"
)

set(tcl_SCRIPTS)
foreach(STRING_INDEX ${tcl_STRING_INDICES})
  set(tcl_FILES ${tcl_FILES} x${STRING_INDEX}.tcl)
  set(tcl_SCRIPTS ${tcl_SCRIPTS} x${STRING_INDEX})
endforeach(STRING_INDEX ${tcl_STRING_INDICES})

install(FILES ${tcl_FILES} DESTINATION ${DATA_DIR}/examples/tcl)
install(PROGRAMS ${tcl_SCRIPTS} DESTINATION ${DATA_DIR}/examples/tcl)

# Copy file and scripts to the binary directory if different to the
# source directory. Needed for ctest, but also so the tclIndex file
# is generated in the binary tree not the source tree.
if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  set(tclIndex_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
  set(tclIndex_DEPENDS)
  foreach(file ${tcl_SCRIPTS} ${tcl_FILES})
    set(
    tclIndex_DEPENDS
    ${tclIndex_DEPENDS}
    ${CMAKE_CURRENT_BINARY_DIR}/${file}
    )
    add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file}
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
    ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR}
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
    )
  endforeach(file ${tcl_SCRIPTS} ${tcl_FILES})
  add_custom_target(tcl_examples ALL DEPENDS ${tclIndex_DEPENDS})
else(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  set(tclIndex_DEPENDS ${tcl_FILES} ${tcl_SCRIPTS})
  set(tclIndex_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS}
DEPENDS ${tclIndex_DEPENDS}
WORKING_DIRECTORY ${tclIndex_WORKING_DIRECTORY}
)

install(
FILES ${tclIndex_WORKING_DIRECTORY}/tclIndex
DESTINATION ${DATA_DIR}/examples/tcl
)

add_custom_target(tclIndex_examples_tcl ALL
  DEPENDS ${tclIndex_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
)

# Workaround CMake 2-level make recursion issue where independent
# file dependency chains that refer to the same files must have
# target dependencies between them in order to work for parallel
# builds (and possibly some visual studio builds).
if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  add_dependencies(tclIndex_examples_tcl tcl_examples)
endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

if(BUILD_TEST)
  set_property(GLOBAL PROPERTY TARGETS_examples_tcl tcl_examples 
    tclIndex_examples_tcl pltcl plplot.tcl_target
    )
endif(BUILD_TEST)<commit_msg>Generalize CMake logic so it works both for core build of examples and also for installed examples build.<commit_after># examples/tcl/CMakeLists.txt
### Process this file with cmake to produce Makefile
###
# Copyright (C) 2006 <NAME>
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# PLplot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with PLplot; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# N.B. This file is used for both the core build (which installs the examples
# and optionally [depending on BUILD_TEST} builds them) and the installed
# examples build.  The core build has BUILD_TEST OFF or ON at user option
# and CORE_BUILD always ON.  The installed examples build always has
# BUILD_TEST ON and CORE_BUILD OFF.

set(tcl_FILES
README.tcldemos
plgrid.tcl
plot.dat
plot.tcl
r.dat
stats.log
tcldemos.tcl
)

set(tcl_STRING_INDICES
"01"
"02"
"03"
"04"
"05"
"06"
"07"
"08"
"09"
"10"
"11"
"12"
"13"
"14"
"15"
"16"
"17"
"18"
"19"
"20"
"21"
"22"
"23"
"24"
"25"
"26"
"27"
"28"
"29"
"30"
"31"
)

set(tcl_SCRIPTS)
foreach(STRING_INDEX ${tcl_STRING_INDICES})
  set(tcl_FILES ${tcl_FILES} x${STRING_INDEX}.tcl)
  set(tcl_SCRIPTS ${tcl_SCRIPTS} x${STRING_INDEX})
endforeach(STRING_INDEX ${tcl_STRING_INDICES})

if(CORE_BUILD)
  # Copy file and scripts to the binary directory if different to the
  # source directory. Needed for ctest, but also so the tclIndex file
  # is generated in the binary tree not the source tree.
  set(tclIndex_DEPENDS)
  foreach(file ${tcl_SCRIPTS} ${tcl_FILES})
    add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file}
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
      ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR}
      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
      )
    list(APPEND tclIndex_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${file})
  endforeach(file ${tcl_SCRIPTS} ${tcl_FILES})
  add_custom_target(tcl_examples ALL DEPENDS ${tclIndex_DEPENDS})

  add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
    COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS}
    DEPENDS ${tclIndex_DEPENDS}
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    )
  add_custom_target(tclIndex_examples_tcl ALL
    DEPENDS ${tclIndex_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
    )

  # These two custom targets file-depend on common files so must serialize.
  add_dependencies(tclIndex_examples_tcl tcl_examples)
  install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/tclIndex
    DESTINATION ${DATA_DIR}/examples/tcl
    )

  install(FILES ${tcl_FILES} DESTINATION ${DATA_DIR}/examples/tcl)
  install(PROGRAMS ${tcl_SCRIPTS} DESTINATION ${DATA_DIR}/examples/tcl)

  install(FILES CMakeLists.txt 
    DESTINATION ${DATA_DIR}/examples/tcl
    )

else(CORE_BUILD)
  set(tclIndex_DEPENDS)
  foreach(file ${tcl_SCRIPTS} ${tcl_FILES})
    list(APPEND tclIndex_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
  endforeach(file ${tcl_SCRIPTS} ${tcl_FILES})
  add_custom_target(tcl_examples ALL DEPENDS ${tclIndex_DEPENDS})

endif(CORE_BUILD)

if(BUILD_TEST)
  if(CORE_BUILD)
    set_property(GLOBAL PROPERTY TARGETS_examples_tcl
      tcl_examples
      tclIndex_examples_tcl 
      plplottcltk${LIB_TAG}
      pltcl 
      plplot.tcl_target
      tclIndex_tcl
      )
    get_property(files_plplot.tcl_target GLOBAL PROPERTY FILES_plplot.tcl_target)
    get_property(files_tclIndex_tcl GLOBAL PROPERTY FILES_tclIndex_tcl)
    set_property(GLOBAL PROPERTY FILES_examples_tcl
      ${tclIndex_DEPENDS}
      ${CMAKE_CURRENT_BINARY_DIR}/tclIndex 
      plplottcltk${LIB_TAG}
      pltcl 
      ${files_plplot.tcl_target}
      ${files_tclIndex_tcl}
      )
  else(CORE_BUILD)
    set_property(GLOBAL PROPERTY TARGETS_examples_tcl
      tcl_examples
      plplottcltk${LIB_TAG}
      )
    set_property(GLOBAL PROPERTY FILES_examples_tcl
      ${tclIndex_DEPENDS}
      plplottcltk${LIB_TAG}
      )
  endif(CORE_BUILD)
endif(BUILD_TEST)
{'fraction_non_alphanumeric': 0.0944125717136443, 'fraction_numerical': 0.019580942878523324, 'mean_word_length': 5.192277992277992, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2238007', 'n_tokens_mistral': 3078, 'n_tokens_neox': 2903, 'n_words': 744}