mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Use lowercase CMake function names
This is a best practice to distinguish them from variables.
This commit is contained in:
parent
f9f5775ccc
commit
f117addf7c
11 changed files with 419 additions and 419 deletions
146
CMakeLists.txt
146
CMakeLists.txt
|
@ -1,33 +1,33 @@
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
IF(POLICY CMP0066)
|
if(POLICY CMP0066)
|
||||||
CMAKE_POLICY(SET CMP0066 OLD)
|
cmake_policy(SET CMP0066 OLD)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(POLICY CMP0067)
|
if(POLICY CMP0067)
|
||||||
CMAKE_POLICY(SET CMP0067 NEW)
|
cmake_policy(SET CMP0067 NEW)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
INCLUDE(cmake/Mac.cmake)
|
include(cmake/Mac.cmake)
|
||||||
|
|
||||||
PROJECT(fish)
|
project(fish)
|
||||||
|
|
||||||
# We are C++11.
|
# We are C++11.
|
||||||
SET(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
SET(DEFAULT_BUILD_TYPE "RelWithDebInfo")
|
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
|
||||||
|
|
||||||
# Use the default flags (#6296) but remove -DNDEBUG so that asserts remain enabled.
|
# Use the default flags (#6296) but remove -DNDEBUG so that asserts remain enabled.
|
||||||
STRING(REPLACE "-DNDEBUG" ""
|
string(REPLACE "-DNDEBUG" ""
|
||||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
|
|
||||||
STRING(REPLACE "-DNDEBUG" ""
|
string(REPLACE "-DNDEBUG" ""
|
||||||
CMAKE_CXX_FLAGS_RELEASE
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
"${CMAKE_CXX_FLAGS_RELEASE}")
|
"${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
|
||||||
IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
MESSAGE(STATUS "Setting build type to default '${DEFAULT_BUILD_TYPE}'")
|
message(STATUS "Setting build type to default '${DEFAULT_BUILD_TYPE}'")
|
||||||
SET(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
|
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support.
|
# Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support.
|
||||||
# Rationale in https://github.com/ninja-build/ninja/issues/814
|
# Rationale in https://github.com/ninja-build/ninja/issues/814
|
||||||
|
@ -53,11 +53,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra \
|
||||||
")
|
")
|
||||||
|
|
||||||
# Disable exception handling.
|
# Disable exception handling.
|
||||||
ADD_COMPILE_OPTIONS(-fno-exceptions)
|
add_compile_options(-fno-exceptions)
|
||||||
|
|
||||||
# Prefer the gold linker because it doesn't emit useless warnings about sys_nerr and _sys_errlist.
|
# Prefer the gold linker because it doesn't emit useless warnings about sys_nerr and _sys_errlist.
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
||||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||||
if ("${LD_VERSION}" MATCHES "GNU gold")
|
if ("${LD_VERSION}" MATCHES "GNU gold")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
|
@ -65,37 +65,37 @@ if (UNIX AND NOT APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Hide the CMake Rules directories in Xcode projects.
|
# Hide the CMake Rules directories in Xcode projects.
|
||||||
SOURCE_GROUP("CMake Rules" REGULAR_EXPRESSION "^$")
|
source_group("CMake Rules" REGULAR_EXPRESSION "^$")
|
||||||
|
|
||||||
# Put source and header files at top level under targets.
|
# Put source and header files at top level under targets.
|
||||||
SOURCE_GROUP("Source Files" REGULAR_EXPRESSION "^$")
|
source_group("Source Files" REGULAR_EXPRESSION "^$")
|
||||||
SOURCE_GROUP("Header Files" REGULAR_EXPRESSION "^$")
|
source_group("Header Files" REGULAR_EXPRESSION "^$")
|
||||||
SOURCE_GROUP("Builtins" REGULAR_EXPRESSION "builtin_.*")
|
source_group("Builtins" REGULAR_EXPRESSION "builtin_.*")
|
||||||
|
|
||||||
# Support folders.
|
# Support folders.
|
||||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
# Work around issue where archive-built libs go in the wrong place.
|
# Work around issue where archive-built libs go in the wrong place.
|
||||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||||
|
|
||||||
IF(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||||
SET(FISH_IN_TREE_BUILD TRUE)
|
set(FISH_IN_TREE_BUILD TRUE)
|
||||||
ELSE()
|
else()
|
||||||
SET(FISH_IN_TREE_BUILD FALSE)
|
set(FISH_IN_TREE_BUILD FALSE)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# NetBSD does weird things with finding libraries,
|
# NetBSD does weird things with finding libraries,
|
||||||
# making the tests fail by failing to find pcre.
|
# making the tests fail by failing to find pcre.
|
||||||
#
|
#
|
||||||
# Keep the rpath used to build.
|
# Keep the rpath used to build.
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
|
if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
|
||||||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# All objects that the system needs to build fish, except fish.cpp
|
# All objects that the system needs to build fish, except fish.cpp
|
||||||
SET(FISH_SRCS
|
set(FISH_SRCS
|
||||||
src/autoload.cpp src/builtin.cpp src/builtin_bg.cpp src/builtin_bind.cpp
|
src/autoload.cpp src/builtin.cpp src/builtin_bg.cpp src/builtin_bind.cpp
|
||||||
src/builtin_block.cpp src/builtin_builtin.cpp src/builtin_cd.cpp
|
src/builtin_block.cpp src/builtin_builtin.cpp src/builtin_cd.cpp
|
||||||
src/builtin_command.cpp src/builtin_commandline.cpp
|
src/builtin_command.cpp src/builtin_commandline.cpp
|
||||||
|
@ -124,18 +124,18 @@ SET(FISH_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
# Header files are just globbed.
|
# Header files are just globbed.
|
||||||
FILE(GLOB FISH_HEADERS src/*.h)
|
file(GLOB FISH_HEADERS src/*.h)
|
||||||
|
|
||||||
# Set up config.h
|
# Set up config.h
|
||||||
INCLUDE(cmake/ConfigureChecks.cmake)
|
include(cmake/ConfigureChecks.cmake)
|
||||||
INCLUDE(cmake/gettext.cmake)
|
include(cmake/gettext.cmake)
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config_cmake.h.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config_cmake.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
# Set up standard directories.
|
# Set up standard directories.
|
||||||
INCLUDE(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
ADD_DEFINITIONS(-D_UNICODE=1
|
add_definitions(-D_UNICODE=1
|
||||||
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
|
-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
|
||||||
-DPREFIX=L"${CMAKE_INSTALL_PREFIX}"
|
-DPREFIX=L"${CMAKE_INSTALL_PREFIX}"
|
||||||
-DDATADIR=L"${CMAKE_INSTALL_FULL_DATADIR}"
|
-DDATADIR=L"${CMAKE_INSTALL_FULL_DATADIR}"
|
||||||
|
@ -145,85 +145,85 @@ ADD_DEFINITIONS(-D_UNICODE=1
|
||||||
|
|
||||||
# Set up the machinery around FISH-BUILD-VERSION-FILE
|
# Set up the machinery around FISH-BUILD-VERSION-FILE
|
||||||
# This defines the FBVF variable.
|
# This defines the FBVF variable.
|
||||||
INCLUDE(Version)
|
include(Version)
|
||||||
|
|
||||||
# Let fish pick up when we're running out of the build directory without installing
|
# Let fish pick up when we're running out of the build directory without installing
|
||||||
GET_FILENAME_COMPONENT(REAL_CMAKE_BINARY_DIR "${CMAKE_BINARY_DIR}" REALPATH)
|
get_filename_component(REAL_CMAKE_BINARY_DIR "${CMAKE_BINARY_DIR}" REALPATH)
|
||||||
GET_FILENAME_COMPONENT(REAL_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}" REALPATH)
|
get_filename_component(REAL_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}" REALPATH)
|
||||||
ADD_DEFINITIONS(-DCMAKE_BINARY_DIR="${REAL_CMAKE_BINARY_DIR}")
|
add_definitions(-DCMAKE_BINARY_DIR="${REAL_CMAKE_BINARY_DIR}")
|
||||||
ADD_DEFINITIONS(-DCMAKE_SOURCE_DIR="${REAL_CMAKE_SOURCE_DIR}")
|
add_definitions(-DCMAKE_SOURCE_DIR="${REAL_CMAKE_SOURCE_DIR}")
|
||||||
|
|
||||||
# Teach fish_version.o to rebuild when FBVF changes.
|
# Teach fish_version.o to rebuild when FBVF changes.
|
||||||
# The standard C++ include detection machinery misses this.
|
# The standard C++ include detection machinery misses this.
|
||||||
SET_SOURCE_FILES_PROPERTIES(src/fish_version.cpp
|
set_source_files_properties(src/fish_version.cpp
|
||||||
PROPERTIES OBJECT_DEPENDS
|
PROPERTIES OBJECT_DEPENDS
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${FBVF})
|
${CMAKE_CURRENT_BINARY_DIR}/${FBVF})
|
||||||
|
|
||||||
# Enable thread-safe errno on Solaris (#5611)
|
# Enable thread-safe errno on Solaris (#5611)
|
||||||
ADD_DEFINITIONS(-D_REENTRANT)
|
add_definitions(-D_REENTRANT)
|
||||||
|
|
||||||
# Set up PCRE2
|
# Set up PCRE2
|
||||||
INCLUDE(cmake/PCRE2.cmake)
|
include(cmake/PCRE2.cmake)
|
||||||
|
|
||||||
# Define a function to link dependencies.
|
# Define a function to link dependencies.
|
||||||
FUNCTION(FISH_LINK_DEPS_AND_SIGN target)
|
function(FISH_LINK_DEPS_AND_SIGN target)
|
||||||
TARGET_LINK_LIBRARIES(${target} fishlib)
|
target_link_libraries(${target} fishlib)
|
||||||
CODESIGN_ON_MAC(${target})
|
codesign_on_mac(${target})
|
||||||
ENDFUNCTION(FISH_LINK_DEPS_AND_SIGN)
|
endfunction(FISH_LINK_DEPS_AND_SIGN)
|
||||||
|
|
||||||
# Define libfish.a.
|
# Define libfish.a.
|
||||||
ADD_LIBRARY(fishlib STATIC ${FISH_SRCS})
|
add_library(fishlib STATIC ${FISH_SRCS})
|
||||||
TARGET_SOURCES(fishlib PRIVATE ${FISH_HEADERS})
|
target_sources(fishlib PRIVATE ${FISH_HEADERS})
|
||||||
TARGET_LINK_LIBRARIES(fishlib
|
target_link_libraries(fishlib
|
||||||
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
|
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
|
||||||
${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY})
|
${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY})
|
||||||
|
|
||||||
# Define fish.
|
# Define fish.
|
||||||
ADD_EXECUTABLE(fish src/fish.cpp)
|
add_executable(fish src/fish.cpp)
|
||||||
FISH_LINK_DEPS_AND_SIGN(fish)
|
fish_link_deps_and_sign(fish)
|
||||||
|
|
||||||
# Define fish_indent.
|
# Define fish_indent.
|
||||||
ADD_EXECUTABLE(fish_indent
|
add_executable(fish_indent
|
||||||
src/fish_indent.cpp src/print_help.cpp)
|
src/fish_indent.cpp src/print_help.cpp)
|
||||||
FISH_LINK_DEPS_AND_SIGN(fish_indent)
|
fish_link_deps_and_sign(fish_indent)
|
||||||
|
|
||||||
# Define fish_key_reader.
|
# Define fish_key_reader.
|
||||||
ADD_EXECUTABLE(fish_key_reader
|
add_executable(fish_key_reader
|
||||||
src/fish_key_reader.cpp src/print_help.cpp)
|
src/fish_key_reader.cpp src/print_help.cpp)
|
||||||
FISH_LINK_DEPS_AND_SIGN(fish_key_reader)
|
fish_link_deps_and_sign(fish_key_reader)
|
||||||
|
|
||||||
# Set up the docs.
|
# Set up the docs.
|
||||||
INCLUDE(cmake/Docs.cmake)
|
include(cmake/Docs.cmake)
|
||||||
|
|
||||||
# A helper for running tests.
|
# A helper for running tests.
|
||||||
ADD_EXECUTABLE(fish_test_helper src/fish_test_helper.cpp)
|
add_executable(fish_test_helper src/fish_test_helper.cpp)
|
||||||
|
|
||||||
# Set up tests.
|
# Set up tests.
|
||||||
INCLUDE(cmake/Tests.cmake)
|
include(cmake/Tests.cmake)
|
||||||
|
|
||||||
# Benchmarking support.
|
# Benchmarking support.
|
||||||
INCLUDE(cmake/Benchmark.cmake)
|
include(cmake/Benchmark.cmake)
|
||||||
|
|
||||||
# Set up install.
|
# Set up install.
|
||||||
INCLUDE(cmake/Install.cmake)
|
include(cmake/Install.cmake)
|
||||||
|
|
||||||
# Mac app.
|
# Mac app.
|
||||||
INCLUDE(cmake/MacApp.cmake)
|
include(cmake/MacApp.cmake)
|
||||||
|
|
||||||
# Lint targets
|
# Lint targets
|
||||||
# This could be implemented as target properties, but the script has the useful feature of only
|
# This could be implemented as target properties, but the script has the useful feature of only
|
||||||
# checking the currently-staged commands
|
# checking the currently-staged commands
|
||||||
# The generator expressions below rebuild the command line for the fishlib targets
|
# The generator expressions below rebuild the command line for the fishlib targets
|
||||||
# CMake does not support the "iquote" flag - https://gitlab.kitware.com/cmake/cmake/issues/15491
|
# CMake does not support the "iquote" flag - https://gitlab.kitware.com/cmake/cmake/issues/15491
|
||||||
SET(LINT_ARGS "-D$<JOIN:$<TARGET_PROPERTY:fishlib,COMPILE_DEFINITIONS>, -D>" "-I$<JOIN:$<TARGET_PROPERTY:fishlib,INCLUDE_DIRECTORIES>, -I>")
|
set(LINT_ARGS "-D$<JOIN:$<TARGET_PROPERTY:fishlib,COMPILE_DEFINITIONS>, -D>" "-I$<JOIN:$<TARGET_PROPERTY:fishlib,INCLUDE_DIRECTORIES>, -I>")
|
||||||
ADD_CUSTOM_TARGET(lint
|
add_custom_target(lint
|
||||||
COMMAND build_tools/lint.fish -- ${LINT_ARGS}
|
COMMAND build_tools/lint.fish -- ${LINT_ARGS}
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
)
|
)
|
||||||
ADD_CUSTOM_TARGET(lint-all
|
add_custom_target(lint-all
|
||||||
COMMAND build_tools/lint.fish --all -- ${LINT_ARGS}
|
COMMAND build_tools/lint.fish --all -- ${LINT_ARGS}
|
||||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE(FeatureSummary)
|
include(FeatureSummary)
|
||||||
FEATURE_SUMMARY(WHAT ALL)
|
feature_summary(WHAT ALL)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Support for benchmarking fish.
|
# Support for benchmarking fish.
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(benchmark
|
add_custom_target(benchmark
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/benchmarks/driver.sh $<TARGET_FILE:fish>
|
COMMAND ${CMAKE_SOURCE_DIR}/benchmarks/driver.sh $<TARGET_FILE:fish>
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,153 +3,153 @@
|
||||||
# and CMAKE_REQUIRED_INCLUDES
|
# and CMAKE_REQUIRED_INCLUDES
|
||||||
# `wcstod_l` is a GNU-extension, sometimes hidden behind GNU-related defines.
|
# `wcstod_l` is a GNU-extension, sometimes hidden behind GNU-related defines.
|
||||||
# This is the case for at least Cygwin and Newlib.
|
# This is the case for at least Cygwin and Newlib.
|
||||||
LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1)
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1)
|
||||||
|
|
||||||
IF(APPLE)
|
if(APPLE)
|
||||||
INCLUDE(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
CHECK_CXX_COMPILER_FLAG("-Werror=unguarded-availability" REQUIRES_UNGUARDED_AVAILABILITY)
|
check_cxx_compiler_flag("-Werror=unguarded-availability" REQUIRES_UNGUARDED_AVAILABILITY)
|
||||||
IF(REQUIRES_UNGUARDED_AVAILABILITY)
|
if(REQUIRES_UNGUARDED_AVAILABILITY)
|
||||||
LIST(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Werror=unguarded-availability")
|
list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Werror=unguarded-availability")
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Try using CMake's own logic to locate curses/ncurses
|
# Try using CMake's own logic to locate curses/ncurses
|
||||||
FIND_PACKAGE(Curses)
|
find_package(Curses)
|
||||||
IF(NOT ${CURSES_FOUND})
|
if(NOT ${CURSES_FOUND})
|
||||||
# CMake has trouble finding platform-specific system libraries
|
# CMake has trouble finding platform-specific system libraries
|
||||||
# installed to multiarch paths (e.g. /usr/lib/x86_64-linux-gnu)
|
# installed to multiarch paths (e.g. /usr/lib/x86_64-linux-gnu)
|
||||||
# if not symlinked or passed in as a manual define.
|
# if not symlinked or passed in as a manual define.
|
||||||
MESSAGE("Falling back to pkg-config for (n)curses detection")
|
message("Falling back to pkg-config for (n)curses detection")
|
||||||
INCLUDE(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
PKG_SEARCH_MODULE(CURSES REQUIRED ncurses curses)
|
pkg_search_module(CURSES REQUIRED ncurses curses)
|
||||||
SET(CURSES_CURSES_LIBRARY ${CURSES_LIBRARIES})
|
set(CURSES_CURSES_LIBRARY ${CURSES_LIBRARIES})
|
||||||
SET(CURSES_LIBRARY ${CURSES_LIBRARIES})
|
set(CURSES_LIBRARY ${CURSES_LIBRARIES})
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Get threads.
|
# Get threads.
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
# FindThreads < 3.4.0 doesn't work for C++-only projects
|
# FindThreads < 3.4.0 doesn't work for C++-only projects
|
||||||
IF(CMAKE_VERSION VERSION_LESS 3.4.0)
|
if(CMAKE_VERSION VERSION_LESS 3.4.0)
|
||||||
ENABLE_LANGUAGE(C)
|
enable_language(C)
|
||||||
ENDIF()
|
endif()
|
||||||
FIND_PACKAGE(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# Detect WSL. Does not match against native Windows/WIN32.
|
# Detect WSL. Does not match against native Windows/WIN32.
|
||||||
if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-Microsoft")
|
if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-Microsoft")
|
||||||
SET(WSL 1)
|
set(WSL 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set up the config.h file.
|
# Set up the config.h file.
|
||||||
SET(PACKAGE_NAME "fish")
|
set(PACKAGE_NAME "fish")
|
||||||
SET(PACKAGE_TARNAME "fish")
|
set(PACKAGE_TARNAME "fish")
|
||||||
INCLUDE(CheckCXXSymbolExists)
|
include(CheckCXXSymbolExists)
|
||||||
INCLUDE(CheckIncludeFileCXX)
|
include(CheckIncludeFileCXX)
|
||||||
INCLUDE(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
INCLUDE(CheckStructHasMember)
|
include(CheckStructHasMember)
|
||||||
INCLUDE(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
INCLUDE(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
INCLUDE(CMakePushCheckState)
|
include(CMakePushCheckState)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(backtrace_symbols execinfo.h HAVE_BACKTRACE_SYMBOLS)
|
check_cxx_symbol_exists(backtrace_symbols execinfo.h HAVE_BACKTRACE_SYMBOLS)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(clock_gettime time.h HAVE_CLOCK_GETTIME)
|
check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(ctermid_r stdio.h HAVE_CTERMID_R)
|
check_cxx_symbol_exists(ctermid_r stdio.h HAVE_CTERMID_R)
|
||||||
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE LANGUAGE CXX)
|
check_struct_has_member("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE LANGUAGE CXX)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(dirfd "sys/types.h;dirent.h" HAVE_DIRFD)
|
check_cxx_symbol_exists(dirfd "sys/types.h;dirent.h" HAVE_DIRFD)
|
||||||
CHECK_INCLUDE_FILE_CXX(execinfo.h HAVE_EXECINFO_H)
|
check_include_file_cxx(execinfo.h HAVE_EXECINFO_H)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(flock sys/file.h HAVE_FLOCK)
|
check_cxx_symbol_exists(flock sys/file.h HAVE_FLOCK)
|
||||||
# futimens is new in OS X 10.13 but is a weak symbol.
|
# futimens is new in OS X 10.13 but is a weak symbol.
|
||||||
# Don't assume it exists just because we can link - it may be null.
|
# Don't assume it exists just because we can link - it may be null.
|
||||||
CHECK_CXX_SYMBOL_EXISTS(futimens sys/stat.h HAVE_FUTIMENS)
|
check_cxx_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(futimes sys/time.h HAVE_FUTIMES)
|
check_cxx_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(getifaddrs ifaddrs.h HAVE_GETIFADDRS)
|
check_cxx_symbol_exists(getifaddrs ifaddrs.h HAVE_GETIFADDRS)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(getpwent pwd.h HAVE_GETPWENT)
|
check_cxx_symbol_exists(getpwent pwd.h HAVE_GETPWENT)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(getrusage sys/resource.h HAVE_GETRUSAGE)
|
check_cxx_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(gettext libintl.h HAVE_GETTEXT)
|
check_cxx_symbol_exists(gettext libintl.h HAVE_GETTEXT)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(killpg "sys/types.h;signal.h" HAVE_KILLPG)
|
check_cxx_symbol_exists(killpg "sys/types.h;signal.h" HAVE_KILLPG)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(lrand48_r stdlib.h HAVE_LRAND48_R)
|
check_cxx_symbol_exists(lrand48_r stdlib.h HAVE_LRAND48_R)
|
||||||
# mkostemp is in stdlib in glibc and FreeBSD, but unistd on macOS
|
# mkostemp is in stdlib in glibc and FreeBSD, but unistd on macOS
|
||||||
CHECK_CXX_SYMBOL_EXISTS(mkostemp "stdlib.h;unistd.h" HAVE_MKOSTEMP)
|
check_cxx_symbol_exists(mkostemp "stdlib.h;unistd.h" HAVE_MKOSTEMP)
|
||||||
SET(HAVE_CURSES_H ${CURSES_HAVE_CURSES_H})
|
set(HAVE_CURSES_H ${CURSES_HAVE_CURSES_H})
|
||||||
SET(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H})
|
set(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H})
|
||||||
SET(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H})
|
set(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H})
|
||||||
IF(HAVE_CURSES_H)
|
if(HAVE_CURSES_H)
|
||||||
CHECK_INCLUDE_FILES("curses.h;term.h" HAVE_TERM_H)
|
check_include_files("curses.h;term.h" HAVE_TERM_H)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT HAVE_TERM_H)
|
if(NOT HAVE_TERM_H)
|
||||||
CHECK_INCLUDE_FILE_CXX("ncurses/term.h" HAVE_NCURSES_TERM_H)
|
check_include_file_cxx("ncurses/term.h" HAVE_NCURSES_TERM_H)
|
||||||
ENDIF()
|
endif()
|
||||||
CHECK_INCLUDE_FILE_CXX(siginfo.h HAVE_SIGINFO_H)
|
check_include_file_cxx(siginfo.h HAVE_SIGINFO_H)
|
||||||
CHECK_INCLUDE_FILE_CXX(spawn.h HAVE_SPAWN_H)
|
check_include_file_cxx(spawn.h HAVE_SPAWN_H)
|
||||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_ctime_nsec "sys/stat.h" HAVE_STRUCT_STAT_ST_CTIME_NSEC
|
check_struct_has_member("struct stat" st_ctime_nsec "sys/stat.h" HAVE_STRUCT_STAT_ST_CTIME_NSEC
|
||||||
LANGUAGE CXX)
|
LANGUAGE CXX)
|
||||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec "sys/stat.h"
|
check_struct_has_member("struct stat" st_mtimespec.tv_nsec "sys/stat.h"
|
||||||
HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC LANGUAGE CXX)
|
HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC LANGUAGE CXX)
|
||||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec "sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
check_struct_has_member("struct stat" st_mtim.tv_nsec "sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
||||||
LANGUAGE CXX)
|
LANGUAGE CXX)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(sys_errlist stdio.h HAVE_SYS_ERRLIST)
|
check_cxx_symbol_exists(sys_errlist stdio.h HAVE_SYS_ERRLIST)
|
||||||
CHECK_INCLUDE_FILE_CXX(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
check_include_file_cxx(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
||||||
CHECK_INCLUDE_FILE_CXX(sys/select.h HAVE_SYS_SELECT_H)
|
check_include_file_cxx(sys/select.h HAVE_SYS_SELECT_H)
|
||||||
CHECK_INCLUDE_FILES("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H)
|
check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H)
|
||||||
CHECK_INCLUDE_FILE_CXX(termios.h HAVE_TERMIOS_H) # Needed for TIOCGWINSZ
|
check_include_file_cxx(termios.h HAVE_TERMIOS_H) # Needed for TIOCGWINSZ
|
||||||
|
|
||||||
CHECK_CXX_SYMBOL_EXISTS(wcscasecmp wchar.h HAVE_WCSCASECMP)
|
check_cxx_symbol_exists(wcscasecmp wchar.h HAVE_WCSCASECMP)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(wcsdup wchar.h HAVE_WCSDUP)
|
check_cxx_symbol_exists(wcsdup wchar.h HAVE_WCSDUP)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(wcslcpy wchar.h HAVE_WCSLCPY)
|
check_cxx_symbol_exists(wcslcpy wchar.h HAVE_WCSLCPY)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(wcsncasecmp wchar.h HAVE_WCSNCASECMP)
|
check_cxx_symbol_exists(wcsncasecmp wchar.h HAVE_WCSNCASECMP)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(wcsndup wchar.h HAVE_WCSNDUP)
|
check_cxx_symbol_exists(wcsndup wchar.h HAVE_WCSNDUP)
|
||||||
|
|
||||||
# These are for compatibility with Solaris 10, which places the following
|
# These are for compatibility with Solaris 10, which places the following
|
||||||
# in the std namespace.
|
# in the std namespace.
|
||||||
IF(NOT HAVE_WCSNCASECMP)
|
if(NOT HAVE_WCSNCASECMP)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(std::wcscasecmp wchar.h HAVE_STD__WCSCASECMP)
|
check_cxx_symbol_exists(std::wcscasecmp wchar.h HAVE_STD__WCSCASECMP)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT HAVE_WCSDUP)
|
if(NOT HAVE_WCSDUP)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(std::wcsdup wchar.h HAVE_STD__WCSDUP)
|
check_cxx_symbol_exists(std::wcsdup wchar.h HAVE_STD__WCSDUP)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT HAVE_WCSNCASECMP)
|
if(NOT HAVE_WCSNCASECMP)
|
||||||
CHECK_CXX_SYMBOL_EXISTS(std::wcsncasecmp wchar.h HAVE_STD__WCSNCASECMP)
|
check_cxx_symbol_exists(std::wcsncasecmp wchar.h HAVE_STD__WCSNCASECMP)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# `xlocale.h` is required to find `wcstod_l` in `wchar.h` under FreeBSD,
|
# `xlocale.h` is required to find `wcstod_l` in `wchar.h` under FreeBSD,
|
||||||
# but it's not present under Linux.
|
# but it's not present under Linux.
|
||||||
CHECK_INCLUDE_FILES("xlocale.h" HAVE_XLOCALE_H)
|
check_include_files("xlocale.h" HAVE_XLOCALE_H)
|
||||||
IF(HAVE_XLOCALE_H)
|
if(HAVE_XLOCALE_H)
|
||||||
LIST(APPEND WCSTOD_L_INCLUDES "xlocale.h")
|
list(APPEND WCSTOD_L_INCLUDES "xlocale.h")
|
||||||
ENDIF()
|
endif()
|
||||||
LIST(APPEND WCSTOD_L_INCLUDES "wchar.h")
|
list(APPEND WCSTOD_L_INCLUDES "wchar.h")
|
||||||
CHECK_CXX_SYMBOL_EXISTS(wcstod_l "${WCSTOD_L_INCLUDES}" HAVE_WCSTOD_L)
|
check_cxx_symbol_exists(wcstod_l "${WCSTOD_L_INCLUDES}" HAVE_WCSTOD_L)
|
||||||
|
|
||||||
CHECK_CXX_SYMBOL_EXISTS(_sys_errs stdlib.h HAVE__SYS__ERRS)
|
check_cxx_symbol_exists(_sys_errs stdlib.h HAVE__SYS__ERRS)
|
||||||
|
|
||||||
CMAKE_PUSH_CHECK_STATE()
|
cmake_push_check_state()
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES termios.h sys/ioctl.h)
|
set(CMAKE_EXTRA_INCLUDE_FILES termios.h sys/ioctl.h)
|
||||||
CHECK_TYPE_SIZE("struct winsize" STRUCT_WINSIZE LANGUAGE CXX)
|
check_type_size("struct winsize" STRUCT_WINSIZE LANGUAGE CXX)
|
||||||
CHECK_CXX_SYMBOL_EXISTS("TIOCGWINSZ" "termios.h;sys/ioctl.h" HAVE_TIOCGWINSZ)
|
check_cxx_symbol_exists("TIOCGWINSZ" "termios.h;sys/ioctl.h" HAVE_TIOCGWINSZ)
|
||||||
IF(STRUCT_WINSIZE GREATER -1 AND HAVE_TIOCGWINSZ EQUAL 1)
|
if(STRUCT_WINSIZE GREATER -1 AND HAVE_TIOCGWINSZ EQUAL 1)
|
||||||
SET(HAVE_WINSIZE 1)
|
set(HAVE_WINSIZE 1)
|
||||||
ENDIF()
|
endif()
|
||||||
CMAKE_POP_CHECK_STATE()
|
cmake_pop_check_state()
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
|
check_type_size("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
|
||||||
|
|
||||||
SET(TPARM_INCLUDES)
|
set(TPARM_INCLUDES)
|
||||||
IF(HAVE_NCURSES_H)
|
if(HAVE_NCURSES_H)
|
||||||
SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses.h>\n")
|
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses.h>\n")
|
||||||
ELSEIF(HAVE_NCURSES_CURSES_H)
|
elseif(HAVE_NCURSES_CURSES_H)
|
||||||
SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses/curses.h>\n")
|
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses/curses.h>\n")
|
||||||
ELSE()
|
else()
|
||||||
SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include <curses.h>\n")
|
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <curses.h>\n")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(HAVE_TERM_H)
|
if(HAVE_TERM_H)
|
||||||
SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include <term.h>\n")
|
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <term.h>\n")
|
||||||
ELSEIF(HAVE_NCURSES_TERM_H)
|
elseif(HAVE_NCURSES_TERM_H)
|
||||||
SET(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses/term.h>\n")
|
set(TPARM_INCLUDES "${TPARM_INCLUDES}#include <ncurses/term.h>\n")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Solaris and X/Open-conforming systems have a fixed-args tparm
|
# Solaris and X/Open-conforming systems have a fixed-args tparm
|
||||||
CMAKE_PUSH_CHECK_STATE()
|
cmake_push_check_state()
|
||||||
LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
check_cxx_source_compiles("
|
||||||
#define TPARM_VARARGS
|
#define TPARM_VARARGS
|
||||||
${TPARM_INCLUDES}
|
${TPARM_INCLUDES}
|
||||||
|
|
||||||
|
@ -160,23 +160,23 @@ int main () {
|
||||||
TPARM_TAKES_VARARGS
|
TPARM_TAKES_VARARGS
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(TPARM_TAKES_VARARGS)
|
if(TPARM_TAKES_VARARGS)
|
||||||
SET(TPARM_VARARGS 1)
|
set(TPARM_VARARGS 1)
|
||||||
ELSE()
|
else()
|
||||||
SET(TPARM_SOLARIS_KLUDGE 1)
|
set(TPARM_SOLARIS_KLUDGE 1)
|
||||||
ENDIF()
|
endif()
|
||||||
CMAKE_POP_CHECK_STATE()
|
cmake_pop_check_state()
|
||||||
|
|
||||||
# Work around the fact that cmake does not propagate the language standard flag into
|
# Work around the fact that cmake does not propagate the language standard flag into
|
||||||
# the CHECK_CXX_SOURCE_COMPILES function. See CMake issue #16456.
|
# the CHECK_CXX_SOURCE_COMPILES function. See CMake issue #16456.
|
||||||
# Ensure we do this after the FIND_PACKAGE calls which use C, and will error on a C++
|
# Ensure we do this after the FIND_PACKAGE calls which use C, and will error on a C++
|
||||||
# standards flag.
|
# standards flag.
|
||||||
# Also see https://github.com/fish-shell/fish-shell/issues/5865
|
# Also see https://github.com/fish-shell/fish-shell/issues/5865
|
||||||
IF(NOT POLICY CMP0067)
|
if(NOT POLICY CMP0067)
|
||||||
LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_EXTENSION_COMPILE_OPTION}")
|
list(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_EXTENSION_COMPILE_OPTION}")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
check_cxx_source_compiles("
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
|
@ -186,9 +186,9 @@ int main () {
|
||||||
HAVE_STD__MAKE_UNIQUE
|
HAVE_STD__MAKE_UNIQUE
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PROGRAM(SED sed)
|
find_program(SED sed)
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
check_cxx_source_compiles("
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
std::atomic<uint64_t> x;
|
std::atomic<uint64_t> x;
|
||||||
|
@ -197,5 +197,5 @@ int main() {
|
||||||
}"
|
}"
|
||||||
LIBATOMIC_NOT_NEEDED)
|
LIBATOMIC_NOT_NEEDED)
|
||||||
IF (NOT LIBATOMIC_NOT_NEEDED)
|
IF (NOT LIBATOMIC_NOT_NEEDED)
|
||||||
SET(ATOMIC_LIBRARY "atomic")
|
set(ATOMIC_LIBRARY "atomic")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
FIND_PROGRAM(SPHINX_EXECUTABLE NAMES sphinx-build
|
find_program(SPHINX_EXECUTABLE NAMES sphinx-build
|
||||||
HINTS
|
HINTS
|
||||||
$ENV{SPHINX_DIR}
|
$ENV{SPHINX_DIR}
|
||||||
PATH_SUFFIXES bin
|
PATH_SUFFIXES bin
|
||||||
DOC "Sphinx documentation generator")
|
DOC "Sphinx documentation generator")
|
||||||
|
|
||||||
INCLUDE(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
SET(SPHINX_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc_src")
|
set(SPHINX_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc_src")
|
||||||
SET(SPHINX_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/user_doc")
|
set(SPHINX_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/user_doc")
|
||||||
SET(SPHINX_BUILD_DIR "${SPHINX_ROOT_DIR}/build")
|
set(SPHINX_BUILD_DIR "${SPHINX_ROOT_DIR}/build")
|
||||||
SET(SPHINX_CACHE_DIR "${SPHINX_ROOT_DIR}/doctrees")
|
set(SPHINX_CACHE_DIR "${SPHINX_ROOT_DIR}/doctrees")
|
||||||
SET(SPHINX_HTML_DIR "${SPHINX_ROOT_DIR}/html")
|
set(SPHINX_HTML_DIR "${SPHINX_ROOT_DIR}/html")
|
||||||
SET(SPHINX_MANPAGE_DIR "${SPHINX_ROOT_DIR}/man")
|
set(SPHINX_MANPAGE_DIR "${SPHINX_ROOT_DIR}/man")
|
||||||
|
|
||||||
# sphinx-docs uses fish_indent for highlighting.
|
# sphinx-docs uses fish_indent for highlighting.
|
||||||
# Prepend the output dir of fish_indent to PATH.
|
# Prepend the output dir of fish_indent to PATH.
|
||||||
ADD_CUSTOM_TARGET(sphinx-docs
|
add_custom_target(sphinx-docs
|
||||||
mkdir -p ${SPHINX_HTML_DIR}/_static/
|
mkdir -p ${SPHINX_HTML_DIR}/_static/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPHINX_SRC_DIR}/_static/pygments.css ${SPHINX_HTML_DIR}/_static/
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPHINX_SRC_DIR}/_static/pygments.css ${SPHINX_HTML_DIR}/_static/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPHINX_SRC_DIR}/_static/custom.css ${SPHINX_HTML_DIR}/_static/
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SPHINX_SRC_DIR}/_static/custom.css ${SPHINX_HTML_DIR}/_static/
|
||||||
|
@ -30,7 +30,7 @@ ADD_CUSTOM_TARGET(sphinx-docs
|
||||||
COMMENT "Building HTML documentation with Sphinx")
|
COMMENT "Building HTML documentation with Sphinx")
|
||||||
|
|
||||||
# sphinx-manpages needs the fish_indent binary for the version number
|
# sphinx-manpages needs the fish_indent binary for the version number
|
||||||
ADD_CUSTOM_TARGET(sphinx-manpages
|
add_custom_target(sphinx-manpages
|
||||||
env PATH="$<TARGET_FILE_DIR:fish_indent>:$$PATH"
|
env PATH="$<TARGET_FILE_DIR:fish_indent>:$$PATH"
|
||||||
${SPHINX_EXECUTABLE}
|
${SPHINX_EXECUTABLE}
|
||||||
-q -b man
|
-q -b man
|
||||||
|
@ -42,46 +42,46 @@ ADD_CUSTOM_TARGET(sphinx-manpages
|
||||||
DEPENDS fish_indent
|
DEPENDS fish_indent
|
||||||
COMMENT "Building man pages with Sphinx")
|
COMMENT "Building man pages with Sphinx")
|
||||||
|
|
||||||
IF(SPHINX_EXECUTABLE)
|
if(SPHINX_EXECUTABLE)
|
||||||
OPTION(BUILD_DOCS "build documentation (requires Sphinx)" ON)
|
option(BUILD_DOCS "build documentation (requires Sphinx)" ON)
|
||||||
ELSE(SPHINX_EXECUTABLE)
|
else(SPHINX_EXECUTABLE)
|
||||||
OPTION(BUILD_DOCS "build documentation (requires Sphinx)" OFF)
|
option(BUILD_DOCS "build documentation (requires Sphinx)" OFF)
|
||||||
ENDIF(SPHINX_EXECUTABLE)
|
endif(SPHINX_EXECUTABLE)
|
||||||
|
|
||||||
IF(BUILD_DOCS AND NOT SPHINX_EXECUTABLE)
|
if(BUILD_DOCS AND NOT SPHINX_EXECUTABLE)
|
||||||
MESSAGE(FATAL_ERROR "build documentation selected, but sphinx-build could not be found")
|
message(FATAL_ERROR "build documentation selected, but sphinx-build could not be found")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/user_doc/html
|
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/user_doc/html
|
||||||
AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/user_doc/man)
|
AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/user_doc/man)
|
||||||
SET(HAVE_PREBUILT_DOCS TRUE)
|
set(HAVE_PREBUILT_DOCS TRUE)
|
||||||
ELSE()
|
else()
|
||||||
SET(HAVE_PREBUILT_DOCS FALSE)
|
set(HAVE_PREBUILT_DOCS FALSE)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(BUILD_DOCS OR HAVE_PREBUILT_DOCS)
|
if(BUILD_DOCS OR HAVE_PREBUILT_DOCS)
|
||||||
SET(INSTALL_DOCS ON)
|
set(INSTALL_DOCS ON)
|
||||||
ELSE()
|
else()
|
||||||
SET(INSTALL_DOCS OFF)
|
set(INSTALL_DOCS OFF)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
ADD_FEATURE_INFO(Documentation INSTALL_DOCS "user manual and documentation")
|
add_feature_info(Documentation INSTALL_DOCS "user manual and documentation")
|
||||||
|
|
||||||
IF(BUILD_DOCS)
|
if(BUILD_DOCS)
|
||||||
CONFIGURE_FILE("${SPHINX_SRC_DIR}/conf.py" "${SPHINX_BUILD_DIR}/conf.py" @ONLY)
|
configure_file("${SPHINX_SRC_DIR}/conf.py" "${SPHINX_BUILD_DIR}/conf.py" @ONLY)
|
||||||
ADD_CUSTOM_TARGET(doc ALL
|
add_custom_target(doc ALL
|
||||||
DEPENDS sphinx-docs sphinx-manpages)
|
DEPENDS sphinx-docs sphinx-manpages)
|
||||||
|
|
||||||
# Group docs targets into a DocsTargets folder
|
# Group docs targets into a DocsTargets folder
|
||||||
SET_PROPERTY(TARGET doc sphinx-docs sphinx-manpages
|
set_property(TARGET doc sphinx-docs sphinx-manpages
|
||||||
PROPERTY FOLDER cmake/DocTargets)
|
PROPERTY FOLDER cmake/DocTargets)
|
||||||
|
|
||||||
ELSEIF(HAVE_PREBUILT_DOCS)
|
elseif(HAVE_PREBUILT_DOCS)
|
||||||
IF(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
||||||
# Out of tree build - link the prebuilt documentation to the build tree
|
# Out of tree build - link the prebuilt documentation to the build tree
|
||||||
ADD_CUSTOM_TARGET(link_doc ALL)
|
add_custom_target(link_doc ALL)
|
||||||
ADD_CUSTOM_COMMAND(TARGET link_doc
|
add_custom_command(TARGET link_doc
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/user_doc ${CMAKE_CURRENT_BINARY_DIR}/user_doc
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/user_doc ${CMAKE_CURRENT_BINARY_DIR}/user_doc
|
||||||
POST_BUILD)
|
POST_BUILD)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF(BUILD_DOCS)
|
endif(BUILD_DOCS)
|
||||||
|
|
|
@ -5,39 +5,39 @@
|
||||||
# -DBINDIR=L"${CMAKE_INSTALL_FULL_BINDIR}"
|
# -DBINDIR=L"${CMAKE_INSTALL_FULL_BINDIR}"
|
||||||
# -DDOCDIR=L"${CMAKE_INSTALL_FULL_DOCDIR}")
|
# -DDOCDIR=L"${CMAKE_INSTALL_FULL_DOCDIR}")
|
||||||
|
|
||||||
SET(CMAKE_INSTALL_MESSAGE NEVER)
|
set(CMAKE_INSTALL_MESSAGE NEVER)
|
||||||
|
|
||||||
SET(PROGRAMS fish fish_indent fish_key_reader)
|
set(PROGRAMS fish fish_indent fish_key_reader)
|
||||||
|
|
||||||
SET(prefix ${CMAKE_INSTALL_PREFIX})
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
SET(bindir ${CMAKE_INSTALL_BINDIR})
|
set(bindir ${CMAKE_INSTALL_BINDIR})
|
||||||
SET(sysconfdir ${CMAKE_INSTALL_SYSCONFDIR})
|
set(sysconfdir ${CMAKE_INSTALL_SYSCONFDIR})
|
||||||
SET(mandir ${CMAKE_INSTALL_MANDIR})
|
set(mandir ${CMAKE_INSTALL_MANDIR})
|
||||||
|
|
||||||
SET(rel_datadir ${CMAKE_INSTALL_DATADIR})
|
set(rel_datadir ${CMAKE_INSTALL_DATADIR})
|
||||||
SET(datadir ${CMAKE_INSTALL_FULL_DATADIR})
|
set(datadir ${CMAKE_INSTALL_FULL_DATADIR})
|
||||||
|
|
||||||
SET(docdir ${CMAKE_INSTALL_DOCDIR})
|
set(docdir ${CMAKE_INSTALL_DOCDIR})
|
||||||
|
|
||||||
# Comment at the top of some .in files
|
# Comment at the top of some .in files
|
||||||
SET(configure_input
|
set(configure_input
|
||||||
"This file was generated from a corresponding .in file.\
|
"This file was generated from a corresponding .in file.\
|
||||||
DO NOT MANUALLY EDIT THIS FILE!")
|
DO NOT MANUALLY EDIT THIS FILE!")
|
||||||
|
|
||||||
SET(extra_completionsdir
|
set(extra_completionsdir
|
||||||
/usr/local/share/fish/vendor_completions.d
|
/usr/local/share/fish/vendor_completions.d
|
||||||
CACHE STRING "Path for extra completions")
|
CACHE STRING "Path for extra completions")
|
||||||
|
|
||||||
SET(extra_functionsdir
|
set(extra_functionsdir
|
||||||
/usr/local/share/fish/vendor_functions.d
|
/usr/local/share/fish/vendor_functions.d
|
||||||
CACHE STRING "Path for extra functions")
|
CACHE STRING "Path for extra functions")
|
||||||
|
|
||||||
SET(extra_confdir
|
set(extra_confdir
|
||||||
/usr/local/share/fish/vendor_conf.d
|
/usr/local/share/fish/vendor_conf.d
|
||||||
CACHE STRING "Path for extra configuration")
|
CACHE STRING "Path for extra configuration")
|
||||||
|
|
||||||
# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath.
|
# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath.
|
||||||
SET(MANUALS ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish.1
|
set(MANUALS ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish.1
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_indent.1
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_indent.1
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_key_reader.1)
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_key_reader.1)
|
||||||
|
|
||||||
|
@ -46,42 +46,42 @@ SET(MANUALS ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish.1
|
||||||
# function on OS X.
|
# function on OS X.
|
||||||
# On other operating systems, don't install a realpath man page, as they almost all have a realpath
|
# On other operating systems, don't install a realpath man page, as they almost all have a realpath
|
||||||
# command, while macOS does not.
|
# command, while macOS does not.
|
||||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
SET(CONDEMNED_PAGE "open.1")
|
set(CONDEMNED_PAGE "open.1")
|
||||||
ELSE()
|
else()
|
||||||
SET(CONDEMNED_PAGE "realpath.1")
|
set(CONDEMNED_PAGE "realpath.1")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Define a function to help us create directories.
|
# Define a function to help us create directories.
|
||||||
FUNCTION(FISH_CREATE_DIRS)
|
function(FISH_CREATE_DIRS)
|
||||||
FOREACH(dir ${ARGV})
|
foreach(dir ${ARGV})
|
||||||
INSTALL(DIRECTORY DESTINATION ${dir})
|
install(DIRECTORY DESTINATION ${dir})
|
||||||
ENDFOREACH(dir)
|
endforeach(dir)
|
||||||
ENDFUNCTION(FISH_CREATE_DIRS)
|
endfunction(FISH_CREATE_DIRS)
|
||||||
|
|
||||||
FUNCTION(FISH_TRY_CREATE_DIRS)
|
function(FISH_TRY_CREATE_DIRS)
|
||||||
FOREACH(dir ${ARGV})
|
foreach(dir ${ARGV})
|
||||||
IF(NOT IS_ABSOLUTE ${dir})
|
if(NOT IS_ABSOLUTE ${dir})
|
||||||
SET(abs_dir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dir}")
|
set(abs_dir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dir}")
|
||||||
ELSE()
|
else()
|
||||||
SET(abs_dir "\$ENV{DESTDIR}${dir}")
|
set(abs_dir "\$ENV{DESTDIR}${dir}")
|
||||||
ENDIF()
|
endif()
|
||||||
INSTALL(SCRIPT CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
|
install(SCRIPT CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
|
||||||
EXECUTE_PROCESS(COMMAND chmod 755 ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
|
execute_process(COMMAND chmod 755 ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
|
||||||
")
|
")
|
||||||
ENDFOREACH()
|
endforeach()
|
||||||
ENDFUNCTION(FISH_TRY_CREATE_DIRS)
|
endfunction(FISH_TRY_CREATE_DIRS)
|
||||||
|
|
||||||
INSTALL(TARGETS ${PROGRAMS}
|
install(TARGETS ${PROGRAMS}
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
||||||
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||||
DESTINATION ${bindir})
|
DESTINATION ${bindir})
|
||||||
|
|
||||||
FISH_CREATE_DIRS(${sysconfdir}/fish/conf.d ${sysconfdir}/fish/completions
|
fish_create_dirs(${sysconfdir}/fish/conf.d ${sysconfdir}/fish/completions
|
||||||
${sysconfdir}/fish/functions)
|
${sysconfdir}/fish/functions)
|
||||||
INSTALL(FILES etc/config.fish DESTINATION ${sysconfdir}/fish/)
|
install(FILES etc/config.fish DESTINATION ${sysconfdir}/fish/)
|
||||||
|
|
||||||
FISH_CREATE_DIRS(${rel_datadir}/fish ${rel_datadir}/fish/completions
|
fish_create_dirs(${rel_datadir}/fish ${rel_datadir}/fish/completions
|
||||||
${rel_datadir}/fish/functions ${rel_datadir}/fish/groff
|
${rel_datadir}/fish/functions ${rel_datadir}/fish/groff
|
||||||
${rel_datadir}/fish/man/man1 ${rel_datadir}/fish/tools
|
${rel_datadir}/fish/man/man1 ${rel_datadir}/fish/tools
|
||||||
${rel_datadir}/fish/tools/web_config
|
${rel_datadir}/fish/tools/web_config
|
||||||
|
@ -89,53 +89,53 @@ FISH_CREATE_DIRS(${rel_datadir}/fish ${rel_datadir}/fish/completions
|
||||||
${rel_datadir}/fish/tools/web_config/partials
|
${rel_datadir}/fish/tools/web_config/partials
|
||||||
${rel_datadir}/fish/tools/web_config/sample_prompts)
|
${rel_datadir}/fish/tools/web_config/sample_prompts)
|
||||||
|
|
||||||
CONFIGURE_FILE(share/__fish_build_paths.fish.in share/__fish_build_paths.fish)
|
configure_file(share/__fish_build_paths.fish.in share/__fish_build_paths.fish)
|
||||||
INSTALL(FILES share/config.fish
|
install(FILES share/config.fish
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/share/__fish_build_paths.fish
|
${CMAKE_CURRENT_BINARY_DIR}/share/__fish_build_paths.fish
|
||||||
DESTINATION ${rel_datadir}/fish)
|
DESTINATION ${rel_datadir}/fish)
|
||||||
|
|
||||||
# Create only the vendor directories inside the prefix (#5029 / #6508)
|
# Create only the vendor directories inside the prefix (#5029 / #6508)
|
||||||
FISH_CREATE_DIRS(${rel_datadir}/fish/vendor_completions.d ${rel_datadir}/fish/vendor_functions.d
|
fish_create_dirs(${rel_datadir}/fish/vendor_completions.d ${rel_datadir}/fish/vendor_functions.d
|
||||||
${rel_datadir}/fish/vendor_conf.d)
|
${rel_datadir}/fish/vendor_conf.d)
|
||||||
|
|
||||||
FISH_TRY_CREATE_DIRS(${rel_datadir}/pkgconfig)
|
fish_try_create_dirs(${rel_datadir}/pkgconfig)
|
||||||
CONFIGURE_FILE(fish.pc.in fish.pc.noversion)
|
configure_file(fish.pc.in fish.pc.noversion)
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(OUTPUT fish.pc
|
add_custom_command(OUTPUT fish.pc
|
||||||
COMMAND sed '/Version/d' fish.pc.noversion > fish.pc
|
COMMAND sed '/Version/d' fish.pc.noversion > fish.pc
|
||||||
COMMAND printf "Version: " >> fish.pc
|
COMMAND printf "Version: " >> fish.pc
|
||||||
COMMAND sed 's/FISH_BUILD_VERSION=//\;s/\"//g' ${FBVF} >> fish.pc
|
COMMAND sed 's/FISH_BUILD_VERSION=//\;s/\"//g' ${FBVF} >> fish.pc
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FBVF} ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion)
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FBVF} ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(build_fish_pc ALL DEPENDS fish.pc)
|
add_custom_target(build_fish_pc ALL DEPENDS fish.pc)
|
||||||
|
|
||||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/fish.pc
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fish.pc
|
||||||
DESTINATION ${rel_datadir}/pkgconfig)
|
DESTINATION ${rel_datadir}/pkgconfig)
|
||||||
|
|
||||||
INSTALL(DIRECTORY share/completions/
|
install(DIRECTORY share/completions/
|
||||||
DESTINATION ${rel_datadir}/fish/completions
|
DESTINATION ${rel_datadir}/fish/completions
|
||||||
FILES_MATCHING PATTERN "*.fish")
|
FILES_MATCHING PATTERN "*.fish")
|
||||||
|
|
||||||
INSTALL(DIRECTORY share/functions/
|
install(DIRECTORY share/functions/
|
||||||
DESTINATION ${rel_datadir}/fish/functions
|
DESTINATION ${rel_datadir}/fish/functions
|
||||||
FILES_MATCHING PATTERN "*.fish")
|
FILES_MATCHING PATTERN "*.fish")
|
||||||
|
|
||||||
INSTALL(DIRECTORY share/groff
|
install(DIRECTORY share/groff
|
||||||
DESTINATION ${rel_datadir}/fish)
|
DESTINATION ${rel_datadir}/fish)
|
||||||
|
|
||||||
# CONDEMNED_PAGE is managed by the conditional above
|
# CONDEMNED_PAGE is managed by the conditional above
|
||||||
# Building the man pages is optional: if sphinx isn't installed, they're not built
|
# Building the man pages is optional: if sphinx isn't installed, they're not built
|
||||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/
|
||||||
DESTINATION ${rel_datadir}/fish/man/man1
|
DESTINATION ${rel_datadir}/fish/man/man1
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
PATTERN "*.1"
|
PATTERN "*.1"
|
||||||
PATTERN ${CONDEMNED_PAGE} EXCLUDE)
|
PATTERN ${CONDEMNED_PAGE} EXCLUDE)
|
||||||
|
|
||||||
INSTALL(PROGRAMS share/tools/create_manpage_completions.py share/tools/deroff.py
|
install(PROGRAMS share/tools/create_manpage_completions.py share/tools/deroff.py
|
||||||
DESTINATION ${rel_datadir}/fish/tools/)
|
DESTINATION ${rel_datadir}/fish/tools/)
|
||||||
|
|
||||||
INSTALL(DIRECTORY share/tools/web_config
|
install(DIRECTORY share/tools/web_config
|
||||||
DESTINATION ${rel_datadir}/fish/tools/
|
DESTINATION ${rel_datadir}/fish/tools/
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
PATTERN "*.png"
|
PATTERN "*.png"
|
||||||
|
@ -146,34 +146,34 @@ INSTALL(DIRECTORY share/tools/web_config
|
||||||
PATTERN "*.fish")
|
PATTERN "*.fish")
|
||||||
|
|
||||||
# Building the man pages is optional: if Sphinx isn't installed, they're not built
|
# Building the man pages is optional: if Sphinx isn't installed, they're not built
|
||||||
INSTALL(FILES ${MANUALS} DESTINATION ${mandir}/man1/ OPTIONAL)
|
install(FILES ${MANUALS} DESTINATION ${mandir}/man1/ OPTIONAL)
|
||||||
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/html/ # Trailing slash is important!
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/html/ # Trailing slash is important!
|
||||||
DESTINATION ${docdir} OPTIONAL)
|
DESTINATION ${docdir} OPTIONAL)
|
||||||
INSTALL(FILES CHANGELOG.md DESTINATION ${docdir})
|
install(FILES CHANGELOG.md DESTINATION ${docdir})
|
||||||
|
|
||||||
INSTALL(FILES share/lynx.lss DESTINATION ${rel_datadir}/fish/)
|
install(FILES share/lynx.lss DESTINATION ${rel_datadir}/fish/)
|
||||||
|
|
||||||
# These files are built by cmake/gettext.cmake, but using GETTEXT_PROCESS_PO_FILES's
|
# These files are built by cmake/gettext.cmake, but using GETTEXT_PROCESS_PO_FILES's
|
||||||
# INSTALL_DESTINATION leads to them being installed as ${lang}.gmo, not fish.mo
|
# INSTALL_DESTINATION leads to them being installed as ${lang}.gmo, not fish.mo
|
||||||
# The ${languages} array comes from cmake/gettext.cmake
|
# The ${languages} array comes from cmake/gettext.cmake
|
||||||
IF(GETTEXT_FOUND)
|
if(GETTEXT_FOUND)
|
||||||
FOREACH(lang ${languages})
|
foreach(lang ${languages})
|
||||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo DESTINATION
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo DESTINATION
|
||||||
${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES/ RENAME fish.mo)
|
${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES/ RENAME fish.mo)
|
||||||
ENDFOREACH()
|
endforeach()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
INSTALL(FILES fish.desktop DESTINATION ${rel_datadir}/applications)
|
install(FILES fish.desktop DESTINATION ${rel_datadir}/applications)
|
||||||
INSTALL(FILES fish.png DESTINATION ${rel_datadir}/pixmaps)
|
install(FILES fish.png DESTINATION ${rel_datadir}/pixmaps)
|
||||||
|
|
||||||
# Group install targets into a InstallTargets folder
|
# Group install targets into a InstallTargets folder
|
||||||
SET_PROPERTY(TARGET build_fish_pc CHECK-FISH-BUILD-VERSION-FILE
|
set_property(TARGET build_fish_pc CHECK-FISH-BUILD-VERSION-FILE
|
||||||
test_fishscript
|
test_fishscript
|
||||||
test_prep tests_buildroot_target
|
test_prep tests_buildroot_target
|
||||||
PROPERTY FOLDER cmake/InstallTargets)
|
PROPERTY FOLDER cmake/InstallTargets)
|
||||||
|
|
||||||
# Make a target build_root that installs into the buildroot directory, for testing.
|
# Make a target build_root that installs into the buildroot directory, for testing.
|
||||||
SET(BUILDROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/buildroot)
|
set(BUILDROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/buildroot)
|
||||||
ADD_CUSTOM_TARGET(build_root
|
add_custom_target(build_root
|
||||||
COMMAND DESTDIR=${BUILDROOT_DIR} ${CMAKE_COMMAND}
|
COMMAND DESTDIR=${BUILDROOT_DIR} ${CMAKE_COMMAND}
|
||||||
--build ${CMAKE_CURRENT_BINARY_DIR} --target install)
|
--build ${CMAKE_CURRENT_BINARY_DIR} --target install)
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
|
||||||
|
|
||||||
# Code signing ID on Mac. A default '-' is ad-hoc codesign.
|
# Code signing ID on Mac. A default '-' is ad-hoc codesign.
|
||||||
SET(MAC_CODESIGN_ID "-" CACHE STRING "Mac code-signing identity")
|
set(MAC_CODESIGN_ID "-" CACHE STRING "Mac code-signing identity")
|
||||||
|
|
||||||
# Whether to inject the "get-task-allow" entitlement, which permits debugging
|
# Whether to inject the "get-task-allow" entitlement, which permits debugging
|
||||||
# on the Mac.
|
# on the Mac.
|
||||||
SET(MAC_INJECT_GET_TASK_ALLOW ON CACHE BOOL "Inject get-task-allow on Mac")
|
set(MAC_INJECT_GET_TASK_ALLOW ON CACHE BOOL "Inject get-task-allow on Mac")
|
||||||
|
|
||||||
FUNCTION(CODESIGN_ON_MAC target)
|
function(CODESIGN_ON_MAC target)
|
||||||
IF(APPLE)
|
if(APPLE)
|
||||||
IF(MAC_INJECT_GET_TASK_ALLOW)
|
if(MAC_INJECT_GET_TASK_ALLOW)
|
||||||
SET(ENTITLEMENTS "--entitlements" "${CMAKE_SOURCE_DIR}/osx/fish_debug.entitlements")
|
set(ENTITLEMENTS "--entitlements" "${CMAKE_SOURCE_DIR}/osx/fish_debug.entitlements")
|
||||||
ELSE()
|
else()
|
||||||
SET(ENTITLEMENTS "")
|
set(ENTITLEMENTS "")
|
||||||
ENDIF(MAC_INJECT_GET_TASK_ALLOW)
|
endif(MAC_INJECT_GET_TASK_ALLOW)
|
||||||
ADD_CUSTOM_COMMAND(
|
add_custom_command(
|
||||||
TARGET ${target}
|
TARGET ${target}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND codesign --force --deep --options runtime ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $<TARGET_FILE:${target}>
|
COMMAND codesign --force --deep --options runtime ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $<TARGET_FILE:${target}>
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDFUNCTION(CODESIGN_ON_MAC target)
|
endfunction(CODESIGN_ON_MAC target)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
# This is Mac-only.
|
# This is Mac-only.
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
RETURN()
|
return()
|
||||||
endif (NOT APPLE)
|
endif (NOT APPLE)
|
||||||
|
|
||||||
# The source tree containing certain macOS resources.
|
# The source tree containing certain macOS resources.
|
||||||
SET(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx)
|
set(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx)
|
||||||
|
|
||||||
SET(RESOURCE_FILES
|
set(RESOURCE_FILES
|
||||||
${OSX_DIR}/launch_fish.scpt
|
${OSX_DIR}/launch_fish.scpt
|
||||||
${OSX_DIR}/fish_term_icon.icns
|
${OSX_DIR}/fish_term_icon.icns
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/build_tools/osx_package_scripts/add-shell
|
${CMAKE_CURRENT_SOURCE_DIR}/build_tools/osx_package_scripts/add-shell
|
||||||
|
@ -14,7 +14,7 @@ SET(RESOURCE_FILES
|
||||||
)
|
)
|
||||||
|
|
||||||
# Resource files must be present in the source list.
|
# Resource files must be present in the source list.
|
||||||
ADD_EXECUTABLE(fish_macapp EXCLUDE_FROM_ALL
|
add_executable(fish_macapp EXCLUDE_FROM_ALL
|
||||||
${OSX_DIR}/osx_fish_launcher.m
|
${OSX_DIR}/osx_fish_launcher.m
|
||||||
${RESOURCE_FILES}
|
${RESOURCE_FILES}
|
||||||
)
|
)
|
||||||
|
@ -22,7 +22,7 @@ ADD_EXECUTABLE(fish_macapp EXCLUDE_FROM_ALL
|
||||||
# Compute the version. Note this is done at generation time, not build time,
|
# Compute the version. Note this is done at generation time, not build time,
|
||||||
# so cmake must be re-run after version changes for the app to be updated. But
|
# so cmake must be re-run after version changes for the app to be updated. But
|
||||||
# generally this will be run by make_pkg.sh which always re-runs cmake.
|
# generally this will be run by make_pkg.sh which always re-runs cmake.
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh --stdout
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh --stdout
|
||||||
COMMAND cut -d- -f1
|
COMMAND cut -d- -f1
|
||||||
OUTPUT_VARIABLE FISH_SHORT_VERSION
|
OUTPUT_VARIABLE FISH_SHORT_VERSION
|
||||||
|
@ -31,12 +31,12 @@ EXECUTE_PROCESS(
|
||||||
|
|
||||||
# Note CMake appends .app, so the real output name will be fish.app.
|
# Note CMake appends .app, so the real output name will be fish.app.
|
||||||
# This target does not include the 'base' resource.
|
# This target does not include the 'base' resource.
|
||||||
SET_TARGET_PROPERTIES(fish_macapp PROPERTIES OUTPUT_NAME "fish")
|
set_target_properties(fish_macapp PROPERTIES OUTPUT_NAME "fish")
|
||||||
|
|
||||||
FIND_LIBRARY(FOUNDATION_LIB Foundation)
|
find_library(FOUNDATION_LIB Foundation)
|
||||||
TARGET_LINK_LIBRARIES(fish_macapp ${FOUNDATION_LIB})
|
target_link_libraries(fish_macapp ${FOUNDATION_LIB})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(fish_macapp PROPERTIES
|
set_target_properties(fish_macapp PROPERTIES
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
MACOSX_BUNDLE_INFO_PLIST ${OSX_DIR}/CMakeMacAppInfo.plist.in
|
MACOSX_BUNDLE_INFO_PLIST ${OSX_DIR}/CMakeMacAppInfo.plist.in
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER "com.ridiculousfish.fish-shell"
|
MACOSX_BUNDLE_GUI_IDENTIFIER "com.ridiculousfish.fish-shell"
|
||||||
|
@ -47,9 +47,9 @@ SET_TARGET_PROPERTIES(fish_macapp PROPERTIES
|
||||||
# The fish Mac app contains a fish installation inside the package.
|
# The fish Mac app contains a fish installation inside the package.
|
||||||
# Here is where it gets built.
|
# Here is where it gets built.
|
||||||
# Copy into the fish mac app after.
|
# Copy into the fish mac app after.
|
||||||
SET(MACAPP_FISH_BUILDROOT ${CMAKE_CURRENT_BINARY_DIR}/macapp_buildroot/base)
|
set(MACAPP_FISH_BUILDROOT ${CMAKE_CURRENT_BINARY_DIR}/macapp_buildroot/base)
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(TARGET fish_macapp POST_BUILD
|
add_custom_command(TARGET fish_macapp POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${MACAPP_FISH_BUILDROOT}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${MACAPP_FISH_BUILDROOT}
|
||||||
COMMAND DESTDIR=${MACAPP_FISH_BUILDROOT} ${CMAKE_COMMAND}
|
COMMAND DESTDIR=${MACAPP_FISH_BUILDROOT} ${CMAKE_COMMAND}
|
||||||
--build ${CMAKE_CURRENT_BINARY_DIR} --target install
|
--build ${CMAKE_CURRENT_BINARY_DIR} --target install
|
||||||
|
@ -59,12 +59,12 @@ ADD_CUSTOM_COMMAND(TARGET fish_macapp POST_BUILD
|
||||||
)
|
)
|
||||||
|
|
||||||
# The entitlements file.
|
# The entitlements file.
|
||||||
SET(MACAPP_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/osx/MacApp.entitlements")
|
set(MACAPP_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/osx/MacApp.entitlements")
|
||||||
|
|
||||||
# Target to sign the macapp.
|
# Target to sign the macapp.
|
||||||
# Note that a POST_BUILD step happens before resources are copied,
|
# Note that a POST_BUILD step happens before resources are copied,
|
||||||
# and therefore would be too early.
|
# and therefore would be too early.
|
||||||
ADD_CUSTOM_TARGET(signed_fish_macapp
|
add_custom_target(signed_fish_macapp
|
||||||
DEPENDS fish_macapp "${MACAPP_ENTITLEMENTS}"
|
DEPENDS fish_macapp "${MACAPP_ENTITLEMENTS}"
|
||||||
COMMAND codesign --force --deep
|
COMMAND codesign --force --deep
|
||||||
--options runtime
|
--options runtime
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
# PCRE2 needs some settings.
|
# PCRE2 needs some settings.
|
||||||
SET(PCRE2_WIDTH ${WCHAR_T_BITS})
|
set(PCRE2_WIDTH ${WCHAR_T_BITS})
|
||||||
SET(PCRE2_BUILD_PCRE2_8 OFF CACHE BOOL "Build 8bit PCRE2 library")
|
set(PCRE2_BUILD_PCRE2_8 OFF CACHE BOOL "Build 8bit PCRE2 library")
|
||||||
SET(PCRE2_BUILD_PCRE2_${PCRE2_WIDTH} ON CACHE BOOL "Build ${PCRE2_WIDTH}bit PCRE2 library")
|
set(PCRE2_BUILD_PCRE2_${PCRE2_WIDTH} ON CACHE BOOL "Build ${PCRE2_WIDTH}bit PCRE2 library")
|
||||||
SET(PCRE2_SHOW_REPORT OFF CACHE BOOL "Show the final configuration report")
|
set(PCRE2_SHOW_REPORT OFF CACHE BOOL "Show the final configuration report")
|
||||||
SET(PCRE2_BUILD_TESTS OFF CACHE BOOL "Build tests")
|
set(PCRE2_BUILD_TESTS OFF CACHE BOOL "Build tests")
|
||||||
SET(PCRE2_BUILD_PCRE2GREP OFF CACHE BOOL "Build pcre2grep")
|
set(PCRE2_BUILD_PCRE2GREP OFF CACHE BOOL "Build pcre2grep")
|
||||||
|
|
||||||
SET(PCRE2_MIN_VERSION 10.21)
|
set(PCRE2_MIN_VERSION 10.21)
|
||||||
IF (NOT APPLE)
|
IF (NOT APPLE)
|
||||||
FIND_LIBRARY(PCRE2_LIB pcre2-${PCRE2_WIDTH})
|
find_library(PCRE2_LIB pcre2-${PCRE2_WIDTH})
|
||||||
FIND_PATH(PCRE2_INCLUDE_DIR pcre2.h)
|
find_path(PCRE2_INCLUDE_DIR pcre2.h)
|
||||||
ENDIF()
|
endif()
|
||||||
IF (PCRE2_LIB AND PCRE2_INCLUDE_DIR)
|
IF (PCRE2_LIB AND PCRE2_INCLUDE_DIR)
|
||||||
MESSAGE(STATUS "Found system PCRE2 library ${PCRE2_INCLUDE_DIR}")
|
message(STATUS "Found system PCRE2 library ${PCRE2_INCLUDE_DIR}")
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(STATUS "Using bundled PCRE2 library")
|
message(STATUS "Using bundled PCRE2 library")
|
||||||
ADD_SUBDIRECTORY(pcre2 EXCLUDE_FROM_ALL)
|
add_subdirectory(pcre2 EXCLUDE_FROM_ALL)
|
||||||
SET(PCRE2_INCLUDE_DIR ${CMAKE_BINARY_DIR}/pcre2)
|
set(PCRE2_INCLUDE_DIR ${CMAKE_BINARY_DIR}/pcre2)
|
||||||
SET(PCRE2_LIB pcre2-${PCRE2_WIDTH})
|
set(PCRE2_LIB pcre2-${PCRE2_WIDTH})
|
||||||
ENDIF(PCRE2_LIB AND PCRE2_INCLUDE_DIR)
|
endif(PCRE2_LIB AND PCRE2_INCLUDE_DIR)
|
||||||
INCLUDE_DIRECTORIES(${PCRE2_INCLUDE_DIR})
|
include_directories(${PCRE2_INCLUDE_DIR})
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
# Define fish_tests.
|
# Define fish_tests.
|
||||||
ADD_EXECUTABLE(fish_tests EXCLUDE_FROM_ALL
|
add_executable(fish_tests EXCLUDE_FROM_ALL
|
||||||
src/fish_tests.cpp)
|
src/fish_tests.cpp)
|
||||||
FISH_LINK_DEPS_AND_SIGN(fish_tests)
|
fish_link_deps_and_sign(fish_tests)
|
||||||
|
|
||||||
# The "test" directory.
|
# The "test" directory.
|
||||||
SET(TEST_DIR ${CMAKE_CURRENT_BINARY_DIR}/test)
|
set(TEST_DIR ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
|
|
||||||
# The directory into which fish is installed.
|
# The directory into which fish is installed.
|
||||||
SET(TEST_INSTALL_DIR ${TEST_DIR}/buildroot)
|
set(TEST_INSTALL_DIR ${TEST_DIR}/buildroot)
|
||||||
|
|
||||||
# The directory where the tests expect to find the fish root (./bin, etc)
|
# The directory where the tests expect to find the fish root (./bin, etc)
|
||||||
SET(TEST_ROOT_DIR ${TEST_DIR}/root)
|
set(TEST_ROOT_DIR ${TEST_DIR}/root)
|
||||||
|
|
||||||
# Copy tests files.
|
# Copy tests files.
|
||||||
FILE(GLOB TESTS_FILES tests/*)
|
file(GLOB TESTS_FILES tests/*)
|
||||||
ADD_CUSTOM_TARGET(tests_dir DEPENDS tests)
|
add_custom_target(tests_dir DEPENDS tests)
|
||||||
|
|
||||||
IF(NOT FISH_IN_TREE_BUILD)
|
if(NOT FISH_IN_TREE_BUILD)
|
||||||
ADD_CUSTOM_COMMAND(TARGET tests_dir
|
add_custom_command(TARGET tests_dir
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
${CMAKE_SOURCE_DIR}/tests/ ${CMAKE_BINARY_DIR}/tests/
|
${CMAKE_SOURCE_DIR}/tests/ ${CMAKE_BINARY_DIR}/tests/
|
||||||
COMMENT "Copying test files to binary dir"
|
COMMENT "Copying test files to binary dir"
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
|
||||||
ADD_DEPENDENCIES(fish_tests tests_dir)
|
add_dependencies(fish_tests tests_dir)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Copy littlecheck.py
|
# Copy littlecheck.py
|
||||||
CONFIGURE_FILE(build_tools/littlecheck.py littlecheck.py COPYONLY)
|
configure_file(build_tools/littlecheck.py littlecheck.py COPYONLY)
|
||||||
|
|
||||||
# Make the directory in which to run tests.
|
# Make the directory in which to run tests.
|
||||||
# Also symlink fish to where the tests expect it to be.
|
# Also symlink fish to where the tests expect it to be.
|
||||||
# Lastly put fish_test_helper there too.
|
# Lastly put fish_test_helper there too.
|
||||||
ADD_CUSTOM_TARGET(tests_buildroot_target
|
add_custom_target(tests_buildroot_target
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_INSTALL_DIR}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_INSTALL_DIR}
|
||||||
COMMAND DESTDIR=${TEST_INSTALL_DIR} ${CMAKE_COMMAND}
|
COMMAND DESTDIR=${TEST_INSTALL_DIR} ${CMAKE_COMMAND}
|
||||||
--build ${CMAKE_CURRENT_BINARY_DIR} --target install
|
--build ${CMAKE_CURRENT_BINARY_DIR} --target install
|
||||||
|
@ -43,20 +43,20 @@ ADD_CUSTOM_TARGET(tests_buildroot_target
|
||||||
${TEST_ROOT_DIR}
|
${TEST_ROOT_DIR}
|
||||||
DEPENDS fish fish_test_helper)
|
DEPENDS fish fish_test_helper)
|
||||||
|
|
||||||
IF(NOT FISH_IN_TREE_BUILD)
|
if(NOT FISH_IN_TREE_BUILD)
|
||||||
# We need to symlink share/functions for the tests.
|
# We need to symlink share/functions for the tests.
|
||||||
# This should be simplified.
|
# This should be simplified.
|
||||||
ADD_CUSTOM_TARGET(symlink_functions
|
add_custom_target(symlink_functions
|
||||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/share/functions
|
${CMAKE_CURRENT_SOURCE_DIR}/share/functions
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/share/functions)
|
${CMAKE_CURRENT_BINARY_DIR}/share/functions)
|
||||||
ADD_DEPENDENCIES(tests_buildroot_target symlink_functions)
|
add_dependencies(tests_buildroot_target symlink_functions)
|
||||||
ELSE()
|
else()
|
||||||
ADD_CUSTOM_TARGET(symlink_functions)
|
add_custom_target(symlink_functions)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# Prep the environment for running the unit tests.
|
# Prep the environment for running the unit tests.
|
||||||
ADD_CUSTOM_TARGET(test_prep
|
add_custom_target(test_prep
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/data
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/data
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/home
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/home
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/temp
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TEST_DIR}/temp
|
||||||
|
@ -69,46 +69,46 @@ ADD_CUSTOM_TARGET(test_prep
|
||||||
# Each test is conceptually independent.
|
# Each test is conceptually independent.
|
||||||
# However when running all tests, we want to run them serially for sanity's sake.
|
# However when running all tests, we want to run them serially for sanity's sake.
|
||||||
# So define both a normal target, and a serial variant which enforces ordering.
|
# So define both a normal target, and a serial variant which enforces ordering.
|
||||||
FOREACH(TESTTYPE test serial_test)
|
foreach(TESTTYPE test serial_test)
|
||||||
ADD_CUSTOM_TARGET(${TESTTYPE}_low_level
|
add_custom_target(${TESTTYPE}_low_level
|
||||||
COMMAND env XDG_DATA_HOME=test/data XDG_CONFIG_HOME=test/home ./fish_tests
|
COMMAND env XDG_DATA_HOME=test/data XDG_CONFIG_HOME=test/home ./fish_tests
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS fish_tests
|
DEPENDS fish_tests
|
||||||
USES_TERMINAL)
|
USES_TERMINAL)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(${TESTTYPE}_fishscript
|
add_custom_target(${TESTTYPE}_fishscript
|
||||||
COMMAND cd tests && ${TEST_ROOT_DIR}/bin/fish test.fish
|
COMMAND cd tests && ${TEST_ROOT_DIR}/bin/fish test.fish
|
||||||
DEPENDS test_prep
|
DEPENDS test_prep
|
||||||
USES_TERMINAL)
|
USES_TERMINAL)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(${TESTTYPE}_interactive
|
add_custom_target(${TESTTYPE}_interactive
|
||||||
COMMAND cd tests && ${TEST_ROOT_DIR}/bin/fish interactive.fish
|
COMMAND cd tests && ${TEST_ROOT_DIR}/bin/fish interactive.fish
|
||||||
DEPENDS test_prep
|
DEPENDS test_prep
|
||||||
USES_TERMINAL)
|
USES_TERMINAL)
|
||||||
ENDFOREACH(TESTTYPE)
|
endforeach(TESTTYPE)
|
||||||
|
|
||||||
# Now add a dependency chain between the serial versions.
|
# Now add a dependency chain between the serial versions.
|
||||||
# This ensures they run in order.
|
# This ensures they run in order.
|
||||||
ADD_DEPENDENCIES(serial_test_fishscript serial_test_low_level)
|
add_dependencies(serial_test_fishscript serial_test_low_level)
|
||||||
ADD_DEPENDENCIES(serial_test_interactive serial_test_fishscript)
|
add_dependencies(serial_test_interactive serial_test_fishscript)
|
||||||
|
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(serial_test_high_level
|
add_custom_target(serial_test_high_level
|
||||||
DEPENDS serial_test_interactive serial_test_fishscript)
|
DEPENDS serial_test_interactive serial_test_fishscript)
|
||||||
|
|
||||||
# Create the 'test' target.
|
# Create the 'test' target.
|
||||||
# Set a policy so CMake stops complaining about the name 'test'.
|
# Set a policy so CMake stops complaining about the name 'test'.
|
||||||
CMAKE_POLICY(PUSH)
|
cmake_policy(PUSH)
|
||||||
|
|
||||||
IF(${CMAKE_VERSION} VERSION_LESS 3.11.0 AND POLICY CMP0037)
|
if(${CMAKE_VERSION} VERSION_LESS 3.11.0 AND POLICY CMP0037)
|
||||||
CMAKE_POLICY(SET CMP0037 OLD)
|
cmake_policy(SET CMP0037 OLD)
|
||||||
ENDIF()
|
endif()
|
||||||
ADD_CUSTOM_TARGET(test)
|
add_custom_target(test)
|
||||||
CMAKE_POLICY(POP)
|
cmake_policy(POP)
|
||||||
ADD_DEPENDENCIES(test serial_test_high_level)
|
add_dependencies(test serial_test_high_level)
|
||||||
|
|
||||||
# Group test targets into a TestTargets folder
|
# Group test targets into a TestTargets folder
|
||||||
SET_PROPERTY(TARGET test tests_dir
|
set_property(TARGET test tests_dir
|
||||||
test_low_level
|
test_low_level
|
||||||
test_fishscript
|
test_fishscript
|
||||||
test_interactive
|
test_interactive
|
||||||
|
|
|
@ -31,25 +31,25 @@
|
||||||
# stays the same (incremental builds must be fast).
|
# stays the same (incremental builds must be fast).
|
||||||
|
|
||||||
# Just a handy abbreviation.
|
# Just a handy abbreviation.
|
||||||
SET(FBVF FISH-BUILD-VERSION-FILE)
|
set(FBVF FISH-BUILD-VERSION-FILE)
|
||||||
|
|
||||||
# TODO: find a cleaner way to do this.
|
# TODO: find a cleaner way to do this.
|
||||||
IF (${CMAKE_GENERATOR} STREQUAL Ninja)
|
IF (${CMAKE_GENERATOR} STREQUAL Ninja)
|
||||||
SET(FBVF-OUTPUT fish-build-version-witness.txt)
|
set(FBVF-OUTPUT fish-build-version-witness.txt)
|
||||||
SET(CFBVF-BYPRODUCTS ${FBVF})
|
set(CFBVF-BYPRODUCTS ${FBVF})
|
||||||
ELSE(${CMAKE_GENERATOR} STREQUAL Ninja)
|
else(${CMAKE_GENERATOR} STREQUAL Ninja)
|
||||||
SET(FBVF-OUTPUT ${FBVF})
|
set(FBVF-OUTPUT ${FBVF})
|
||||||
SET(CFBVF-BYPRODUCTS)
|
set(CFBVF-BYPRODUCTS)
|
||||||
ENDIF(${CMAKE_GENERATOR} STREQUAL Ninja)
|
endif(${CMAKE_GENERATOR} STREQUAL Ninja)
|
||||||
|
|
||||||
# Set up the version targets
|
# Set up the version targets
|
||||||
ADD_CUSTOM_TARGET(CHECK-FISH-BUILD-VERSION-FILE
|
add_custom_target(CHECK-FISH-BUILD-VERSION-FILE
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh ${CMAKE_CURRENT_BINARY_DIR}
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
BYPRODUCTS ${CFBVF-BYPRODUCTS})
|
BYPRODUCTS ${CFBVF-BYPRODUCTS})
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(OUTPUT ${FBVF-OUTPUT}
|
add_custom_command(OUTPUT ${FBVF-OUTPUT}
|
||||||
DEPENDS CHECK-FISH-BUILD-VERSION-FILE)
|
DEPENDS CHECK-FISH-BUILD-VERSION-FILE)
|
||||||
|
|
||||||
# Abbreviation for the target.
|
# Abbreviation for the target.
|
||||||
SET(CFBVF CHECK-FISH-BUILD-VERSION-FILE)
|
set(CFBVF CHECK-FISH-BUILD-VERSION-FILE)
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
SET(languages de en fr nb nn pl pt_BR sv zh_CN)
|
set(languages de en fr nb nn pl pt_BR sv zh_CN)
|
||||||
|
|
||||||
INCLUDE(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
OPTION(WITH_GETTEXT "translate messages if gettext is available" ON)
|
option(WITH_GETTEXT "translate messages if gettext is available" ON)
|
||||||
IF(WITH_GETTEXT)
|
if(WITH_GETTEXT)
|
||||||
FIND_PACKAGE(Intl)
|
find_package(Intl)
|
||||||
FIND_PACKAGE(Gettext)
|
find_package(Gettext)
|
||||||
IF(GETTEXT_FOUND)
|
if(GETTEXT_FOUND)
|
||||||
SET(HAVE_GETTEXT 1)
|
set(HAVE_GETTEXT 1)
|
||||||
INCLUDE_DIRECTORIES(${Intl_INCLUDE_DIR})
|
include_directories(${Intl_INCLUDE_DIR})
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
ADD_FEATURE_INFO(gettext GETTEXT_FOUND "translate messages with gettext")
|
add_feature_info(gettext GETTEXT_FOUND "translate messages with gettext")
|
||||||
|
|
||||||
# Define translations
|
# Define translations
|
||||||
IF(GETTEXT_FOUND)
|
if(GETTEXT_FOUND)
|
||||||
FOREACH(lang ${languages})
|
foreach(lang ${languages})
|
||||||
# Our translations aren't set up entirely as CMake expects, so installation is done in
|
# Our translations aren't set up entirely as CMake expects, so installation is done in
|
||||||
# cmake/Install.cmake instead of using INSTALL_DESTINATION
|
# cmake/Install.cmake instead of using INSTALL_DESTINATION
|
||||||
GETTEXT_PROCESS_PO_FILES(${lang} ALL
|
gettext_process_po_files(${lang} ALL
|
||||||
PO_FILES po/${lang}.po)
|
PO_FILES po/${lang}.po)
|
||||||
ENDFOREACH()
|
endforeach()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
CMAKE_PUSH_CHECK_STATE()
|
cmake_push_check_state()
|
||||||
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Intl_INCLUDE_DIR})
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Intl_INCLUDE_DIR})
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${Intl_LIBRARIES})
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${Intl_LIBRARIES})
|
||||||
# libintl.h can be compiled into the stdlib on some GLibC systems
|
# libintl.h can be compiled into the stdlib on some GLibC systems
|
||||||
IF(Intl_FOUND AND Intl_LIBRARIES)
|
if(Intl_FOUND AND Intl_LIBRARIES)
|
||||||
SET(LIBINTL_INCLUDE "#include <libintl.h>")
|
set(LIBINTL_INCLUDE "#include <libintl.h>")
|
||||||
ENDIF()
|
endif()
|
||||||
CHECK_CXX_SOURCE_COMPILES("
|
check_cxx_source_compiles("
|
||||||
${LIBINTL_INCLUDE}
|
${LIBINTL_INCLUDE}
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
int main () {
|
int main () {
|
||||||
|
@ -40,4 +40,4 @@ int main () {
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
HAVE__NL_MSG_CAT_CNTR)
|
HAVE__NL_MSG_CAT_CNTR)
|
||||||
CMAKE_POP_CHECK_STATE()
|
cmake_pop_check_state()
|
||||||
|
|
Loading…
Reference in a new issue