build: CMakeLists.txt cleanup

A cleanup of the CMake file in this repo,
for consistency with similar effort in other Vulkan repos.

clarify setting Windows install prefix if needed

project() : NONE = this project has no language toolchain requirement.

update .cmake-format.py 0.4.1

reformat using cmake-format 0.4.1

Change-Id: Ic64b335676eb6b8bd8ffd1b0d8c5468a4239287c
This commit is contained in:
Mike Weiblen 2018-07-04 15:23:41 -06:00
parent 5f3d50b590
commit 6b47ce4d93
2 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# Configuration for cmake-format (v0.3.6, circa Apr 2018)
# Configuration for cmake-format (v0.4.1, circa Jul 2018)
# https://github.com/cheshirekow/cmake_format
# How wide to allow formatted cmake files

View File

@ -15,22 +15,34 @@
# limitations under the License.
# ~~~
# CMake project initialization ---------------------------------------------------------------------------------------------------
# This section contains pre-project() initialization, and ends with the project() command.
cmake_minimum_required(VERSION 2.8.11)
# NONE = this project has no language toolchain requirement.
project(Vulkan-Headers NONE)
# User-interface declarations ----------------------------------------------------------------------------------------------------
# This section contains variables that affect development GUIs (e.g. CMake GUI and IDEs), such as option(), folders, and variables
# with the CACHE property.
include(GNUInstallDirs)
# Set a better default install location for Windows only if the user did not provide one.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
if(WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Windows: if install locations not set by user, set install prefix to "<build_dir>\install".
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
endif()
# --------------------------------------------------------------------------------------------------------------------------------
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY "${CMAKE_SOURCE_DIR}/registry" DESTINATION ${CMAKE_INSTALL_DATADIR}/vulkan)
# uninstall target
if(NOT TARGET uninstall)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/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)