diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindZSTD.cmake | 18 | ||||
-rw-r--r-- | cmake/Findzstd.cmake | 25 | ||||
-rw-r--r-- | cmake/create_initial_db.cmake (renamed from cmake/create_initial_db.cmake.in) | 20 | ||||
-rw-r--r-- | cmake/dtrace.cmake | 4 | ||||
-rw-r--r-- | cmake/for_clients.cmake | 3 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 25 | ||||
-rw-r--r-- | cmake/libutils.cmake | 50 | ||||
-rw-r--r-- | cmake/merge_archives_unix.cmake (renamed from cmake/merge_archives_unix.cmake.in) | 11 | ||||
-rw-r--r-- | cmake/mysql_add_executable.cmake | 3 | ||||
-rw-r--r-- | cmake/package_name.cmake | 5 | ||||
-rw-r--r-- | cmake/systemd.cmake | 10 |
11 files changed, 85 insertions, 89 deletions
diff --git a/cmake/FindZSTD.cmake b/cmake/FindZSTD.cmake deleted file mode 100644 index 0fd73501327..00000000000 --- a/cmake/FindZSTD.cmake +++ /dev/null @@ -1,18 +0,0 @@ -find_path( - ZSTD_INCLUDE_DIR - NAMES "zstd.h" -) - -find_library( - ZSTD_LIBRARY - NAMES zstd -) - -set(ZSTD_LIBRARIES ${ZSTD_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - ZSTD DEFAULT_MSG ZSTD_INCLUDE_DIR ZSTD_LIBRARIES) - -mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARIES ZSTD_FOUND) - diff --git a/cmake/Findzstd.cmake b/cmake/Findzstd.cmake new file mode 100644 index 00000000000..8cd4c248145 --- /dev/null +++ b/cmake/Findzstd.cmake @@ -0,0 +1,25 @@ +# - Find zstd +# Find the zstd compression library and includes +# +# ZSTD_INCLUDE_DIR - where to find zstd.h, etc. +# ZSTD_LIBRARIES - List of libraries when using zstd. +# ZSTD_FOUND - True if zstd found. + +if (DEFINED ZSTD_LIBRARIES) + return() +endif() + +find_path(ZSTD_INCLUDE_DIR + NAMES zstd.h + HINTS ${ZSTD_ROOT_DIR}/include) + +find_library(ZSTD_LIBRARIES + NAMES zstd + HINTS ${ZSTD_ROOT_DIR}/lib) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(zstd DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR) + +mark_as_advanced( + ZSTD_LIBRARIES + ZSTD_INCLUDE_DIR) diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake index baa48847815..df972cf379a 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake @@ -14,11 +14,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # This script creates initial database for packaging on Windows -SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@") -SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@") -SET(MYSQLD_EXECUTABLE "@MYSQLD_EXECUTABLE@") -SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@") -SET(WIN32 "@WIN32@") # Force Visual Studio to output to stdout IF(ENV{VS_UNICODE_OUTPUT}) SET ($ENV{VS_UNICODE_OUTPUT}) @@ -32,30 +27,27 @@ ENDIF() # Create bootstrapper SQL script FILE(WRITE bootstrap.sql "use mysql;\n" ) FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql mysql_performance_tables.sql) - FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS) + FILE(STRINGS ${TOP_SRCDIR}/scripts/${FILENAME} CONTENTS) FOREACH(STR ${CONTENTS}) IF(NOT STR MATCHES "@current_hostname") FILE(APPEND bootstrap.sql "${STR}\n") ENDIF() ENDFOREACH() ENDFOREACH() -FILE(READ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql CONTENTS) +FILE(READ ${TOP_SRCDIR}/scripts/fill_help_tables.sql CONTENTS) FILE(APPEND bootstrap.sql "${CONTENTS}") FILE(REMOVE_RECURSE mysql performance_schema) FILE(REMOVE ibdata1 ib_logfile0 ib_logfile1) MAKE_DIRECTORY(mysql) -IF(WIN32) - SET(CONSOLE --console) -ENDIF() SET(BOOTSTRAP_COMMAND ${MYSQLD_EXECUTABLE} --no-defaults - ${CONSOLE} + --console --bootstrap - --lc-messages-dir=${CMAKE_CURRENT_BINARY_DIR}/share + --lc-messages-dir=${BINDIR}/share --basedir=. --datadir=. --default-storage-engine=MyISAM @@ -65,10 +57,10 @@ SET(BOOTSTRAP_COMMAND GET_FILENAME_COMPONENT(CWD . ABSOLUTE) EXECUTE_PROCESS( - COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND} + COMMAND "${CMAKE_COMMAND}" -E echo Executing ${BOOTSTRAP_COMMAND} ) EXECUTE_PROCESS ( - COMMAND "@CMAKE_COMMAND@" -E + COMMAND "${CMAKE_COMMAND}" -E echo input file bootstrap.sql, current directory ${CWD} ) EXECUTE_PROCESS ( diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index d7ab0f31991..bb45eaf865b 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -46,6 +46,10 @@ MACRO(CHECK_DTRACE) AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace") ENDIF() + # On GNU/Hurd, dtrace is not supported + IF(DTRACE AND CMAKE_SYSTEM_NAME MATCHES "GNU") + SET(ENABLE_DTRACE OFF CACHE BOOL "Disable dtrace") + ENDIF() SET(HAVE_DTRACE ${ENABLE_DTRACE}) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") IF(CMAKE_SIZEOF_VOID_P EQUAL 4) diff --git a/cmake/for_clients.cmake b/cmake/for_clients.cmake index e5916c56ddc..2c2c965df64 100644 --- a/cmake/for_clients.cmake +++ b/cmake/for_clients.cmake @@ -11,9 +11,6 @@ SET(LIBS "") IF(POLICY CMP0011) CMAKE_POLICY(SET CMP0011 NEW) ENDIF() -IF(POLICY CMP0007) - CMAKE_POLICY(SET CMP0007 OLD) -ENDIF() # Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable # returned string in ${var} is can be passed to linker's command line diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 5ca147d0d60..71657e32308 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -115,7 +115,12 @@ FUNCTION(INSTALL_SCRIPT) SET(COMP) ENDIF() + IF (COMP MATCHES ${SKIP_COMPONENTS}) + RETURN() + ENDIF() + INSTALL(PROGRAMS ${script} DESTINATION ${ARG_DESTINATION} ${COMP}) + INSTALL_MANPAGE(${script}) ENDFUNCTION() @@ -132,6 +137,10 @@ FUNCTION(INSTALL_DOCUMENTATION) SET(destination ${INSTALL_DOCDIR}) ENDIF() + IF (ARG_COMPONENT MATCHES ${SKIP_COMPONENTS}) + RETURN() + ENDIF() + STRING(TOUPPER ${ARG_COMPONENT} COMPUP) IF(CPACK_COMPONENT_${COMPUP}_GROUP) SET(group ${CPACK_COMPONENT_${COMPUP}_GROUP}) @@ -150,21 +159,17 @@ ENDFUNCTION() # Install symbolic link to CMake target. -# the link is created in the same directory as target +# the link is created in the current build directory # and extension will be the same as for target file. MACRO(INSTALL_SYMLINK linkname target destination component) IF(UNIX) - GET_TARGET_PROPERTY(location ${target} LOCATION) - GET_FILENAME_COMPONENT(path ${location} PATH) - GET_FILENAME_COMPONENT(name ${location} NAME) - SET(output ${path}/${linkname}) + SET(output ${CMAKE_CURRENT_BINARY_DIR}/${linkname}) ADD_CUSTOM_COMMAND( OUTPUT ${output} - COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output} + COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${linkname} COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink - ${name} + $<TARGET_FILE_NAME:${target}> ${linkname} - WORKING_DIRECTORY ${path} DEPENDS ${target} ) @@ -250,8 +255,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS) ENDIF() # Install man pages on Unix IF(UNIX) - GET_TARGET_PROPERTY(target_location ${target} LOCATION) - INSTALL_MANPAGE(${target_location}) + INSTALL_MANPAGE($<TARGET_FILE:${target}>) ENDIF() ENDFOREACH() @@ -268,6 +272,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug FUNCTION(INSTALL_DEBUG_TARGET target) + RETURN() # XXX unused? CMAKE_PARSE_ARGUMENTS(ARG "" "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT" diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index a31fe0d4510..cdc7af5d228 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -139,17 +139,17 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) SET(OSLIBS) FOREACH(LIB ${LIBS_TO_MERGE}) - GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION) - GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE) - IF(NOT LIB_LOCATION) + IF(NOT TARGET ${LIB}) # 3rd party library like libz.so. Make sure that everything # that links to our library links to this one as well. LIST(APPEND OSLIBS ${LIB}) ELSE() + GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE) # This is a target in current project # (can be a static or shared lib) IF(LIB_TYPE STREQUAL "STATIC_LIBRARY") - SET(STATIC_LIBS ${STATIC_LIBS} ${LIB_LOCATION}) + SET(STATIC_TGTS ${STATIC_TGTS} ${LIB}) + SET(STATIC_LIBS ${STATIC_LIBS} $<TARGET_FILE:${LIB}>) ADD_DEPENDENCIES(${TARGET} ${LIB}) # Extract dependent OS libraries GET_DEPENDEND_OS_LIBS(${LIB} LIB_OSLIBS) @@ -171,7 +171,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) ADD_CUSTOM_COMMAND( OUTPUT ${SOURCE_FILE} COMMAND ${CMAKE_COMMAND} -E touch ${SOURCE_FILE} - DEPENDS ${STATIC_LIBS}) + DEPENDS ${STATIC_TGTS}) IF(MSVC) # To merge libs, just pass them to lib.exe command line. @@ -182,29 +182,27 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS "${LINKER_EXTRA_FLAGS}") ELSE() - GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION) IF(APPLE) # Use OSX's libtool to merge archives (ihandles universal # binaries properly) ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD - COMMAND rm ${TARGET_LOCATION} - COMMAND libtool -static -o ${TARGET_LOCATION} + COMMAND rm $<TARGET_FILE:${TARGET}> + COMMAND libtool -static -o $<TARGET_FILE:${TARGET}> ${STATIC_LIBS} ) ELSE() # Generic Unix, Cygwin or MinGW. In post-build step, call # script, that extracts objects from archives with "ar x" # and repacks them with "ar r" - SET(TARGET ${TARGET}) - CONFIGURE_FILE( - ${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake - @ONLY - ) ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD - COMMAND rm ${TARGET_LOCATION} - COMMAND ${CMAKE_COMMAND} -P - ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake + COMMAND ${CMAKE_COMMAND} + -DTARGET_LOCATION="$<TARGET_FILE:${TARGET}>" + -DTARGET="${TARGET}" + -DSTATIC_LIBS="${STATIC_LIBS}" + -DCMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}" + -DCMAKE_AR="${CMAKE_AR}" + -DCMAKE_RANLIB="${CMAKE_RANLIB}" + -P "${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake" ) ENDIF() ENDIF() @@ -269,7 +267,7 @@ MACRO(MERGE_LIBRARIES) IF (ARG_SOVERSION) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SOVERSION ${ARG_VERSION}) ENDIF() - TARGET_LINK_LIBRARIES(${TARGET} ${LIBS}) + TARGET_LINK_LIBRARIES(${TARGET} LINK_PRIVATE ${LIBS}) IF(ARG_OUTPUT_NAME) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME "${ARG_OUTPUT_NAME}") ENDIF() @@ -282,7 +280,6 @@ MACRO(MERGE_LIBRARIES) ENDIF() MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}" ${COMP}) ENDIF() - SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_INTERFACE_LIBRARIES "") IF(ARG_SHARED AND LINK_FLAG_NO_UNDEFINED) # Do not allow undefined symbols in shared libraries GET_TARGET_PROPERTY(TARGET_LINK_FLAGS ${TARGET} LINK_FLAGS) @@ -295,18 +292,11 @@ MACRO(MERGE_LIBRARIES) ENDMACRO() FUNCTION(GET_DEPENDEND_OS_LIBS target result) - SET(deps ${${target}_LIB_DEPENDS}) - IF(deps) - FOREACH(lib ${deps}) - # Filter out keywords for used for debug vs optimized builds - IF(NOT lib MATCHES "general" AND NOT lib MATCHES "debug" AND NOT lib MATCHES "optimized") - GET_TARGET_PROPERTY(lib_location ${lib} LOCATION) - IF(NOT lib_location) - SET(ret ${ret} ${lib}) - ENDIF() + FOREACH(lib ${${target}_LIB_DEPENDS}) + IF(NOT TARGET ${lib}) + SET(ret ${ret} ${lib}) ENDIF() - ENDFOREACH() - ENDIF() + ENDFOREACH() SET(${result} ${ret} PARENT_SCOPE) ENDFUNCTION() diff --git a/cmake/merge_archives_unix.cmake.in b/cmake/merge_archives_unix.cmake index d05336d6c91..08b1931c3d3 100644 --- a/cmake/merge_archives_unix.cmake.in +++ b/cmake/merge_archives_unix.cmake @@ -14,19 +14,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# This script merges many static libraries into -# one big library on Unix. -SET(TARGET_LOCATION "@TARGET_LOCATION@") -SET(TARGET "@TARGET@") -SET(STATIC_LIBS "@STATIC_LIBS@") -SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@") -SET(CMAKE_AR "@CMAKE_AR@") -SET(CMAKE_RANLIB "@CMAKE_RANLIB@") - +FILE(REMOVE "${TARGET_LOCATION}") SET(TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}) MAKE_DIRECTORY(${TEMP_DIR}) # Extract each archive to its own subdirectory(avoid object filename clashes) +SEPARATE_ARGUMENTS(STATIC_LIBS UNIX_COMMAND "${STATIC_LIBS}") FOREACH(LIB ${STATIC_LIBS}) GET_FILENAME_COMPONENT(NAME_NO_EXT ${LIB} NAME_WE) SET(TEMP_SUBDIR ${TEMP_DIR}/${NAME_NO_EXT}) diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index de4d49a7cd1..c61a23a978f 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -75,6 +75,9 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) ELSE() SET(COMP COMPONENT Client) ENDIF() + IF (COMP MATCHES ${SKIP_COMPONENTS}) + RETURN() + ENDIF() MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP}) ENDIF() ENDFUNCTION() diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index 4930a6bf40a..73a53b0766a 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -77,6 +77,9 @@ IF(NOT VERSION) SET(DEFAULT_MACHINE "i386") ENDIF() ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "GNU") + SET(DEFAULT_PLATFORM "GNU") + SET(DEFAULT_MACHINE "i386") ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") IF(CMAKE_OSX_DEPLOYMENT_TARGET) SET(DEFAULT_PLATFORM "osx${CMAKE_OSX_DEPLOYMENT_TARGET}") @@ -132,7 +135,7 @@ IF(NOT VERSION) SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") - MESSAGE(STATUS "Packaging as: ${package_name}") + MESSAGE_ONCE(package_name "Packaging as: ${package_name}") # Sometimes package suffix is added (something like "-icc-glibc23") IF(PACKAGE_SUFFIX) diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake index f7365066ef6..fc36d7cefbf 100644 --- a/cmake/systemd.cmake +++ b/cmake/systemd.cmake @@ -20,10 +20,12 @@ MACRO(CHECK_SYSTEMD) SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and notification support") IF(WITH_SYSTEMD STREQUAL "yes" OR WITH_SYSTEMD STREQUAL "auto") IF(PKG_CONFIG_FOUND) - IF(WITH_SYSTEMD STREQUAL "yes") - pkg_search_module(LIBSYSTEMD REQUIRED libsystemd libsystemd-daemon) - ELSE() - pkg_search_module(LIBSYSTEMD libsystemd libsystemd-daemon) + IF (NOT DEFINED LIBSYSTEMD_FOUND) + IF(WITH_SYSTEMD STREQUAL "yes") + pkg_search_module(LIBSYSTEMD REQUIRED libsystemd libsystemd-daemon) + ELSE() + pkg_search_module(LIBSYSTEMD libsystemd libsystemd-daemon) + ENDIF() ENDIF() IF(HAVE_DLOPEN) SET(LIBSYSTEMD ${LIBSYSTEMD_LIBRARIES}) |