Improve IDE grouping in the CMake build

This adds intelligent groups and hides unused files when generating
IDE projects (Xcode, CLion, etc) in the CMake build.
This commit is contained in:
ridiculousfish 2017-10-04 21:40:58 -07:00
parent b49b2f5a84
commit 31348bee46
4 changed files with 33 additions and 2 deletions

View file

@ -99,3 +99,7 @@ ADD_CUSTOM_COMMAND(OUTPUT share/man/
DEPENDS ${FBVF} ${HELP_SRC} ${CMAKE_CURRENT_BINARY_DIR}/lexicon_filter)
ADD_CUSTOM_TARGET(BUILD_MANUALS ALL DEPENDS share/man/)
# Group docs targets into a DocsTargets folder
SET_PROPERTY(TARGET doc BUILD_MANUALS
PROPERTY FOLDER cmake/DocTargets)

View file

@ -175,7 +175,12 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/share/man/
# done;
INSTALL(FILES ${MANUALS} DESTINATION ${mandir}/man1/)
# $v $(INSTALL) -m 644 share/lynx.lss $(DESTDIR)$(datadir)/fish/
INSTALL(FILES share/lynx.lss DESTINATION ${rel_datadir}/fish/)
# Group install targets into a InstallTargets folder
SET_PROPERTY(TARGET CHECK-FISH-BUILD-VERSION-FILE build_fish_pc
test_invocation test_fishscript
test_prep tests_buildroot_target
build_lexicon_filter
PROPERTY FOLDER cmake/InstallTargets)

View file

@ -102,3 +102,10 @@ ADD_CUSTOM_TARGET(test_fishscript
ADD_CUSTOM_TARGET(test_high_level
DEPENDS test_invocation test_fishscript)
ADD_DEPENDENCIES(test test_high_level)
# Group test targets into a TestTargets folder
SET_PROPERTY(TARGET test test_low_level test_high_level tests_dir
test_invocation test_fishscript test_prep
tests_buildroot_target build_lexicon_filter
symlink_functions
PROPERTY FOLDER cmake/TestTargets)

View file

@ -4,6 +4,17 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
# We are C++11.
SET(CMAKE_CXX_STANDARD 11)
# Hide the CMake Rules directories in Xcode projects.
SOURCE_GROUP("CMake Rules" REGULAR_EXPRESSION "^$")
# Put source and header files at top level under targets.
SOURCE_GROUP("Source Files" REGULAR_EXPRESSION "^$")
SOURCE_GROUP("Header Files" REGULAR_EXPRESSION "^$")
SOURCE_GROUP("Builtins" REGULAR_EXPRESSION "builtin_.*")
# Support folders.
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
# All objects that the system needs to build fish, except fish.cpp
SET(FISH_SRCS
src/autoload.cpp src/builtin.cpp src/builtin_bg.cpp src/builtin_bind.cpp
@ -30,6 +41,9 @@ SET(FISH_SRCS
src/wgetopt.cpp src/wildcard.cpp src/wutil.cpp
)
# Header files are just globbed.
FILE(GLOB FISH_HEADERS src/*.h)
# Set up the version target.
# This creates the file FISH-BUILD-VERSION-FILE which is only modified if necessary.
ADD_CUSTOM_COMMAND(OUTPUT "FISH-BUILD-VERSION-FILE"
@ -74,6 +88,7 @@ ENDFUNCTION(FISH_LINK_DEPS)
# Define libfish.a.
ADD_LIBRARY(fishlib STATIC ${FISH_SRCS})
TARGET_SOURCES(fishlib PRIVATE ${FISH_HEADERS})
TARGET_LINK_LIBRARIES(fishlib
${CURSES_LIBRARIES} Threads::Threads
${PCRE2_LIB} muparser)