diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/bison.cmake | 20 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 64 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 4 | ||||
-rw-r--r-- | cmake/pcre.cmake | 16 | ||||
-rw-r--r-- | cmake/plugin.cmake | 2 | ||||
-rw-r--r-- | cmake/sign.cmake.in | 18 |
6 files changed, 72 insertions, 52 deletions
diff --git a/cmake/bison.cmake b/cmake/bison.cmake index d5c725fbbde..0892a213d04 100644 --- a/cmake/bison.cmake +++ b/cmake/bison.cmake @@ -47,6 +47,21 @@ MACRO (RUN_BISON input_yy output_cc output_h) ENDIF() ENDIF() IF(BISON_USABLE) + # Workaround for VS regenerating output even + # when outputs are up-to-date. At least, fix output timestamp + # after build so that files that depend on generated header are + # not rebuilt. + IF(CMAKE_GENERATOR MATCHES "Visual Studio") + FIND_PROGRAM(TOUCH_EXECUTABLE touch DOC "Path to touch executable" + PATHS "C:/Program Files/Git/usr/bin" + "C:/Program Files (x86)/Git/usr/bin") + IF(TOUCH_EXECUTABLE) + SET(VS_FIX_OUTPUT_TIMESTAMPS + COMMAND ${TOUCH_EXECUTABLE} -r ${input_yy} ${output_cc} + COMMAND ${TOUCH_EXECUTABLE} -r ${input_yy} ${output_h}) + ENDIF() + ENDIF() + ADD_CUSTOM_COMMAND( OUTPUT ${output_cc} ${output_h} @@ -54,8 +69,9 @@ MACRO (RUN_BISON input_yy output_cc output_h) --output=${output_cc} --defines=${output_h} ${input_yy} - DEPENDS ${input_yy} - ) + ${VS_FIX_OUTPUT_TIMESTAMPS} + DEPENDS ${input_yy} + ) ELSE() # Bison is missing or not usable, e.g too old IF(EXISTS ${output_cc} AND EXISTS ${output_h}) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 24659781b26..0d3e0607cf7 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -57,17 +57,8 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) ENDIF() SET(targets ${ARG_DEFAULT_ARGS}) FOREACH(target ${targets}) - GET_TARGET_PROPERTY(type ${target} TYPE) - GET_TARGET_PROPERTY(location ${target} LOCATION) - STRING(REPLACE ".exe" ".pdb" pdb_location ${location}) - STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) - STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) - IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE - "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" - pdb_location ${pdb_location}) - ENDIF() - + GET_TARGET_PROPERTY(target_type ${target} TYPE) + set(comp "") IF(ARG_COMPONENT STREQUAL "Server") IF(target MATCHES "mysqld" OR type MATCHES "MODULE") @@ -87,11 +78,9 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) IF(NOT comp) SET(comp Debuginfo_archive_only) # not in MSI ENDIF() - IF(type MATCHES "STATIC") - # PDB for static libraries might be unsupported http://public.kitware.com/Bug/view.php?id=14600 - SET(opt OPTIONAL) - ENDIF() - INSTALL(FILES ${pdb_location} DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp} ${opt}) + IF(NOT target_type MATCHES "STATIC") + INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp}) + ENDIF() ENDFOREACH() ENDIF() ENDFUNCTION() @@ -243,37 +232,22 @@ IF(WIN32) ENDIF() ENDIF() -MACRO(SIGN_TARGET) - MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN}) - SET(target ${ARG_DEFAULT_ARGS}) - IF(ARG_COMPONENT) - SET(comp COMPONENT ${ARG_COMPONENT}) - ELSE() - SET(comp) - ENDIF() - GET_TARGET_PROPERTY(target_type ${target} TYPE) - IF(target_type AND NOT target_type MATCHES "STATIC") - GET_TARGET_PROPERTY(target_location ${target} LOCATION) - IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" - target_location ${target_location}) - ENDIF() - INSTALL(CODE - "EXECUTE_PROCESS(COMMAND - \"${SIGNTOOL_EXECUTABLE}\" verify /pa /q \"${target_location}\" - RESULT_VARIABLE ERR) - IF(NOT \${ERR} EQUAL 0) - EXECUTE_PROCESS(COMMAND - \"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\" - RESULT_VARIABLE ERR) + +FUNCTION(SIGN_TARGET target) + IF(NOT SIGNCODE) + RETURN() ENDIF() - IF(NOT \${ERR} EQUAL 0) - MESSAGE(FATAL_ERROR \"Error signing '${target_location}'\") + GET_TARGET_PROPERTY(target_type ${target} TYPE) + IF((NOT target_type) OR (target_type MATCHES "STATIC")) + RETURN() ENDIF() - " ${comp}) - ENDIF() -ENDMACRO() - + # Mark executable for signing by creating empty *.signme file + # The actual signing happens in preinstall step + # (which traverses + ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E touch "$<TARGET_FILE:${target}>.signme" + ) +ENDFUNCTION() # Installs targets, also installs pdbs on Windows. # diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 84276115723..e4221227d91 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -115,8 +115,8 @@ IF(MSVC) ENDIF() #TODO: update the code and remove the disabled warnings - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700") IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 894bde38974..4c113929866 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -1,11 +1,23 @@ +INCLUDE (CheckCSourceRuns) + SET(WITH_PCRE "auto" CACHE STRING "Which pcre to use (possible values are 'bundled', 'system', or 'auto')") MACRO (CHECK_PCRE) IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto") - CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE) + CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE_STACK_GUARD) + IF(NOT CMAKE_CROSSCOMPILING) + SET(CMAKE_REQUIRED_LIBRARIES "pcre") + CHECK_C_SOURCE_RUNS(" + #include <pcre.h> + int main() { + return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256; + }" PCRE_STACK_SIZE_OK) + SET(CMAKE_REQUIRED_LIBRARIES) + ENDIF() ENDIF() - IF(NOT HAVE_PCRE OR WITH_PCRE STREQUAL "bundled") + IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR + WITH_PCRE STREQUAL "bundled") IF (WITH_PCRE STREQUAL "system") MESSAGE(FATAL_ERROR "system pcre is not found or unusable") ENDIF() diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 57d8d3aa592..702f8190e89 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -208,7 +208,7 @@ MACRO(MYSQL_ADD_PLUGIN) # only server package is required to be generated. IF(CPACK_COMPONENTS_ALL AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT} AND - NOT WITH_WSREP) + NOT WITH_WSREP AND INSTALL_SYSCONF2DIR) IF (ARG_STORAGE_ENGINE) SET(ver " = %{version}-%{release}") ENDIF() diff --git a/cmake/sign.cmake.in b/cmake/sign.cmake.in new file mode 100644 index 00000000000..61ae38d152d --- /dev/null +++ b/cmake/sign.cmake.in @@ -0,0 +1,18 @@ +FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme") +MESSAGE(STATUS "signing files") +FOREACH(f ${files}) + STRING(REPLACE ".signme" "" exe_location "${f}") + + string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@") + #MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}") + + EXECUTE_PROCESS(COMMAND + "@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" + RESULT_VARIABLE ERR) + IF(NOT ${ERR} EQUAL 0) + MESSAGE( "Error ${ERR} signing ${exe_location}") + ELSE() + FILE(REMOVE ${f}) + ENDIF() + +ENDFOREACH() |