[CMake] getting all the function names
Andrea Crotti
andrea.crotti.0 at gmail.com
Thu Oct 20 10:51:07 EDT 2011
Thanks a lot the completion works quite nicely...
Anyway something brutal like this below already would work if someone
is using auto-complete.
The problem is that variables and functions depend on the version, in theory
is possible to get the list of completions with a shell script but
- it might be time-consuming
- and OS-dependent
Any thoughts about this?
After this first attempt it would be good to show the documentation, and
then
I would be already quite satisfied...
(require 'cmake-mode)
(require 'auto-complete)
(add-hook 'cmake-mode-hook
'(lambda ()
(add-to-list 'ac-sources 'cmake-command-list)
(add-to-list 'ac-sources 'cmake-variable-list)))
;; cmake version 2.8.6
;; see how to generate for other things as well
(setq cmake-command-list
'("add_custom_command" "add_custom_target" "add_definitions"
"add_dependencies" "add_executable" "add_library" "add_subdirectory"
"add_test" "aux_source_directory" "break" "build_command"
"cmake_minimum_required" "cmake_policy" "configure_file"
"create_test_sourcelist" "define_property" "else" "elseif"
"enable_language" "enable_testing" "endforeach" "endfunction" "endif"
"endmacro" "endwhile" "execute_process" "export" "file" "find_file"
"find_library" "find_package" "find_path" "find_program" "fltk_wrap_ui"
"foreach" "function" "get_cmake_property" "get_directory_property"
"get_filename_component" "get_property" "get_source_file_property"
"get_target_property" "get_test_property" "if" "include"
"include_directories" "include_external_msproject"
"include_regular_expression" "install" "link_directories" "list"
"load_cache" "load_command" "macro" "mark_as_advanced" "math" "message"
"option" "project" "qt_wrap_cpp" "qt_wrap_ui" "remove_definitions"
"return" "separate_arguments" "set" "set_directory_properties"
"set_property" "set_source_files_properties" "set_target_properties"
"set_tests_properties" "site_name" "source_group" "string"
"target_link_libraries" "try_compile" "try_run" "unset" "variable_watch"
"while" "build_name" "exec_program" "export_library_dependencies"
"install_files" "install_programs" "install_targets" "link_libraries"
"make_directory" "output_required_files" "remove" "subdir_depends"
"subdirs" "use_mangled_mesa" "utility_source" "variable_requires"
"write_file"))
;; show the documentation of variables too
(setq cmake-variable-list
'("CMAKE_AR" "CMAKE_ARGC" "CMAKE_ARGV0" "CMAKE_BINARY_DIR"
"CMAKE_BUILD_TOOL" "CMAKE_CACHEFILE_DIR" "CMAKE_CACHE_MAJOR_VERSION"
"CMAKE_CACHE_MINOR_VERSION" "CMAKE_CACHE_PATCH_VERSION"
"CMAKE_CFG_INTDIR" "CMAKE_COMMAND" "CMAKE_CROSSCOMPILING"
"CMAKE_CTEST_COMMAND" "CMAKE_CURRENT_BINARY_DIR"
"CMAKE_CURRENT_LIST_DIR" "CMAKE_CURRENT_LIST_FILE"
"CMAKE_CURRENT_LIST_LINE" "CMAKE_CURRENT_SOURCE_DIR" "CMAKE_DL_LIBS"
"CMAKE_EDIT_COMMAND" "CMAKE_EXECUTABLE_SUFFIX" "CMAKE_EXTRA_GENERATOR"
"CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES" "CMAKE_GENERATOR"
"CMAKE_HOME_DIRECTORY" "CMAKE_IMPORT_LIBRARY_PREFIX"
"CMAKE_IMPORT_LIBRARY_SUFFIX" "CMAKE_LINK_LIBRARY_SUFFIX"
"CMAKE_MAJOR_VERSION" "CMAKE_MAKE_PROGRAM" "CMAKE_MINOR_VERSION"
"CMAKE_PARENT_LIST_FILE" "CMAKE_PATCH_VERSION" "CMAKE_PROJECT_NAME"
"CMAKE_RANLIB" "CMAKE_ROOT" "CMAKE_SCRIPT_MODE_FILE"
"CMAKE_SHARED_LIBRARY_PREFIX" "CMAKE_SHARED_LIBRARY_SUFFIX"
"CMAKE_SHARED_MODULE_PREFIX" "CMAKE_SHARED_MODULE_SUFFIX"
"CMAKE_SIZEOF_VOID_P" "CMAKE_SKIP_RPATH" "CMAKE_SOURCE_DIR"
"CMAKE_STANDARD_LIBRARIES" "CMAKE_STATIC_LIBRARY_PREFIX"
"CMAKE_STATIC_LIBRARY_SUFFIX" "CMAKE_TWEAK_VERSION"
"CMAKE_USING_VC_FREE_TOOLS" "CMAKE_VERBOSE_MAKEFILE" "CMAKE_VERSION"
"PROJECT_BINARY_DIR" "PROJECT_NAME" "PROJECT_SOURCE_DIR" "[Project
name]_BINARY_DIR" "[Project name]_SOURCE_DIR" "BUILD_SHARED_LIBS"
"CMAKE_BACKWARDS_COMPATIBILITY" "CMAKE_BUILD_TYPE"
"CMAKE_COLOR_MAKEFILE" "CMAKE_CONFIGURATION_TYPES"
"CMAKE_DISABLE_FIND_PACKAGE_<PackageName>" "CMAKE_FIND_LIBRARY_PREFIXES"
"CMAKE_FIND_LIBRARY_SUFFIXES" "CMAKE_IGNORE_PATH" "CMAKE_INCLUDE_PATH"
"CMAKE_INSTALL_PREFIX" "CMAKE_LIBRARY_PATH" "CMAKE_MFC_FLAG"
"CMAKE_MODULE_PATH" "CMAKE_NOT_USING_CONFIG_FLAGS"
"CMAKE_POLICY_DEFAULT_CMP<NNNN>" "CMAKE_PREFIX_PATH"
"CMAKE_PROGRAM_PATH" "CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"
"CMAKE_SYSTEM_IGNORE_PATH" "CMAKE_SYSTEM_INCLUDE_PATH"
"CMAKE_SYSTEM_LIBRARY_PATH" "CMAKE_SYSTEM_PREFIX_PATH"
"CMAKE_SYSTEM_PROGRAM_PATH" "CMAKE_USER_MAKE_RULES_OVERRIDE" "APPLE"
"BORLAND" "CMAKE_CL_64" "CMAKE_COMPILER_2005" "CMAKE_HOST_APPLE"
"CMAKE_HOST_SYSTEM" "CMAKE_HOST_SYSTEM_NAME"
"CMAKE_HOST_SYSTEM_PROCESSOR" "CMAKE_HOST_SYSTEM_VERSION"
"CMAKE_HOST_UNIX" "CMAKE_HOST_WIN32" "CMAKE_LIBRARY_ARCHITECTURE"
"CMAKE_LIBRARY_ARCHITECTURE_REGEX" "CMAKE_OBJECT_PATH_MAX"
"CMAKE_SYSTEM" "CMAKE_SYSTEM_NAME" "CMAKE_SYSTEM_PROCESSOR"
"CMAKE_SYSTEM_VERSION" "CYGWIN" "MSVC" "MSVC80" "MSVC_IDE"
"MSVC_VERSION" "UNIX" "WIN32" "XCODE_VERSION" "CMAKE_<CONFIG>_POSTFIX"
"CMAKE_ARCHIVE_OUTPUT_DIRECTORY" "CMAKE_AUTOMOC"
"CMAKE_BUILD_WITH_INSTALL_RPATH" "CMAKE_DEBUG_POSTFIX"
"CMAKE_EXE_LINKER_FLAGS" "CMAKE_EXE_LINKER_FLAGS_[CMAKE_BUILD_TYPE]"
"CMAKE_Fortran_FORMAT" "CMAKE_Fortran_MODULE_DIRECTORY"
"CMAKE_INCLUDE_CURRENT_DIR" "CMAKE_INSTALL_NAME_DIR"
"CMAKE_INSTALL_RPATH" "CMAKE_INSTALL_RPATH_USE_LINK_PATH"
"CMAKE_LIBRARY_OUTPUT_DIRECTORY" "CMAKE_LIBRARY_PATH_FLAG"
"CMAKE_LINK_DEF_FILE_FLAG " "CMAKE_LINK_LIBRARY_FILE_FLAG"
"CMAKE_LINK_LIBRARY_FLAG" "CMAKE_NO_BUILTIN_CHRPATH"
"CMAKE_RUNTIME_OUTPUT_DIRECTORY" "CMAKE_SKIP_BUILD_RPATH"
"CMAKE_TRY_COMPILE_CONFIGURATION" "CMAKE_USE_RELATIVE_PATHS"
"EXECUTABLE_OUTPUT_PATH" "LIBRARY_OUTPUT_PATH"
"CMAKE_<LANG>_ARCHIVE_APPEND" "CMAKE_<LANG>_ARCHIVE_CREATE"
"CMAKE_<LANG>_ARCHIVE_FINISH" "CMAKE_<LANG>_COMPILER"
"CMAKE_<LANG>_COMPILER_ABI" "CMAKE_<LANG>_COMPILER_ID"
"CMAKE_<LANG>_COMPILER_LOADED" "CMAKE_<LANG>_COMPILE_OBJECT"
"CMAKE_<LANG>_CREATE_SHARED_LIBRARY" "CMAKE_<LANG>_CREATE_SHARED_MODULE"
"CMAKE_<LANG>_CREATE_STATIC_LIBRARY" "CMAKE_<LANG>_FLAGS_DEBUG"
"CMAKE_<LANG>_FLAGS_MINSIZEREL" "CMAKE_<LANG>_FLAGS_RELEASE"
"CMAKE_<LANG>_FLAGS_RELWITHDEBINFO" "CMAKE_<LANG>_IGNORE_EXTENSIONS"
"CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES"
"CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES"
"CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES"
"CMAKE_<LANG>_LIBRARY_ARCHITECTURE" "CMAKE_<LANG>_LINKER_PREFERENCE"
"CMAKE_<LANG>_LINKER_PREFERENCE_PROPAGATES"
"CMAKE_<LANG>_LINK_EXECUTABLE " "CMAKE_<LANG>_OUTPUT_EXTENSION"
"CMAKE_<LANG>_PLATFORM_ID" "CMAKE_<LANG>_SIZEOF_DATA_PTR"
"CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS" "CMAKE_COMPILER_IS_GNU<LANG>"
"CMAKE_Fortran_MODDIR_DEFAULT" "CMAKE_Fortran_MODDIR_FLAG"
"CMAKE_Fortran_MODOUT_FLAG" "CMAKE_INTERNAL_PLATFORM_ABI"
"CMAKE_USER_MAKE_RULES_OVERRIDE_<LANG>"))
More information about the CMake
mailing list