2017-08-31 13:24:20 -07:00
PROJECT ( fish-shell )
CMAKE_MINIMUM_REQUIRED ( VERSION 3.1 )
# We are C++11.
SET ( CMAKE_CXX_STANDARD 11 )
2017-10-04 21:40:58 -07:00
# 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 )
2017-08-31 13:24:20 -07:00
# All objects that the system needs to build fish, except fish.cpp
SET ( FISH_SRCS
s r c / a u t o l o a d . c p p s r c / b u i l t i n . c p p s r c / b u i l t i n _ b g . c p p s r c / b u i l t i n _ b i n d . c p p
s r c / b u i l t i n _ b l o c k . c p p s r c / b u i l t i n _ b u i l t i n . c p p s r c / b u i l t i n _ c d . c p p
s r c / b u i l t i n _ c o m m a n d . c p p s r c / b u i l t i n _ c o m m a n d l i n e . c p p
s r c / b u i l t i n _ c o m p l e t e . c p p s r c / b u i l t i n _ c o n t a i n s . c p p s r c / b u i l t i n _ d i s o w n . c p p
s r c / b u i l t i n _ e c h o . c p p s r c / b u i l t i n _ e m i t . c p p s r c / b u i l t i n _ e x i t . c p p
s r c / b u i l t i n _ f g . c p p s r c / b u i l t i n _ f u n c t i o n . c p p s r c / b u i l t i n _ f u n c t i o n s . c p p
s r c / b u i l t i n _ a r g p a r s e . c p p s r c / b u i l t i n _ h i s t o r y . c p p s r c / b u i l t i n _ j o b s . c p p
s r c / b u i l t i n _ m a t h . c p p s r c / b u i l t i n _ p r i n t f . c p p s r c / b u i l t i n _ p w d . c p p
s r c / b u i l t i n _ r a n d o m . c p p s r c / b u i l t i n _ r e a d . c p p s r c / b u i l t i n _ r e a l p a t h . c p p
s r c / b u i l t i n _ r e t u r n . c p p s r c / b u i l t i n _ s e t . c p p s r c / b u i l t i n _ s e t _ c o l o r . c p p
s r c / b u i l t i n _ s o u r c e . c p p s r c / b u i l t i n _ s t a t u s . c p p s r c / b u i l t i n _ s t r i n g . c p p
s r c / b u i l t i n _ t e s t . c p p s r c / b u i l t i n _ u l i m i t . c p p s r c / c o l o r . c p p s r c / c o m m o n . c p p
s r c / c o m p l e t e . c p p s r c / e n v . c p p s r c / e n v _ u n i v e r s a l _ c o m m o n . c p p s r c / e v e n t . c p p
s r c / e x e c . c p p s r c / e x p a n d . c p p s r c / f a l l b a c k . c p p s r c / f i s h _ v e r s i o n . c p p
s r c / f u n c t i o n . c p p s r c / h i g h l i g h t . c p p s r c / h i s t o r y . c p p s r c / i n p u t . c p p
s r c / i n p u t _ c o m m o n . c p p s r c / i n t e r n . c p p s r c / i o . c p p s r c / i o t h r e a d . c p p
s r c / k i l l . c p p s r c / o u t p u t . c p p s r c / p a g e r . c p p s r c / p a r s e _ e x e c u t i o n . c p p
s r c / p a r s e _ p r o d u c t i o n s . c p p s r c / p a r s e _ t r e e . c p p s r c / p a r s e _ u t i l . c p p
s r c / p a r s e r . c p p s r c / p a r s e r _ k e y w o r d s . c p p s r c / p a t h . c p p s r c / p o s t f o r k . c p p
s r c / p r o c . c p p s r c / r e a d e r . c p p s r c / s a n i t y . c p p s r c / s c r e e n . c p p s r c / s i g n a l . c p p
s r c / t o k e n i z e r . c p p s r c / u t f 8 . c p p s r c / u t i l . c p p s r c / w c s t r i n g u t i l . c p p
s r c / w g e t o p t . c p p s r c / w i l d c a r d . c p p s r c / w u t i l . c p p
)
2017-10-04 21:40:58 -07:00
# Header files are just globbed.
FILE ( GLOB FISH_HEADERS src/*.h )
2017-10-04 21:28:55 -07:00
# 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"
D E P E N D S C H E C K - F I S H - B U I L D - V E R S I O N - F I L E )
ADD_CUSTOM_TARGET ( "CHECK-FISH-BUILD-VERSION-FILE"
C O M M A N D $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / b u i l d _ t o o l s / g i t _ v e r s i o n _ g e n . s h )
2017-08-31 13:24:20 -07:00
2017-10-04 21:30:20 -07:00
SET ( FBVF "FISH-BUILD-VERSION-FILE" )
2017-08-31 13:24:20 -07:00
# Set up config.h
INCLUDE ( CMakeFiles/ConfigureChecks.cmake )
CONFIGURE_FILE ( ${ CMAKE_CURRENT_SOURCE_DIR } /config_cmake.h.in
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c o n f i g . h )
INCLUDE_DIRECTORIES ( ${ CMAKE_CURRENT_BINARY_DIR } )
# Set up standard directories.
INCLUDE ( GNUInstallDirs )
ADD_DEFINITIONS ( -D_UNICODE=1
- D F I S H _ B U I L D _ V E R S I O N = " $ { F I S H _ B U I L D _ V E R S I O N } "
- D L O C A L E D I R = " $ { C M A K E _ I N S T A L L _ F U L L _ L O C A L E D I R } "
- D P R E F I X = L " $ { C M A K E _ I N S T A L L _ P R E F I X } "
- D D A T A D I R = L " $ { C M A K E _ I N S T A L L _ F U L L _ D A T A D I R } "
- D S Y S C O N F D I R = L " $ { C M A K E _ I N S T A L L _ F U L L _ S Y S C O N F D I R } "
- D B I N D I R = L " $ { C M A K E _ I N S T A L L _ F U L L _ B I N D I R } "
- D D O C D I R = L " $ { C M A K E _ I N S T A L L _ F U L L _ D O C D I R } " )
2017-10-04 20:31:35 -07:00
# Set up PCRE2
INCLUDE ( CMakeFiles/PCRE2.cmake )
2017-08-31 13:24:20 -07:00
2017-10-04 20:31:35 -07:00
# Set up muparser.
INCLUDE ( CMakeFiles/MuParser.cmake )
2017-08-31 13:24:20 -07:00
2017-09-11 22:58:49 -07:00
# Set up the docs.
INCLUDE ( CMakeFiles/Docs.cmake )
2017-08-31 13:24:20 -07:00
# Define a function to link dependencies.
FUNCTION ( FISH_LINK_DEPS target )
2017-10-04 21:33:43 -07:00
TARGET_LINK_LIBRARIES ( ${ target } fishlib )
2017-08-31 13:24:20 -07:00
ENDFUNCTION ( FISH_LINK_DEPS )
2017-10-04 21:33:43 -07:00
# Define libfish.a.
ADD_LIBRARY ( fishlib STATIC ${ FISH_SRCS } )
2017-10-04 21:40:58 -07:00
TARGET_SOURCES ( fishlib PRIVATE ${ FISH_HEADERS } )
2017-10-04 21:33:43 -07:00
TARGET_LINK_LIBRARIES ( fishlib
2017-10-07 15:50:56 -07:00
$ { C U R S E S _ L I B R A R I E S } T h r e a d s : : T h r e a d s $ { C M A K E _ D L _ L I B S }
2017-10-04 21:33:43 -07:00
$ { P C R E 2 _ L I B } m u p a r s e r )
# builtin_math.cpp needs to see muParser's built header.
ADD_DEPENDENCIES ( fishlib muparser )
2017-08-31 13:24:20 -07:00
# Define fish.
2017-10-04 21:33:43 -07:00
ADD_EXECUTABLE ( fish src/fish.cpp )
2017-09-01 00:31:51 -07:00
FISH_LINK_DEPS ( fish )
2017-08-31 13:24:20 -07:00
2017-09-08 15:19:07 -07:00
# Define fish_indent.
ADD_EXECUTABLE ( fish_indent
2017-10-04 21:33:43 -07:00
s r c / f i s h _ i n d e n t . c p p s r c / p r i n t _ h e l p . c p p )
2017-09-08 15:19:07 -07:00
FISH_LINK_DEPS ( fish_indent )
# Define fish_key_reader.
ADD_EXECUTABLE ( fish_key_reader
2017-10-04 21:33:43 -07:00
s r c / f i s h _ k e y _ r e a d e r . c p p s r c / p r i n t _ h e l p . c p p )
2017-09-08 15:19:07 -07:00
FISH_LINK_DEPS ( fish_key_reader )
2017-09-01 00:31:51 -07:00
# Set up tests.
INCLUDE ( CMakeFiles/Tests.cmake )
2017-10-04 20:45:48 -07:00
# Set up install.
INCLUDE ( CMakeFiles/Install.cmake )