Skip to content

Commit b86534b

Browse files
committed
Auto-format and minimal cleanup to CMake
1 parent 55fda7f commit b86534b

File tree

9 files changed

+1023
-959
lines changed

9 files changed

+1023
-959
lines changed

CMakeLists.txt

Lines changed: 929 additions & 818 deletions
Large diffs are not rendered by default.

Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ endif # WITH_GCOV
965965
EXTRA_DIST += \
966966
cmake/COPYING-CMAKE-SCRIPTS \
967967
cmake/FindEditline.cmake \
968-
cmake/FindPackageHandleStandardArgs.cmake \
969968
cmake/FindReadline.cmake \
970969
cmake/pcre2-config-version.cmake.in \
971970
cmake/pcre2-config.cmake.in \

README

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,6 @@ The distribution should contain the files listed below.
933933
(D) Auxiliary files for cmake support
934934

935935
cmake/COPYING-CMAKE-SCRIPTS
936-
cmake/FindPackageHandleStandardArgs.cmake
937936
cmake/FindEditline.cmake
938937
cmake/FindReadline.cmake
939938
CMakeLists.txt

cmake/FindEditline.cmake

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22

33
if(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY)
44
set(EDITLINE_FOUND TRUE)
5-
else(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY)
6-
FIND_PATH(EDITLINE_INCLUDE_DIR readline.h PATH_SUFFIXES
7-
editline
8-
edit/readline
9-
)
10-
11-
FIND_LIBRARY(EDITLINE_LIBRARY NAMES edit)
5+
else()
6+
find_path(EDITLINE_INCLUDE_DIR readline.h PATH_SUFFIXES editline edit/readline)
7+
8+
find_library(EDITLINE_LIBRARY NAMES edit)
129
include(FindPackageHandleStandardArgs)
13-
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Editline DEFAULT_MSG EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
10+
find_package_handle_standard_args(Editline DEFAULT_MSG EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
1411

15-
MARK_AS_ADVANCED(EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
16-
endif(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY)
12+
mark_as_advanced(EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
13+
endif()

cmake/FindPackageHandleStandardArgs.cmake

Lines changed: 0 additions & 58 deletions
This file was deleted.

cmake/FindReadline.cmake

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,23 @@
55
# GNU Readline library finder
66
if(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
77
set(READLINE_FOUND TRUE)
8-
else(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
9-
FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h
10-
/usr/include/readline
11-
)
12-
13-
# 2008-04-22 The next clause used to read like this:
14-
#
15-
# FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
16-
# FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses )
17-
# include(FindPackageHandleStandardArgs)
18-
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG NCURSES_LIBRARY READLINE_INCLUDE_DIR READLINE_LIBRARY )
19-
#
20-
# I was advised to modify it such that it will find an ncurses library if
21-
# required, but not if one was explicitly given, that is, it allows the
22-
# default to be overridden. PH
8+
else()
9+
find_path(READLINE_INCLUDE_DIR readline/readline.h /usr/include/readline)
10+
11+
# 2008-04-22 The next clause used to read like this:
12+
#
13+
# FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
14+
# FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses )
15+
# include(FindPackageHandleStandardArgs)
16+
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG NCURSES_LIBRARY READLINE_INCLUDE_DIR READLINE_LIBRARY )
17+
#
18+
# I was advised to modify it such that it will find an ncurses library if
19+
# required, but not if one was explicitly given, that is, it allows the
20+
# default to be overridden. PH
2321

24-
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
25-
include(FindPackageHandleStandardArgs)
26-
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY )
22+
find_library(READLINE_LIBRARY NAMES readline)
23+
include(FindPackageHandleStandardArgs)
24+
find_package_handle_standard_args(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY)
2725

28-
MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY)
29-
endif(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
26+
mark_as_advanced(READLINE_INCLUDE_DIR READLINE_LIBRARY)
27+
endif()

cmake/pcre2-config-version.cmake.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ set(PACKAGE_VERSION_PATCH 0)
44
set(PACKAGE_VERSION @PCRE2_MAJOR@.@[email protected])
55

66
# Check whether the requested PACKAGE_FIND_VERSION is compatible
7-
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
8-
PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
7+
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
98
set(PACKAGE_VERSION_COMPATIBLE FALSE)
109
else()
1110
set(PACKAGE_VERSION_COMPATIBLE TRUE)

cmake/pcre2-config.cmake.in

Lines changed: 68 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,49 @@ set(PCRE2_16BIT_NAME pcre2-16)
3030
set(PCRE2_32BIT_NAME pcre2-32)
3131
set(PCRE2_POSIX_NAME pcre2-posix)
3232
find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h DOC "PCRE2 include directory")
33-
if (PCRE2_USE_STATIC_LIBS)
34-
if (MSVC)
33+
if(PCRE2_USE_STATIC_LIBS)
34+
if(MSVC)
3535
set(PCRE2_8BIT_NAME pcre2-8-static)
3636
set(PCRE2_16BIT_NAME pcre2-16-static)
3737
set(PCRE2_32BIT_NAME pcre2-32-static)
3838
set(PCRE2_POSIX_NAME pcre2-posix-static)
39-
endif ()
39+
endif()
4040

4141
set(PCRE2_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
4242
set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
43-
else ()
43+
else()
4444
set(PCRE2_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
45-
if (MINGW AND PCRE2_NON_STANDARD_LIB_PREFIX)
45+
if(MINGW AND PCRE2_NON_STANDARD_LIB_PREFIX)
4646
set(PCRE2_PREFIX "")
47-
endif ()
47+
endif()
4848

4949
set(PCRE2_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
50-
if (MINGW AND PCRE2_NON_STANDARD_LIB_SUFFIX)
50+
if(MINGW AND PCRE2_NON_STANDARD_LIB_SUFFIX)
5151
set(PCRE2_SUFFIX "-0.dll")
5252
elseif(MSVC)
5353
set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
54-
endif ()
55-
endif ()
56-
find_library(PCRE2_8BIT_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX} DOC "8 bit PCRE2 library")
57-
find_library(PCRE2_16BIT_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}d${PCRE2_SUFFIX} DOC "16 bit PCRE2 library")
58-
find_library(PCRE2_32BIT_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}d${PCRE2_SUFFIX} DOC "32 bit PCRE2 library")
59-
find_library(PCRE2_POSIX_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}d${PCRE2_SUFFIX} DOC "8 bit POSIX PCRE2 library")
54+
endif()
55+
endif()
56+
find_library(
57+
PCRE2_8BIT_LIBRARY
58+
NAMES ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX}
59+
DOC "8 bit PCRE2 library"
60+
)
61+
find_library(
62+
PCRE2_16BIT_LIBRARY
63+
NAMES ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}d${PCRE2_SUFFIX}
64+
DOC "16 bit PCRE2 library"
65+
)
66+
find_library(
67+
PCRE2_32BIT_LIBRARY
68+
NAMES ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}d${PCRE2_SUFFIX}
69+
DOC "32 bit PCRE2 library"
70+
)
71+
find_library(
72+
PCRE2_POSIX_LIBRARY
73+
NAMES ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}d${PCRE2_SUFFIX}
74+
DOC "8 bit POSIX PCRE2 library"
75+
)
6076
unset(PCRE2_NON_STANDARD_LIB_PREFIX)
6177
unset(PCRE2_NON_STANDARD_LIB_SUFFIX)
6278
unset(PCRE2_8BIT_NAME)
@@ -65,51 +81,55 @@ unset(PCRE2_32BIT_NAME)
6581
unset(PCRE2_POSIX_NAME)
6682

6783
# Set version
68-
if (PCRE2_INCLUDE_DIR)
84+
if(PCRE2_INCLUDE_DIR)
6985
set(PCRE2_VERSION "@PCRE2_MAJOR@.@[email protected]")
70-
endif ()
86+
endif()
7187

7288
# Which components have been found.
73-
if (PCRE2_8BIT_LIBRARY)
89+
if(PCRE2_8BIT_LIBRARY)
7490
set(PCRE2_8BIT_FOUND TRUE)
75-
endif ()
76-
if (PCRE2_16BIT_LIBRARY)
91+
endif()
92+
if(PCRE2_16BIT_LIBRARY)
7793
set(PCRE2_16BIT_FOUND TRUE)
78-
endif ()
79-
if (PCRE2_32BIT_LIBRARY)
94+
endif()
95+
if(PCRE2_32BIT_LIBRARY)
8096
set(PCRE2_32BIT_FOUND TRUE)
81-
endif ()
82-
if (PCRE2_POSIX_LIBRARY)
97+
endif()
98+
if(PCRE2_POSIX_LIBRARY)
8399
set(PCRE2_POSIX_FOUND TRUE)
84-
endif ()
100+
endif()
85101

86102
# Check if at least one component has been specified.
87103
list(LENGTH PCRE2_FIND_COMPONENTS PCRE2_NCOMPONENTS)
88-
if (PCRE2_NCOMPONENTS LESS 1)
104+
if(PCRE2_NCOMPONENTS LESS 1)
89105
message(FATAL_ERROR "No components have been specified. This is not allowed. Please, specify at least one component.")
90-
endif ()
106+
endif()
91107
unset(PCRE2_NCOMPONENTS)
92108

93109
# When POSIX component has been specified make sure that also 8BIT component is specified.
94110
set(PCRE2_8BIT_COMPONENT FALSE)
95111
set(PCRE2_POSIX_COMPONENT FALSE)
96112
foreach(component ${PCRE2_FIND_COMPONENTS})
97-
if (component STREQUAL "8BIT")
113+
if(component STREQUAL "8BIT")
98114
set(PCRE2_8BIT_COMPONENT TRUE)
99-
elseif (component STREQUAL "POSIX")
115+
elseif(component STREQUAL "POSIX")
100116
set(PCRE2_POSIX_COMPONENT TRUE)
101-
endif ()
117+
endif()
102118
endforeach()
103119

104-
if (PCRE2_POSIX_COMPONENT AND NOT PCRE2_8BIT_COMPONENT)
105-
message(FATAL_ERROR "The component POSIX is specified while the 8BIT one is not. This is not allowed. Please, also specify the 8BIT component.")
120+
if(PCRE2_POSIX_COMPONENT AND NOT PCRE2_8BIT_COMPONENT)
121+
message(
122+
FATAL_ERROR
123+
"The component POSIX is specified while the 8BIT one is not. This is not allowed. Please, also specify the 8BIT component."
124+
)
106125
endif()
107126
unset(PCRE2_8BIT_COMPONENT)
108127
unset(PCRE2_POSIX_COMPONENT)
109128

110129
include(FindPackageHandleStandardArgs)
111130
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
112-
find_package_handle_standard_args(PCRE2
131+
find_package_handle_standard_args(
132+
PCRE2
113133
FOUND_VAR PCRE2_FOUND
114134
REQUIRED_VARS PCRE2_INCLUDE_DIR
115135
HANDLE_COMPONENTS
@@ -118,31 +138,31 @@ find_package_handle_standard_args(PCRE2
118138
)
119139

120140
set(PCRE2_LIBRARIES)
121-
if (PCRE2_FOUND)
141+
if(PCRE2_FOUND)
122142
foreach(component ${PCRE2_FIND_COMPONENTS})
123-
if (PCRE2_USE_STATIC_LIBS)
143+
if(PCRE2_USE_STATIC_LIBS)
124144
add_library(PCRE2::${component} STATIC IMPORTED)
125145
target_compile_definitions(PCRE2::${component} INTERFACE PCRE2_STATIC)
126-
else ()
146+
else()
127147
add_library(PCRE2::${component} SHARED IMPORTED)
128-
endif ()
129-
set_target_properties(PCRE2::${component} PROPERTIES
130-
IMPORTED_LOCATION "${PCRE2_${component}_LIBRARY}"
131-
IMPORTED_IMPLIB "${PCRE2_${component}_LIBRARY}"
132-
INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
148+
endif()
149+
set_target_properties(
150+
PCRE2::${component}
151+
PROPERTIES
152+
IMPORTED_LOCATION "${PCRE2_${component}_LIBRARY}"
153+
IMPORTED_IMPLIB "${PCRE2_${component}_LIBRARY}"
154+
INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
133155
)
134-
if (component STREQUAL "POSIX")
135-
set_target_properties(PCRE2::${component} PROPERTIES
136-
INTERFACE_LINK_LIBRARIES "PCRE2::8BIT"
137-
LINK_LIBRARIES "PCRE2::8BIT"
156+
if(component STREQUAL "POSIX")
157+
set_target_properties(
158+
PCRE2::${component}
159+
PROPERTIES INTERFACE_LINK_LIBRARIES "PCRE2::8BIT" LINK_LIBRARIES "PCRE2::8BIT"
138160
)
139-
endif ()
161+
endif()
140162

141163
set(PCRE2_LIBRARIES ${PCRE2_LIBRARIES} ${PCRE2_${component}_LIBRARY})
142164
mark_as_advanced(PCRE2_${component}_LIBRARY)
143165
endforeach()
144-
endif ()
166+
endif()
145167

146-
mark_as_advanced(
147-
PCRE2_INCLUDE_DIR
148-
)
168+
mark_as_advanced(PCRE2_INCLUDE_DIR)

doc/html/README.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,6 @@ The distribution should contain the files listed below.
933933
(D) Auxiliary files for cmake support
934934

935935
cmake/COPYING-CMAKE-SCRIPTS
936-
cmake/FindPackageHandleStandardArgs.cmake
937936
cmake/FindEditline.cmake
938937
cmake/FindReadline.cmake
939938
CMakeLists.txt

0 commit comments

Comments
 (0)