diff options
author | Anel Husakovic <anel@mariadb.org> | 2020-01-17 16:23:05 +0100 |
---|---|---|
committer | Anel Husakovic <anel@mariadb.org> | 2020-01-17 16:23:05 +0100 |
commit | 9bffef3dc863db6e6ef74c9c68fe2c3cbc5a4c91 (patch) | |
tree | fdd84be41157140adc3e0ffd71918208d73ee2fc | |
parent | 1bee9efcc44d94e92a0908a3b431fc45f4490807 (diff) | |
download | mariadb-git-bb-5.5-anel-make-uninstall.tar.gz |
Add uninstall targetbb-5.5-anel-make-uninstall
-rw-r--r-- | BUILD-CMAKE | 29 | ||||
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | cmake_uninstall.cmake.in | 22 |
3 files changed, 51 insertions, 11 deletions
diff --git a/BUILD-CMAKE b/BUILD-CMAKE index c95482cf619..03f51be8880 100644 --- a/BUILD-CMAKE +++ b/BUILD-CMAKE @@ -55,11 +55,15 @@ shell>make Note: by default, cmake build is less verbose than automake build. Use "make VERBOSE=1" if you want to see add command lines for each compiled source. +- Visual Studio 2019 cmake generator will use host architecture by default, that is, +cmake will build x64 binaries on x64 machine. -- Windows, using "Visual Studio 9 2008" generator -shell>cmake . -G "Visual Studio 9 2008" -shell>devenv MySQL.sln /build /relwithdebinfo -(alternatively, open MySQL.sln and build using the IDE) +- Visual Studio 2017 cmake generator will create 32 bit projects by default. +For 64 bit, you must pass CMake the "generator" parameter using -G in the configuration step, +shell>cmake . -G "Visual Studio 15 2017 Win64" +- With Visual Studio 2019, pass -A Win32 parameter for CMake, like this +shell>cmake . -A Win32 +- For a complete list of available generators, call "cmake" without any parameters. - Windows, using "NMake Makefiles" generator shell>cmake . -G "NMake Makefiles" @@ -115,7 +119,7 @@ shell> cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1 This can be done during the initial configuration or any time later. -Note, that parameters are "sticky", that is they are remebered in the CMake +Note, that parameters are "sticky", that is they are remembered in the CMake cache (CMakeCache.txt file in the build directory) 2) Configuration using cmake-gui (Windows, OSX, or Linux with cmake-gui @@ -187,22 +191,25 @@ shell> cpack -G TGZ --config CPackConfig.cmake -- Source distribution -- "make dist" target is provided. -ADDITIONAL MAKE TARGETS: "make install" AND "make test" ----------------------------------------------------------------- +ADDITIONAL MAKE TARGETS: "make install", "make uninstall" AND "make test" +------------------------------------------------------------------------- install target also provided for Makefile based generators. Installation directory can be controlled using configure-time parameter -CMAKE_INSTALL_PREFIX (default is /usr/local. It is also possible to install to +CMAKE_INSTALL_PREFIX (default is /usr/local). It is also possible to install to non-configured directory, using shell> make install DESTDIR="/some/absolute/path" "make test" runs unit tests (uses CTest for it) "make test-force" runs mysql-test-run.pl tests with --test-force parameter +"make uninstall" is uninstalling the target (default /usr/local). It is possible to +uninstall non-configured directory using +shell> make uninstall DESTDIR="/some/absolute/path" FOR PROGRAMMERS: WRITING PLATFORM CHECKS -------------------------------------------------------------- -If you modify MySQL source and want to add a new platform check,please read -http://www.vtk.org/Wiki/CMake_HowToDoPlatformChecks first. In MySQL, most of +If you modify MariaDB source and want to add a new platform check,please read +http://www.vtk.org/Wiki/CMake_HowToDoPlatformChecks first. In MariaDB, most of the platform tests are implemented in configure.cmake and the template header file is config.h.cmake @@ -222,7 +229,7 @@ Troubleshooting platform checks If you suspect that a platform check returned wrong result, examine <build-root>/CMakeFiles/CMakeError.log and <build-root>/CMakeFiles/CMakeOutput.log -These files they contain compiler command line, and exact error messages. +These files contain compiler command line, and exact error messages. Troubleshooting CMake code ---------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fb7e7ae2b4..12dd3d1e6e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -466,6 +466,17 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) +# uninstall target +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() + INSTALL_DOCUMENTATION(README COPYING EXCEPTIONS-CLIENT COMPONENT Readme) # MDEV-6526 these files are not installed anymore diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 00000000000..03137d5aff7 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF("${rm_retval}" STREQUAL 0) + ELSE("${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF("${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) |