Skip to content

Commit 4f84d9c

Browse files
committed
cmake: MYSQL_PARSE_ARGUMENTS -> CMAKE_PARSE_ARGUMENTS
1 parent 061f84a commit 4f84d9c

File tree

7 files changed

+57
-89
lines changed

7 files changed

+57
-89
lines changed

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414
# along with this program; if not, write to the Free Software
1515
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1616

17-
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
18-
# Avoid warnings in higher versions
19-
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
20-
CMAKE_POLICY(VERSION 2.8)
21-
endif()
17+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
2218

2319
# explicitly set the policy to OLD
2420
# (cannot use NEW, not everyone is on cmake-2.8.12 yet)

cmake/cmake_parse_arguments.cmake

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

cmake/ctest.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

2-
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
2+
INCLUDE(CMakeParseArguments)
33

44
MACRO(MY_ADD_TEST name)
55
ADD_TEST(${name} ${name}-t)
66
ENDMACRO()
77

88
MACRO(MY_ADD_TESTS)
9-
MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;EXT" "" ${ARGN})
9+
CMAKE_PARSE_ARGUMENTS(ARG "" "EXT" "LINK_LIBRARIES" ${ARGN})
1010

1111
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
1212
${CMAKE_SOURCE_DIR}/unittest/mytap)
@@ -15,7 +15,7 @@ MACRO(MY_ADD_TESTS)
1515
SET(ARG_EXT "c")
1616
ENDIF()
1717

18-
FOREACH(name ${ARG_DEFAULT_ARGS})
18+
FOREACH(name ${ARG_UNPARSED_ARGUMENTS})
1919
ADD_EXECUTABLE(${name}-t "${name}-t.${ARG_EXT}")
2020
TARGET_LINK_LIBRARIES(${name}-t mytap ${ARG_LINK_LIBRARIES})
2121
MY_ADD_TEST(${name})

cmake/install_macros.cmake

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
# along with this program; if not, write to the Free Software
1414
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515

16-
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
17-
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
16+
INCLUDE(CMakeParseArguments)
1817

1918
FUNCTION (INSTALL_DEBUG_SYMBOLS)
2019
IF(MSVC)
21-
MYSQL_PARSE_ARGUMENTS(ARG
20+
CMAKE_PARSE_ARGUMENTS(ARG
21+
""
2222
"COMPONENT;INSTALL_LOCATION"
2323
""
2424
${ARGN}
@@ -30,7 +30,7 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
3030
IF(NOT ARG_INSTALL_LOCATION)
3131
SET(ARG_INSTALL_LOCATION lib)
3232
ENDIF()
33-
SET(targets ${ARG_DEFAULT_ARGS})
33+
SET(targets ${ARG_UNPARSED_ARGUMENTS})
3434
FOREACH(target ${targets})
3535
GET_TARGET_PROPERTY(type ${target} TYPE)
3636
GET_TARGET_PROPERTY(location ${target} LOCATION)
@@ -110,13 +110,14 @@ FUNCTION(INSTALL_MANPAGE file)
110110
ENDFUNCTION()
111111

112112
FUNCTION(INSTALL_SCRIPT)
113-
MYSQL_PARSE_ARGUMENTS(ARG
113+
CMAKE_PARSE_ARGUMENTS(ARG
114+
""
114115
"DESTINATION;COMPONENT"
115116
""
116117
${ARGN}
117118
)
118119

119-
SET(script ${ARG_DEFAULT_ARGS})
120+
SET(script ${ARG_UNPARSED_ARGUMENTS})
120121
IF(NOT ARG_DESTINATION)
121122
SET(ARG_DESTINATION ${INSTALL_BINDIR})
122123
ENDIF()
@@ -132,8 +133,8 @@ ENDFUNCTION()
132133

133134

134135
FUNCTION(INSTALL_DOCUMENTATION)
135-
MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
136-
SET(files ${ARG_DEFAULT_ARGS})
136+
CMAKE_PARSE_ARGUMENTS(ARG "" "COMPONENT" "" ${ARGN})
137+
SET(files ${ARG_UNPARSED_ARGUMENTS})
137138
IF(NOT ARG_COMPONENT)
138139
SET(ARG_COMPONENT Server)
139140
ENDIF()
@@ -212,8 +213,8 @@ IF(WIN32)
212213
ENDIF()
213214

214215
MACRO(SIGN_TARGET)
215-
MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
216-
SET(target ${ARG_DEFAULT_ARGS})
216+
CMAKE_PARSE_ARGUMENTS(ARG "" "COMPONENT" "" ${ARGN})
217+
SET(target ${ARG_UNPARSED_ARGUMENTS})
217218
IF(ARG_COMPONENT)
218219
SET(comp COMPONENT ${ARG_COMPONENT})
219220
ELSE()
@@ -248,8 +249,9 @@ ENDMACRO()
248249
#
249250

250251
FUNCTION(MYSQL_INSTALL_TARGETS)
251-
MYSQL_PARSE_ARGUMENTS(ARG
252-
"DESTINATION;COMPONENT"
252+
CMAKE_PARSE_ARGUMENTS(ARG
253+
""
254+
"DESTINATION;COMPONENT"
253255
""
254256
${ARGN}
255257
)
@@ -259,18 +261,17 @@ FUNCTION(MYSQL_INSTALL_TARGETS)
259261
MESSAGE(FATAL_ERROR "COMPONENT argument required")
260262
ENDIF()
261263

262-
SET(TARGETS ${ARG_DEFAULT_ARGS})
264+
SET(TARGETS ${ARG_UNPARSED_ARGUMENTS})
263265
IF(NOT TARGETS)
264266
MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS")
265267
ENDIF()
266268
IF(NOT ARG_DESTINATION)
267269
MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS")
268270
ENDIF()
269271

270-
271272
FOREACH(target ${TARGETS})
272273
# If signing is required, sign executables before installing
273-
IF(SIGNCODE)
274+
IF(SIGNCODE)
274275
SIGN_TARGET(${target} ${COMP})
275276
ENDIF()
276277
# Install man pages on Unix
@@ -293,7 +294,8 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug
293294

294295

295296
FUNCTION(INSTALL_DEBUG_TARGET target)
296-
MYSQL_PARSE_ARGUMENTS(ARG
297+
CMAKE_PARSE_ARGUMENTS(ARG
298+
""
297299
"DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
298300
""
299301
${ARGN}

cmake/libutils.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ IF(WIN32 OR CYGWIN OR APPLE OR WITH_PIC OR DISABLE_SHARED OR NOT CMAKE_SHARED_LI
5757
SET(_SKIP_PIC 1)
5858
ENDIF()
5959

60-
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
60+
INCLUDE(CMakeParseArguments)
6161
# CREATE_EXPORT_FILE (VAR target api_functions)
6262
# Internal macro, used to create source file for shared libraries that
6363
# otherwise consists entirely of "convenience" libraries. On Windows,
@@ -213,13 +213,14 @@ ENDMACRO()
213213
# [OUTPUT_NAME output_name]
214214
#)
215215
MACRO(MERGE_LIBRARIES)
216-
MYSQL_PARSE_ARGUMENTS(ARG
217-
"EXPORTS;OUTPUT_NAME;COMPONENT;VERSION;SOVERSION"
216+
CMAKE_PARSE_ARGUMENTS(ARG
218217
"STATIC;SHARED;MODULE;NOINSTALL"
218+
"OUTPUT_NAME;COMPONENT;VERSION;SOVERSION"
219+
"EXPORTS"
219220
${ARGN}
220221
)
221-
LIST(GET ARG_DEFAULT_ARGS 0 TARGET)
222-
SET(LIBS ${ARG_DEFAULT_ARGS})
222+
LIST(GET ARG_UNPARSED_ARGUMENTS 0 TARGET)
223+
SET(LIBS ${ARG_UNPARSED_ARGUMENTS})
223224
LIST(REMOVE_AT LIBS 0)
224225
IF(ARG_STATIC)
225226
IF (NOT ARG_OUTPUT_NAME)

cmake/mysql_add_executable.cmake

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,37 @@
2424
# - add version resource
2525
# - instruct CPack to do autenticode signing if SIGNCODE is set
2626

27-
INCLUDE(cmake_parse_arguments)
27+
INCLUDE(CMakeParseArguments)
2828

2929
FUNCTION (MYSQL_ADD_EXECUTABLE)
3030
# Pass-through arguments for ADD_EXECUTABLE
31-
MYSQL_PARSE_ARGUMENTS(ARG
32-
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
31+
CMAKE_PARSE_ARGUMENTS(ARG
32+
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL"
33+
"DESTINATION;COMPONENT"
3334
""
3435
${ARGN}
3536
)
36-
LIST(GET ARG_DEFAULT_ARGS 0 target)
37-
LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
37+
LIST(GET ARG_UNPARSED_ARGUMENTS 0 target)
38+
LIST(REMOVE_AT ARG_UNPARSED_ARGUMENTS 0)
3839

39-
SET(sources ${ARG_DEFAULT_ARGS})
40+
SET(sources ${ARG_UNPARSED_ARGUMENTS})
4041
ADD_VERSION_INFO(${target} EXECUTABLE sources)
41-
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
42+
IF (ARG_WIN32)
43+
SET(WIN32 WIN32)
44+
ELSE()
45+
UNSET(WIN32)
46+
ENDIF()
47+
IF (ARG_MACOSX_BUNDLE)
48+
SET(MACOSX_BUNDLE MACOSX_BUNDLE)
49+
ELSE()
50+
UNSET(MACOSX_BUNDLE)
51+
ENDIF()
52+
IF (ARG_EXCLUDE_FROM_ALL)
53+
SET(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
54+
ELSE()
55+
UNSET(EXCLUDE_FROM_ALL)
56+
ENDIF()
57+
ADD_EXECUTABLE(${target} ${WIN32} ${MACOSX_BUNDLE} ${EXCLUDE_FROM_ALL} ${sources})
4258
# tell CPack where to install
4359
IF(NOT ARG_EXCLUDE_FROM_ALL)
4460
IF(NOT ARG_DESTINATION)

cmake/plugin.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1515

1616

17-
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
18-
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
17+
INCLUDE(CMakeParseArguments)
1918

2019
# MYSQL_ADD_PLUGIN(plugin_name source1...sourceN
2120
# [STORAGE_ENGINE]
@@ -28,9 +27,10 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
2827
# [DEPENDENCIES target1...targetN]
2928

3029
MACRO(MYSQL_ADD_PLUGIN)
31-
MYSQL_PARSE_ARGUMENTS(ARG
32-
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
30+
CMAKE_PARSE_ARGUMENTS(ARG
3331
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED"
32+
"MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
33+
"LINK_LIBRARIES;DEPENDENCIES"
3434
${ARGN}
3535
)
3636

@@ -41,8 +41,8 @@ MACRO(MYSQL_ADD_PLUGIN)
4141
${SSL_INCLUDE_DIRS}
4242
${ZLIB_INCLUDE_DIR})
4343

44-
LIST(GET ARG_DEFAULT_ARGS 0 plugin)
45-
SET(SOURCES ${ARG_DEFAULT_ARGS})
44+
LIST(GET ARG_UNPARSED_ARGUMENTS 0 plugin)
45+
SET(SOURCES ${ARG_UNPARSED_ARGUMENTS})
4646
LIST(REMOVE_AT SOURCES 0)
4747
STRING(TOUPPER ${plugin} plugin)
4848
STRING(TOLOWER ${plugin} target)

0 commit comments

Comments
 (0)