Skip to content
Permalink
Browse files

add script to modernize cmake commands

  • Loading branch information
3nids committed Nov 12, 2020
1 parent 90ea88c commit 61a5424f6bb9e8f9c2796395e77fcb00295df81c
Showing with 113 additions and 0 deletions.
  1. +113 −0 scripts/modernize-cmake.sh
@@ -0,0 +1,113 @@
#!/usr/bin/env bash

CMAKE_CMDS=$(cat <<EOF | tr '\n' '|'
BREAK
CMAKE_HOST_SYSTEM_INFORMATION
CMAKE_LANGUAGE
CMAKE_MINIMUM_REQUIRED
CMAKE_PARSE_ARGUMENTS
CMAKE_POLICY
CONFIGURE_FILE
CONTINUE
ENDFOREACH
ENDFUNCTION
ENDMACRO
ENDWHILE
EXECUTE_PROCESS
FILE
FIND_FILE
FIND_LIBRARY
FIND_PACKAGE
FIND_PATH
FIND_PROGRAM
FOREACH
FUNCTION
GET_CMAKE_PROPERTY
GET_DIRECTORY_PROPERTY
GET_FILENAME_COMPONENT
GET_PROPERTY
IF
INCLUDE
INCLUDE_GUARD
LIST
MACRO
MARK_AS_ADVANCED
MATH
MESSAGE
OPTION
RETURN
SEPARATE_ARGUMENTS
SET
SET_DIRECTORY_PROPERTIES
SET_PROPERTY
SITE_NAME
STRING
UNSET
VARIABLE_WATCH
WHILE
ADD_COMPILE_DEFINITIONS
ADD_COMPILE_OPTIONS
ADD_CUSTOM_COMMAND
ADD_CUSTOM_TARGET
ADD_DEFINITIONS
ADD_DEPENDENCIES
ADD_EXECUTABLE
ADD_LIBRARY
ADD_LINK_OPTIONS
ADD_SUBDIRECTORY
ADD_TEST
AUX_SOURCE_DIRECTORY
BUILD_COMMAND
CREATE_TEST_SOURCELIST
DEFINE_PROPERTY
ENABLE_LANGUAGE
ENABLE_TESTING
EXPORT
FLTK_WRAP_UI
GET_SOURCE_FILE_PROPERTY
GET_TARGET_PROPERTY
GET_TEST_PROPERTY
INCLUDE_DIRECTORIES
INCLUDE_EXTERNAL_MSPROJECT
INCLUDE_REGULAR_EXPRESSION
INSTALL
LINK_DIRECTORIES
LINK_LIBRARIES
LOAD_CACHE
PROJECT
REMOVE_DEFINITIONS
SET_SOURCE_FILES_PROPERTIES
SET_TARGET_PROPERTIES
SET_TESTS_PROPERTIES
SOURCE_GROUP
TARGET_COMPILE_DEFINITIONS
TARGET_COMPILE_FEATURES
TARGET_COMPILE_OPTIONS
TARGET_INCLUDE_DIRECTORIES
TARGET_LINK_DIRECTORIES
TARGET_LINK_LIBRARIES
TARGET_LINK_OPTIONS
TARGET_PRECOMPILE_HEADERS
TARGET_SOURCES
TRY_COMPILE
TRY_RUN
CTEST_BUILD
CTEST_CONFIGURE
CTEST_COVERAGE
CTEST_EMPTY_BINARY_DIRECTORY
CTEST_MEMCHECK
CTEST_READ_CUSTOM_FILES
CTEST_RUN_SCRIPT
CTEST_SLEEP
CTEST_START
CTEST_SUBMIT
CTEST_TEST
CTEST_UPDATE
CTEST_UPLOAD
EOF
)

echo $CMAKE_CMDS

find . -iname CMakeLists.txt | xargs \
gsed -i -r "s/\b((${CMAKE_CMDS}) *\()/\L\1/g; s/(ELSE|ENDIF|ELSEIF) *\(.*\)/\L\1()/"

0 comments on commit 61a5424

Please sign in to comment.
You can’t perform that action at this time.