mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
cmake: Organize targets into folders
Enabling CMake's USE_FOLDERS option and adding the FOLDER property to targets allows some IDEs to list the targets in an organized hierarchy of folders.
This commit is contained in:
@@ -15,6 +15,8 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
|||||||
# We don't support building in-tree.
|
# We don't support building in-tree.
|
||||||
include(PreventInTreeBuilds)
|
include(PreventInTreeBuilds)
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
# Prefer our bundled versions of dependencies.
|
# Prefer our bundled versions of dependencies.
|
||||||
if(DEFINED ENV{DEPS_BUILD_DIR})
|
if(DEFINED ENV{DEPS_BUILD_DIR})
|
||||||
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
|
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
|
||||||
@@ -574,6 +576,7 @@ if(BUSTED_PRG)
|
|||||||
# Useful for automated build systems, if they want to manually run the tests.
|
# Useful for automated build systems, if they want to manually run the tests.
|
||||||
add_custom_target(unittest-prereqs
|
add_custom_target(unittest-prereqs
|
||||||
DEPENDS ${UNITTEST_PREREQS})
|
DEPENDS ${UNITTEST_PREREQS})
|
||||||
|
set_target_properties(unittest-prereqs PROPERTIES FOLDER test)
|
||||||
|
|
||||||
add_custom_target(functionaltest-prereqs
|
add_custom_target(functionaltest-prereqs
|
||||||
DEPENDS ${FUNCTIONALTEST_PREREQS})
|
DEPENDS ${FUNCTIONALTEST_PREREQS})
|
||||||
@@ -596,6 +599,7 @@ if(BUSTED_PRG)
|
|||||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||||
DEPENDS ${UNITTEST_PREREQS}
|
DEPENDS ${UNITTEST_PREREQS}
|
||||||
${TEST_TARGET_ARGS})
|
${TEST_TARGET_ARGS})
|
||||||
|
set_target_properties(unittest PROPERTIES FOLDER test)
|
||||||
else()
|
else()
|
||||||
message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
|
message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
|
||||||
endif()
|
endif()
|
||||||
@@ -640,6 +644,8 @@ if(BUSTED_PRG)
|
|||||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||||
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
||||||
${TEST_TARGET_ARGS})
|
${TEST_TARGET_ARGS})
|
||||||
|
set_target_properties(functionaltest functionaltest-prereqs
|
||||||
|
PROPERTIES FOLDER test)
|
||||||
|
|
||||||
add_custom_target(benchmark
|
add_custom_target(benchmark
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
@@ -655,6 +661,7 @@ if(BUSTED_PRG)
|
|||||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||||
DEPENDS ${BENCHMARK_PREREQS}
|
DEPENDS ${BENCHMARK_PREREQS}
|
||||||
${TEST_TARGET_ARGS})
|
${TEST_TARGET_ARGS})
|
||||||
|
set_target_properties(benchmark benchmark-prereqs PROPERTIES FOLDER test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUSTED_LUA_PRG)
|
if(BUSTED_LUA_PRG)
|
||||||
@@ -672,6 +679,7 @@ if(BUSTED_LUA_PRG)
|
|||||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||||
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
||||||
${TEST_TARGET_ARGS})
|
${TEST_TARGET_ARGS})
|
||||||
|
set_target_properties(functionaltest-lua PROPERTIES FOLDER test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LUACHECK_PRG)
|
if(LUACHECK_PRG)
|
||||||
|
@@ -470,10 +470,12 @@ if(WIN32)
|
|||||||
file(WRITE ${PROJECT_BINARY_DIR}/external_blobs.cmake ${EXTERNAL_BLOBS_SCRIPT})
|
file(WRITE ${PROJECT_BINARY_DIR}/external_blobs.cmake ${EXTERNAL_BLOBS_SCRIPT})
|
||||||
add_custom_target(external_blobs
|
add_custom_target(external_blobs
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/external_blobs.cmake)
|
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/external_blobs.cmake)
|
||||||
|
set_target_properties(external_blobs PROPERTIES FOLDER deps)
|
||||||
add_dependencies(nvim_runtime_deps external_blobs)
|
add_dependencies(nvim_runtime_deps external_blobs)
|
||||||
else()
|
else()
|
||||||
add_custom_target(nvim_runtime_deps) # Stub target to avoid CMP0046.
|
add_custom_target(nvim_runtime_deps) # Stub target to avoid CMP0046.
|
||||||
endif()
|
endif()
|
||||||
|
set_target_properties(nvim_runtime_deps PROPERTIES FOLDER deps)
|
||||||
|
|
||||||
add_library(
|
add_library(
|
||||||
libnvim
|
libnvim
|
||||||
@@ -585,6 +587,7 @@ foreach(hfile ${NVIM_HEADERS})
|
|||||||
TARGET ${texe}
|
TARGET ${texe}
|
||||||
APPEND PROPERTY INCLUDE_DIRECTORIES ${LUA_PREFERRED_INCLUDE_DIRS}
|
APPEND PROPERTY INCLUDE_DIRECTORIES ${LUA_PREFERRED_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
set_target_properties(${texe} PROPERTIES FOLDER test)
|
||||||
|
|
||||||
list(FIND NO_SINGLE_CHECK_HEADERS "${relative_path}" hfile_exclude_idx)
|
list(FIND NO_SINGLE_CHECK_HEADERS "${relative_path}" hfile_exclude_idx)
|
||||||
if(${hfile_exclude_idx} EQUAL -1)
|
if(${hfile_exclude_idx} EQUAL -1)
|
||||||
|
@@ -55,6 +55,7 @@ if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG)
|
|||||||
DEPENDS ${NVIM_SOURCES})
|
DEPENDS ${NVIM_SOURCES})
|
||||||
|
|
||||||
add_custom_target(potfile DEPENDS ${NVIM_POT})
|
add_custom_target(potfile DEPENDS ${NVIM_POT})
|
||||||
|
set_target_properties(potfile PROPERTIES FOLDER po)
|
||||||
|
|
||||||
set(LANGUAGE_MO_FILES)
|
set(LANGUAGE_MO_FILES)
|
||||||
set(UPDATE_PO_TARGETS)
|
set(UPDATE_PO_TARGETS)
|
||||||
@@ -91,6 +92,7 @@ if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG)
|
|||||||
COMMENT "Checking ${name}.po"
|
COMMENT "Checking ${name}.po"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
DEPENDS ${poFile})
|
DEPENDS ${poFile})
|
||||||
|
set_target_properties(check-po-${name} PROPERTIES FOLDER po/check)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(BuildPoIconvGenericWithCharset
|
macro(BuildPoIconvGenericWithCharset
|
||||||
@@ -182,7 +184,9 @@ if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG)
|
|||||||
|
|
||||||
BuildMo(${LANGUAGE})
|
BuildMo(${LANGUAGE})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
set_target_properties(${UPDATE_PO_TARGETS} PROPERTIES FOLDER po/update)
|
||||||
|
|
||||||
add_custom_target(translations ALL DEPENDS ${LANGUAGE_MO_FILES})
|
add_custom_target(translations ALL DEPENDS ${LANGUAGE_MO_FILES})
|
||||||
add_custom_target(update-po DEPENDS ${UPDATE_PO_TARGETS})
|
add_custom_target(update-po DEPENDS ${UPDATE_PO_TARGETS})
|
||||||
|
set_target_properties(translations update-po PROPERTIES FOLDER po)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -22,3 +22,4 @@ foreach(hfile ${PRE_HEADERS})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_target(unittest-headers DEPENDS ${POST_HEADERS})
|
add_custom_target(unittest-headers DEPENDS ${POST_HEADERS})
|
||||||
|
set_target_properties(unittest-headers PROPERTIES FOLDER test)
|
||||||
|
Reference in New Issue
Block a user