diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-07-06 04:03:58 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-08-12 11:37:42 +0200 |
commit | 6b53f9d781cc19cbec96c3eb048e6407021685a2 (patch) | |
tree | 71379cc76e9f8294ccabca3a40ed2e7d509c7c5a /cmake | |
parent | 96b8909062c0b4df654f11057905b1e31398f88f (diff) | |
download | mariadb-git-6b53f9d781cc19cbec96c3eb048e6407021685a2.tar.gz |
MDEV-16662 CMake warnings: CMP0026
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/create_initial_db.cmake (renamed from cmake/create_initial_db.cmake.in) | 20 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 16 | ||||
-rw-r--r-- | cmake/libutils.cmake | 47 | ||||
-rw-r--r-- | cmake/merge_archives_unix.cmake (renamed from cmake/merge_archives_unix.cmake.in) | 11 |
4 files changed, 33 insertions, 61 deletions
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/install_macros.cmake b/cmake/install_macros.cmake index d9d12371830..71657e32308 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -159,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} ) @@ -259,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() @@ -277,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 621f6ecb535..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() @@ -294,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}) |