diff options
50 files changed, 761 insertions, 474 deletions
diff --git a/Docs/cmake-mode.el b/Docs/cmake-mode.el index 478bc7a..6feed94 100644 --- a/Docs/cmake-mode.el +++ b/Docs/cmake-mode.el @@ -68,9 +68,9 @@ set the path with these commands: "\\|" "[ \t\r\n]" "\\)*")) (defconst cmake-regex-block-open - "^\\([iI][fF]\\|[mM][aA][cC][rR][oO]\\|[fF][oO][rR][eE][aA][cC][hH]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[wW][hH][iI][lL][eE]\\|[fF][uU][nN][cC][tT][iI][oO][nN]\\)$") + "^\\(if\\|macro\\|foreach\\|else\\|elseif\\|while\\|function\\)$") (defconst cmake-regex-block-close - "^[ \t]*\\([eE][nN][dD][iI][fF]\\|[eE][nN][dD][fF][oO][rR][eE][aA][cC][hH]\\|[eE][nN][dD][mM][aA][cC][rR][oO]\\|[eE][lL][sS][eE]\\|[eE][lL][sS][eE][iI][fF]\\|[eE][nN][dD][wW][hH][iI][lL][eE]\\|[eE][nN][dD][fF][uU][nN][cC][tT][iI][oO][nN]\\)[ \t]*(") + "^[ \t]*\\(endif\\|endforeach\\|endmacro\\|else\\|elseif\\|endwhile\\|endfunction\\)[ \t]*(") ;------------------------------------------------------------------------------ @@ -126,6 +126,7 @@ set the path with these commands: (beginning-of-line) (let ((point-start (point)) + (case-fold-search t) ;; case-insensitive token) ; Search back for the last indented line. @@ -229,13 +230,26 @@ the indentation. Otherwise it retains the same position on the line" ;; (defvar cmake-tab-width 2) +;; +;; Keymap. +;; +(defvar cmake-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-ch" 'cmake-help-command) + (define-key map "\C-cl" 'cmake-help-list-commands) + (define-key map "\C-cu" 'unscreamify-cmake-buffer) + map) + "Keymap used in cmake-mode buffers.") + ;------------------------------------------------------------------------------ ;; ;; CMake mode startup function. ;; (defun cmake-mode () - "Major mode for editing CMake listfiles." + "Major mode for editing CMake listfiles. + +\\{cmake-mode-map}" (interactive) (kill-all-local-variables) (setq major-mode 'cmake-mode) @@ -262,6 +276,9 @@ the indentation. Otherwise it retains the same position on the line" (make-local-variable 'comment-start) (setq comment-start "#") + ; Setup keymap. + (use-local-map cmake-mode-map) + ; Run user hooks. (run-hooks 'cmake-mode-hook)) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 17d63eb..d74dcdc 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -45,7 +45,7 @@ if(CMAKE_C_LIBRARY_ARCHITECTURE) set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") endif() -set(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@") +@CMAKE_C_SYSROOT_FLAG_CODE@ @CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 7f66be5..8c5d84e 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -46,7 +46,7 @@ if(CMAKE_CXX_LIBRARY_ARCHITECTURE) set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") endif() -set(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@") +@CMAKE_CXX_SYSROOT_FLAG_CODE@ @CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 3df17c7..906a5e7 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -143,7 +143,7 @@ Id flags: ${testflags} set(id_toolset "") endif() if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]") - set(build /p:Configuration=Debug /p:Platform=@id_arch@) + set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0) elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]") set(build /make) else() @@ -185,12 +185,20 @@ Id flags: ${testflags} endif() configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in ${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY IMMEDIATE) + unset(_ENV_MACOSX_DEPLOYMENT_TARGET) + if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET}) + set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") + set(ENV{MACOSX_DEPLOYMENT_TARGET} "") + endif() execute_process(COMMAND xcodebuild WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT ) + if(DEFINED _ENV_MACOSX_DEPLOYMENT_TARGET) + set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}") + endif() # Match the link line from xcodebuild output of the form # Ld ... diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 33f0141..98e5bb8 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -9,6 +9,7 @@ # vc90sp1 # vc100 # vc100sp1 +# vc110 # # Usage: # =========================== @@ -54,6 +55,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc100") elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01") set(_version "vc100sp1") + elseif(${_cl_version} VERSION_EQUAL "17.00.50727.1") + set(_version "vc110") else() set(_version "") endif() diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index c9f58e3..cea0187 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -53,8 +53,8 @@ include(CMakeDetermineSystem) # short-cut some tests on Darwin, see Darwin-GNU.cmake: if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin AND "${COMPILER_ID}" MATCHES GNU) - set(${CMAKE_${LANGUAGE}_HAS_ISYSROOT} 0 ) - set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") + set(CMAKE_${LANGUAGE}_SYSROOT_FLAG "") + set(CMAKE_${LANGUAGE}_OSX_DEPLOYMENT_TARGET_FLAG "") endif() # Also load the system specific file, which sets up e.g. the search paths. diff --git a/Modules/CMakeVS11FindMake.cmake b/Modules/CMakeVS11FindMake.cmake index c55a4c5..2df015d 100644 --- a/Modules/CMakeVS11FindMake.cmake +++ b/Modules/CMakeVS11FindMake.cmake @@ -34,15 +34,14 @@ find_program(CMAKE_MAKE_PROGRAM # if devenv is not found, then use MSBuild. # it is expected that if devenv is not found, then we are -# dealing with Visual Studio Express. VCExpress has random -# failures when being run as a command line build tool which -# causes the compiler checks and try-compile stuff to fail. MSbuild -# is a better choice for this. However, VCExpress does not support -# cross compiling needed for Win CE. +# dealing with Visual Studio Express. if(NOT CMAKE_CROSSCOMPILING) + set(_FDIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkDir32]") + set(_FVER "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;FrameworkVer32]") find_program(CMAKE_MAKE_PROGRAM NAMES MSBuild HINTS + ${_FDIR}/${_FVER} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/" "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;CLR Version]/" diff --git a/Modules/Compiler/Clang-ASM.cmake b/Modules/Compiler/Clang-ASM.cmake index a908b60..16c9c15 100644 --- a/Modules/Compiler/Clang-ASM.cmake +++ b/Modules/Compiler/Clang-ASM.cmake @@ -1 +1,5 @@ -include(Compiler/GNU-ASM) +include(Compiler/Clang) + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm) + +__compiler_clang(ASM) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index f7baf68..98fcd0b 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -1 +1,2 @@ -include(Compiler/GNU-C) +include(Compiler/Clang) +__compiler_clang(C) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index d3c403a..486e2af 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -1 +1,2 @@ -include(Compiler/GNU-CXX) +include(Compiler/Clang) +__compiler_clang(CXX) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake new file mode 100644 index 0000000..75a971d --- /dev/null +++ b/Modules/Compiler/Clang.cmake @@ -0,0 +1,26 @@ + +#============================================================================= +# Copyright 2002-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_CLANG) + return() +endif() +set(__COMPILER_CLANG 1) + +include(Compiler/GNU) + +macro(__compiler_clang lang) + __compiler_gnu(${lang}) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") +endmacro() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 3923685..8d57860 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -9,6 +9,7 @@ # [TMP_DIR dir] # Directory to store temporary files # [STAMP_DIR dir] # Directory to store step timestamps # #--Download step-------------- +# [DOWNLOAD_NAME fname] # File name to store (if not end of URL) # [DOWNLOAD_DIR dir] # Directory to store downloaded files # [DOWNLOAD_COMMAND cmd...] # Command to download source tree # [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository @@ -411,7 +412,7 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash endif() if("${hash}" MATCHES "${_ep_hash_regex}") - set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) + set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) else() set(hash_args "# no EXPECTED_HASH") endif() @@ -1104,6 +1105,7 @@ function(_ep_add_download_command name) get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) get_property(hg_repository TARGET ${name} PROPERTY _EP_HG_REPOSITORY ) get_property(url TARGET ${name} PROPERTY _EP_URL) + get_property(fname TARGET ${name} PROPERTY _EP_DOWNLOAD_NAME) # TODO: Perhaps file:// should be copied to download dir before extraction. string(REGEX REPLACE "^file://" "" url "${url}") @@ -1296,7 +1298,9 @@ function(_ep_add_download_command name) else() if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? - string(REGEX MATCH "[^/\\?]*$" fname "${url}") + if("x${fname}" STREQUAL "x") + string(REGEX MATCH "[^/\\?]*$" fname "${url}") + endif() if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$") string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}") set(fname "${CMAKE_MATCH_1}") diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index adaec95..9359323 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -1,16 +1,17 @@ -# Locate SDL library +# - Locate SDL library # This module defines -# SDL_LIBRARY, the name of the library to link against -# SDL_FOUND, if false, do not try to link to SDL -# SDL_INCLUDE_DIR, where to find SDL.h +# SDL_LIBRARY, the name of the library to link against +# SDL_FOUND, if false, do not try to link to SDL +# SDL_INCLUDE_DIR, where to find SDL.h +# SDL_VERSION_STRING, human-readable string containing the version of SDL # # This module responds to the the flag: -# SDL_BUILDING_LIBRARY -# If this is defined, then no SDL_main will be linked in because -# only applications need main(). -# Otherwise, it is assumed you are building an application and this -# module will attempt to locate and set the the proper link flags -# as part of the returned SDL_LIBRARY variable. +# SDL_BUILDING_LIBRARY +# If this is defined, then no SDL_main will be linked in because +# only applications need main(). +# Otherwise, it is assumed you are building an application and this +# module will attempt to locate and set the the proper link flags +# as part of the returned SDL_LIBRARY variable. # # Don't forget to include SDLmain.h and SDLmain.m your project for the # OS X framework based version. (Other versions link to -lSDLmain which @@ -54,6 +55,7 @@ #============================================================================= # Copyright 2003-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -68,18 +70,7 @@ find_path(SDL_INCLUDE_DIR SDL.h HINTS ENV SDLDIR - PATH_SUFFIXES include/SDL include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + PATH_SUFFIXES SDL SDL12 SDL11 ) # SDL-1.1 is the name used by FreeBSD ports... @@ -88,12 +79,6 @@ find_library(SDL_LIBRARY_TEMP NAMES SDL SDL-1.1 HINTS ENV SDLDIR - PATH_SUFFIXES lib - PATHS - /sw - /opt/local - /opt/csw - /opt ) if(NOT SDL_BUILDING_LIBRARY) @@ -169,7 +154,24 @@ if(SDL_LIBRARY_TEMP) set(SDL_LIBRARY_TEMP "${SDL_LIBRARY_TEMP}" CACHE INTERNAL "") endif() +if(SDL_INCLUDE_DIR AND EXISTS "${SDL_INCLUDE_DIR}/SDL_version.h") + file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_INCLUDE_DIR}/SDL_version.h" SDL_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MAJOR "${SDL_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_VERSION_MINOR "${SDL_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_VERSION_PATCH "${SDL_VERSION_PATCH_LINE}") + set(SDL_VERSION_STRING ${SDL_VERSION_MAJOR}.${SDL_VERSION_MINOR}.${SDL_VERSION_PATCH}) + unset(SDL_VERSION_MAJOR_LINE) + unset(SDL_VERSION_MINOR_LINE) + unset(SDL_VERSION_PATCH_LINE) + unset(SDL_VERSION_MAJOR) + unset(SDL_VERSION_MINOR) + unset(SDL_VERSION_PATCH) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL - REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR) + REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR + VERSION_VAR SDL_VERSION_STRING) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index 8c9e891..4cae032 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -1,8 +1,14 @@ -# Locate SDL_image library -# This module defines -# SDLIMAGE_LIBRARY, the name of the library to link against -# SDLIMAGE_FOUND, if false, do not try to link to SDL -# SDLIMAGE_INCLUDE_DIR, where to find SDL/SDL.h +# - Locate SDL_image library +# This module defines: +# SDL_IMAGE_LIBRARIES, the name of the library to link against +# SDL_IMAGE_INCLUDE_DIRS, where to find the headers +# SDL_IMAGE_FOUND, if false, do not try to link against +# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image +# +# For backward compatiblity the following variables are also set: +# SDLIMAGE_LIBRARY (same value as SDL_IMAGE_LIBRARIES) +# SDLIMAGE_INCLUDE_DIR (same value as SDL_IMAGE_INCLUDE_DIRS) +# SDLIMAGE_FOUND (same value as SDL_IMAGE_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR @@ -14,6 +20,7 @@ #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,40 +32,56 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_path(SDLIMAGE_INCLUDE_DIR SDL_image.h +if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR) + set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h HINTS ENV SDLIMAGEDIR ENV SDLDIR - PATH_SUFFIXES include include/SDL - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + PATH_SUFFIXES SDL SDL12 SDL11 ) -find_library(SDLIMAGE_LIBRARY +if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY) + set(SDL_IMAGE_LIBRARY ${SDLIMAGE_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_IMAGE_LIBRARY NAMES SDL_image HINTS ENV SDLIMAGEDIR ENV SDLDIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt ) +if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h") + file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MAJOR "${SDL_IMAGE_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_MINOR "${SDL_IMAGE_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_IMAGE_VERSION_PATCH "${SDL_IMAGE_VERSION_PATCH_LINE}") + set(SDL_IMAGE_VERSION_STRING ${SDL_IMAGE_VERSION_MAJOR}.${SDL_IMAGE_VERSION_MINOR}.${SDL_IMAGE_VERSION_PATCH}) + unset(SDL_IMAGE_VERSION_MAJOR_LINE) + unset(SDL_IMAGE_VERSION_MINOR_LINE) + unset(SDL_IMAGE_VERSION_PATCH_LINE) + unset(SDL_IMAGE_VERSION_MAJOR) + unset(SDL_IMAGE_VERSION_MINOR) + unset(SDL_IMAGE_VERSION_PATCH) +endif() + +set(SDL_IMAGE_LIBRARIES ${SDL_IMAGE_LIBRARY}) +set(SDL_IMAGE_INCLUDE_DIRS ${SDL_IMAGE_INCLUDE_DIR}) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLIMAGE - REQUIRED_VARS SDLIMAGE_LIBRARY SDLIMAGE_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_image + REQUIRED_VARS SDL_IMAGE_LIBRARIES SDL_IMAGE_INCLUDE_DIRS + VERSION_VAR SDL_IMAGE_VERSION_STRING) + +# for backward compatiblity +set(SDLIMAGE_LIBRARY ${SDL_IMAGE_LIBRARIES}) +set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS}) +set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND}) + +mark_as_advanced(SDL_IMAGE_LIBRARY SDL_IMAGE_INCLUDE_DIR) diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index 97a8330..666fc6e 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -1,8 +1,14 @@ -# Locate SDL_mixer library -# This module defines -# SDLMIXER_LIBRARY, the name of the library to link against -# SDLMIXER_FOUND, if false, do not try to link to SDL -# SDLMIXER_INCLUDE_DIR, where to find SDL/SDL.h +# - Locate SDL_mixer library +# This module defines: +# SDL_MIXER_LIBRARIES, the name of the library to link against +# SDL_MIXER_INCLUDE_DIRS, where to find the headers +# SDL_MIXER_FOUND, if false, do not try to link against +# SDL_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer +# +# For backward compatiblity the following variables are also set: +# SDLMIXER_LIBRARY (same value as SDL_MIXER_LIBRARIES) +# SDLMIXER_INCLUDE_DIR (same value as SDL_MIXER_INCLUDE_DIRS) +# SDLMIXER_FOUND (same value as SDL_MIXER_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR @@ -14,6 +20,7 @@ #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,40 +32,56 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_path(SDLMIXER_INCLUDE_DIR SDL_mixer.h +if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR) + set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h HINTS ENV SDLMIXERDIR ENV SDLDIR - PATH_SUFFIXES include include/SDL - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + PATH_SUFFIXES SDL SDL12 SDL11 ) -find_library(SDLMIXER_LIBRARY +if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY) + set(SDL_MIXER_LIBRARY ${SDLMIXER_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_MIXER_LIBRARY NAMES SDL_mixer HINTS ENV SDLMIXERDIR ENV SDLDIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt ) +if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h") + file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MAJOR "${SDL_MIXER_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_MINOR "${SDL_MIXER_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_MIXER_VERSION_PATCH "${SDL_MIXER_VERSION_PATCH_LINE}") + set(SDL_MIXER_VERSION_STRING ${SDL_MIXER_VERSION_MAJOR}.${SDL_MIXER_VERSION_MINOR}.${SDL_MIXER_VERSION_PATCH}) + unset(SDL_MIXER_VERSION_MAJOR_LINE) + unset(SDL_MIXER_VERSION_MINOR_LINE) + unset(SDL_MIXER_VERSION_PATCH_LINE) + unset(SDL_MIXER_VERSION_MAJOR) + unset(SDL_MIXER_VERSION_MINOR) + unset(SDL_MIXER_VERSION_PATCH) +endif() + +set(SDL_MIXER_LIBRARIES ${SDL_MIXER_LIBRARY}) +set(SDL_MIXER_INCLUDE_DIRS ${SDL_MIXER_INCLUDE_DIR}) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLMIXER - REQUIRED_VARS SDLMIXER_LIBRARY SDLMIXER_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_mixer + REQUIRED_VARS SDL_MIXER_LIBRARIES SDL_MIXER_INCLUDE_DIRS + VERSION_VAR SDL_MIXER_VERSION_STRING) + +# for backward compatiblity +set(SDLMIXER_LIBRARY ${SDL_MIXER_LIBRARIES}) +set(SDLMIXER_INCLUDE_DIR ${SDL_MIXER_INCLUDE_DIRS}) +set(SDLMIXER_FOUND ${SDL_MIXER_FOUND}) + +mark_as_advanced(SDL_MIXER_LIBRARY SDL_MIXER_INCLUDE_DIR) diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index 7e90e90..d8f479f 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -1,8 +1,14 @@ -# Locate SDL_net library -# This module defines -# SDLNET_LIBRARY, the name of the library to link against -# SDLNET_FOUND, if false, do not try to link against -# SDLNET_INCLUDE_DIR, where to find the headers +# - Locate SDL_net library +# This module defines: +# SDL_NET_LIBRARIES, the name of the library to link against +# SDL_NET_INCLUDE_DIRS, where to find the headers +# SDL_NET_FOUND, if false, do not try to link against +# SDL_NET_VERSION_STRING - human-readable string containing the version of SDL_net +# +# For backward compatiblity the following variables are also set: +# SDLNET_LIBRARY (same value as SDL_NET_LIBRARIES) +# SDLNET_INCLUDE_DIR (same value as SDL_NET_INCLUDE_DIRS) +# SDLNET_FOUND (same value as SDL_NET_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR @@ -14,6 +20,7 @@ #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,39 +32,56 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_path(SDLNET_INCLUDE_DIR SDL_net.h +if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR) + set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_NET_INCLUDE_DIR SDL_net.h HINTS ENV SDLNETDIR ENV SDLDIR - PATH_SUFFIXES include include/SDL - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + PATH_SUFFIXES SDL SDL12 SDL11 ) -find_library(SDLNET_LIBRARY + +if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY) + set(SDL_NET_LIBRARY ${SDLNET_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_NET_LIBRARY NAMES SDL_net HINTS ENV SDLNETDIR ENV SDLDIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt ) +if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h") + file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_NET_INCLUDE_DIR}/SDL_net.h" SDL_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MAJOR "${SDL_NET_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_MINOR "${SDL_NET_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_NET_VERSION_PATCH "${SDL_NET_VERSION_PATCH_LINE}") + set(SDL_NET_VERSION_STRING ${SDL_NET_VERSION_MAJOR}.${SDL_NET_VERSION_MINOR}.${SDL_NET_VERSION_PATCH}) + unset(SDL_NET_VERSION_MAJOR_LINE) + unset(SDL_NET_VERSION_MINOR_LINE) + unset(SDL_NET_VERSION_PATCH_LINE) + unset(SDL_NET_VERSION_MAJOR) + unset(SDL_NET_VERSION_MINOR) + unset(SDL_NET_VERSION_PATCH) +endif() + +set(SDL_NET_LIBRARIES ${SDL_NET_LIBRARY}) +set(SDL_NET_INCLUDE_DIRS ${SDL_NET_INCLUDE_DIR}) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLNET - REQUIRED_VARS SDLNET_LIBRARY SDLNET_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_net + REQUIRED_VARS SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS + VERSION_VAR SDL_NET_VERSION_STRING) + +# for backward compatiblity +set(SDLNET_LIBRARY ${SDL_NET_LIBRARIES}) +set(SDLNET_INCLUDE_DIR ${SDL_NET_INCLUDE_DIRS}) +set(SDLNET_FOUND ${SDL_NET_FOUND}) + +mark_as_advanced(SDL_NET_LIBRARY SDL_NET_INCLUDE_DIR) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index a9153c1..5ff50be 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -1,34 +1,34 @@ -# Locates the SDL_sound library - +# - Locates the SDL_sound library +# # This module depends on SDL being found and # must be called AFTER FindSDL.cmake is called. - +# # This module defines -# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h -# SDL_SOUND_FOUND, if false, do not try to link to SDL -# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need -# to link against. This is a read-only variable and is marked INTERNAL. -# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own -# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES. -# This is available mostly for cases this module failed to anticipate for -# and you must add additional flags. This is marked as ADVANCED. - +# SDL_SOUND_INCLUDE_DIR, where to find SDL_sound.h +# SDL_SOUND_FOUND, if false, do not try to link to SDL_sound +# SDL_SOUND_LIBRARIES, this contains the list of libraries that you need +# to link against. This is a read-only variable and is marked INTERNAL. +# SDL_SOUND_EXTRAS, this is an optional variable for you to add your own +# flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES. +# This is available mostly for cases this module failed to anticipate for +# and you must add additional flags. This is marked as ADVANCED. +# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound # # This module also defines (but you shouldn't need to use directly) -# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link -# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one. +# SDL_SOUND_LIBRARY, the name of just the SDL_sound library you would link +# against. Use SDL_SOUND_LIBRARIES for you link instructions and not this one. # And might define the following as needed -# MIKMOD_LIBRARY -# MODPLUG_LIBRARY -# OGG_LIBRARY -# VORBIS_LIBRARY -# SMPEG_LIBRARY -# FLAC_LIBRARY -# SPEEX_LIBRARY +# MIKMOD_LIBRARY +# MODPLUG_LIBRARY +# OGG_LIBRARY +# VORBIS_LIBRARY +# SMPEG_LIBRARY +# FLAC_LIBRARY +# SPEEX_LIBRARY # # Typically, you should not use these variables directly, and you should use # SDL_SOUND_LIBRARIES which contains SDL_SOUND_LIBRARY and the other audio libraries -# (if needed) to successfully compile on your system . +# (if needed) to successfully compile on your system. # # Created by Eric Wing. # This module is a bit more complicated than the other FindSDL* family modules. @@ -54,10 +54,10 @@ # People will have to manually change the cache values of # SDL_LIBRARY to override this selectionor set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. -# #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -77,17 +77,7 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h HINTS ENV SDLSOUNDDIR ENV SDLDIR - PATH_SUFFIXES - include include/SDL - PATHS - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + PATH_SUFFIXES SDL SDL12 SDL11 ) find_library(SDL_SOUND_LIBRARY @@ -95,13 +85,6 @@ find_library(SDL_SOUND_LIBRARY HINTS ENV SDLSOUNDDIR ENV SDLDIR - PATH_SUFFIXES - lib - PATHS - /sw - /opt/local - /opt/csw - /opt ) if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) @@ -176,7 +159,8 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # in the SDL_LIBRARY string after the "-framework". # But if I quote the stuff in INCLUDE_DIRECTORIES, it doesn't work. file(WRITE ${PROJECT_BINARY_DIR}/CMakeTmp/CMakeLists.txt - "project(DetermineSoundLibs) + "cmake_minimum_required(VERSION 2.8) + project(DetermineSoundLibs) include_directories(${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) add_executable(DetermineSoundLibs DetermineSoundLibs.c) target_link_libraries(DetermineSoundLibs ${TMP_TRY_LIBS})" @@ -376,7 +360,24 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) set(SDL_SOUND_LIBRARIES "${SDL_SOUND_EXTRAS} ${SDL_SOUND_LIBRARIES_TMP}" CACHE INTERNAL "SDL_sound and dependent libraries") endif() +if(SDL_SOUND_INCLUDE_DIR AND EXISTS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h") + file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SOUND_VER_MAJOR[ \t]+[0-9]+$") + file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_MINOR_LINE REGEX "^#define[ \t]+SOUND_VER_MINOR[ \t]+[0-9]+$") + file(STRINGS "${SDL_SOUND_INCLUDE_DIR}/SDL_sound.h" SDL_SOUND_VERSION_PATCH_LINE REGEX "^#define[ \t]+SOUND_VER_PATCH[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MAJOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MAJOR "${SDL_SOUND_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SOUND_VER_MINOR[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_MINOR "${SDL_SOUND_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SOUND_VER_PATCH[ \t]+([0-9]+)$" "\\1" SDL_SOUND_VERSION_PATCH "${SDL_SOUND_VERSION_PATCH_LINE}") + set(SDL_SOUND_VERSION_STRING ${SDL_SOUND_VERSION_MAJOR}.${SDL_SOUND_VERSION_MINOR}.${SDL_SOUND_VERSION_PATCH}) + unset(SDL_SOUND_VERSION_MAJOR_LINE) + unset(SDL_SOUND_VERSION_MINOR_LINE) + unset(SDL_SOUND_VERSION_PATCH_LINE) + unset(SDL_SOUND_VERSION_MAJOR) + unset(SDL_SOUND_VERSION_MINOR) + unset(SDL_SOUND_VERSION_PATCH) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_SOUND - REQUIRED_VARS SDL_SOUND_LIBRARIES SDL_SOUND_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound + REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR + VERSION_VAR SDL_SOUND_VERSION_STRING) diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index 1e68ccf..2cc5ee2 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -1,8 +1,14 @@ -# Locate SDL_ttf library -# This module defines -# SDLTTF_LIBRARY, the name of the library to link against -# SDLTTF_FOUND, if false, do not try to link to SDL -# SDLTTF_INCLUDE_DIR, where to find SDL/SDL.h +# - Locate SDL_ttf library +# This module defines: +# SDL_TTF_LIBRARIES, the name of the library to link against +# SDL_TTF_INCLUDE_DIRS, where to find the headers +# SDL_TTF_FOUND, if false, do not try to link against +# SDL_TTF_VERSION_STRING - human-readable string containing the version of SDL_ttf +# +# For backward compatiblity the following variables are also set: +# SDLTTF_LIBRARY (same value as SDL_TTF_LIBRARIES) +# SDLTTF_INCLUDE_DIR (same value as SDL_TTF_INCLUDE_DIRS) +# SDLTTF_FOUND (same value as SDL_TTF_FOUND) # # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR @@ -14,6 +20,7 @@ #============================================================================= # Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -25,40 +32,56 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_path(SDLTTF_INCLUDE_DIR SDL_ttf.h +if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR) + set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache +entry initialized from old variable name") +endif() +find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h HINTS ENV SDLTTFDIR ENV SDLDIR - PATH_SUFFIXES include include/SDL - PATHS - ~/Library/Frameworks - /Library/Frameworks - /usr/local/include/SDL12 - /usr/local/include/SDL11 # FreeBSD ports - /usr/include/SDL12 - /usr/include/SDL11 - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt + PATH_SUFFIXES SDL SDL12 SDL11 ) -find_library(SDLTTF_LIBRARY +if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY) + set(SDL_TTF_LIBRARY ${SDLTTF_LIBRARY} CACHE FILEPATH "file cache entry +initialized from old variable name") +endif() +find_library(SDL_TTF_LIBRARY NAMES SDL_ttf HINTS ENV SDLTTFDIR ENV SDLDIR - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt - PATH_SUFFIXES lib ) +if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h") + file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h" SDL_TTF_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MAJOR "${SDL_TTF_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_TTF_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_MINOR "${SDL_TTF_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_TTF_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL_TTF_VERSION_PATCH "${SDL_TTF_VERSION_PATCH_LINE}") + set(SDL_TTF_VERSION_STRING ${SDL_TTF_VERSION_MAJOR}.${SDL_TTF_VERSION_MINOR}.${SDL_TTF_VERSION_PATCH}) + unset(SDL_TTF_VERSION_MAJOR_LINE) + unset(SDL_TTF_VERSION_MINOR_LINE) + unset(SDL_TTF_VERSION_PATCH_LINE) + unset(SDL_TTF_VERSION_MAJOR) + unset(SDL_TTF_VERSION_MINOR) + unset(SDL_TTF_VERSION_PATCH) +endif() + +set(SDL_TTF_LIBRARIES ${SDL_TTF_LIBRARY}) +set(SDL_TTF_INCLUDE_DIRS ${SDL_TTF_INCLUDE_DIR}) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDLTTF - REQUIRED_VARS SDLTTF_LIBRARY SDLTTF_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_ttf + REQUIRED_VARS SDL_TTF_LIBRARIES SDL_TTF_INCLUDE_DIRS + VERSION_VAR SDL_TTF_VERSION_STRING) + +# for backward compatiblity +set(SDLTTF_LIBRARY ${SDL_TTF_LIBRARIES}) +set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS}) +set(SDLTTF_FOUND ${SDL_TTF_FOUND}) + +mark_as_advanced(SDL_TTF_LIBRARY SDL_TTF_INCLUDE_DIR) diff --git a/Modules/Platform/Darwin-Clang-C.cmake b/Modules/Platform/Darwin-Clang-C.cmake new file mode 100644 index 0000000..0a1502e --- /dev/null +++ b/Modules/Platform/Darwin-Clang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Clang) +__darwin_compiler_clang(C) diff --git a/Modules/Platform/Darwin-Clang-CXX.cmake b/Modules/Platform/Darwin-Clang-CXX.cmake new file mode 100644 index 0000000..f8e8d88 --- /dev/null +++ b/Modules/Platform/Darwin-Clang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Darwin-Clang) +__darwin_compiler_clang(CXX) diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake new file mode 100644 index 0000000..de7a856 --- /dev/null +++ b/Modules/Platform/Darwin-Clang.cmake @@ -0,0 +1,26 @@ + +#============================================================================= +# Copyright 2002-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__DARWIN_COMPILER_CLANG) + return() +endif() +set(__DARWIN_COMPILER_CLANG 1) + +macro(__darwin_compiler_clang lang) + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") + set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") +endmacro() diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake index 4e326c4..efdfd00 100644 --- a/Modules/Platform/Darwin-GNU-C.cmake +++ b/Modules/Platform/Darwin-GNU-C.cmake @@ -1,4 +1,4 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(C) -cmake_gnu_has_isysroot(C) +cmake_gnu_set_sysroot_flag(C) cmake_gnu_set_osx_deployment_target_flag(C) diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake index b39487e..e3c2ea7 100644 --- a/Modules/Platform/Darwin-GNU-CXX.cmake +++ b/Modules/Platform/Darwin-GNU-CXX.cmake @@ -1,4 +1,4 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(CXX) -cmake_gnu_has_isysroot(CXX) +cmake_gnu_set_sysroot_flag(CXX) cmake_gnu_set_osx_deployment_target_flag(CXX) diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index 5e9f8f0..d953503 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -24,8 +24,8 @@ macro(__darwin_compiler_gnu lang) set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") endmacro() -macro(cmake_gnu_has_isysroot lang) - if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x") +macro(cmake_gnu_set_sysroot_flag lang) + if(NOT DEFINED CMAKE_${lang}_SYSROOT_FLAG) set(_doc "${lang} compiler has -isysroot") message(STATUS "Checking whether ${_doc}") execute_process( @@ -35,11 +35,12 @@ macro(cmake_gnu_has_isysroot lang) ) if("${_gcc_help}" MATCHES "isysroot") message(STATUS "Checking whether ${_doc} - yes") - set(CMAKE_${lang}_HAS_ISYSROOT 1) + set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot") else() message(STATUS "Checking whether ${_doc} - no") - set(CMAKE_${lang}_HAS_ISYSROOT 0) + set(CMAKE_${lang}_SYSROOT_FLAG "") endif() + set(CMAKE_${lang}_SYSROOT_FLAG_CODE "set(CMAKE_${lang}_SYSROOT_FLAG \"${CMAKE_${lang}_SYSROOT_FLAG}\")") endif() endmacro() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 2a5f3cf..a401762 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -59,34 +59,28 @@ if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) endif() -# Set the assumed (Pre 10.5 or Default) location of the developer tools -set(OSX_DEVELOPER_ROOT "/Developer") - -# Use the xcode-select tool if it's available (Xcode >= 3.0 installations) -find_program(CMAKE_XCODE_SELECT xcode-select) -mark_as_advanced(CMAKE_XCODE_SELECT) -if(CMAKE_XCODE_SELECT) - execute_process(COMMAND ${CMAKE_XCODE_SELECT} "-print-path" - OUTPUT_VARIABLE OSX_DEVELOPER_ROOT - OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() - -# Find installed SDKs -# Start with Xcode-4.3+ default SDKs directory -set(_CMAKE_OSX_SDKS_DIR - "${OSX_DEVELOPER_ROOT}/Platforms/MacOSX.platform/Developer/SDKs") -file(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*") - -# If not present, try pre-4.3 SDKs directory -if(NOT _CMAKE_OSX_SDKS) -set(_CMAKE_OSX_SDKS_DIR "${OSX_DEVELOPER_ROOT}/SDKs") - file(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*") +# Ask xcode-select where to find /Developer or fall back to ancient location. +execute_process(COMMAND xcode-select -print-path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed) +if(NOT _failed AND IS_DIRECTORY ${_stdout}) + set(OSX_DEVELOPER_ROOT ${_stdout}) +elseif(IS_DIRECTORY "/Developer") + set(OSX_DEVELOPER_ROOT "/Developer") +else() + set(OSX_DEVELOPER_ROOT "") endif() execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +# Save CMAKE_OSX_ARCHITECTURES from the environment. +set(CMAKE_OSX_ARCHITECTURES "$ENV{CMAKE_OSX_ARCHITECTURES}" CACHE STRING + "Build architectures for OSX") + #---------------------------------------------------------------------------- # _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... # @@ -105,79 +99,108 @@ endif() #---------------------------------------------------------------------------- # CMAKE_OSX_SYSROOT -# Environment variable set by the user overrides our default. -# Use the same environment variable that Xcode uses. -set(ENV_SDKROOT "$ENV{SDKROOT}") - -# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION, -# accounting for the known specially named SDKs. -set(CMAKE_OSX_SYSROOT_DEFAULT - "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CURRENT_OSX_VERSION}.sdk") - -if(_CURRENT_OSX_VERSION STREQUAL "10.4") - set(CMAKE_OSX_SYSROOT_DEFAULT - "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.4u.sdk") -endif() - -if(_CURRENT_OSX_VERSION STREQUAL "10.3") - set(CMAKE_OSX_SYSROOT_DEFAULT - "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.3.9.sdk") -endif() +if(CMAKE_OSX_SYSROOT) + # Use the existing value without further computation to choose a default. + set(_CMAKE_OSX_SYSROOT_DEFAULT "${CMAKE_OSX_SYSROOT}") +elseif(NOT "x$ENV{SDKROOT}" STREQUAL "x" AND + (NOT "x$ENV{SDKROOT}" MATCHES "/" OR IS_DIRECTORY "$ENV{SDKROOT}")) + # Use the value of SDKROOT from the environment. + set(_CMAKE_OSX_SYSROOT_DEFAULT "$ENV{SDKROOT}") +elseif("${CMAKE_GENERATOR}" MATCHES Xcode + OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]" + OR NOT EXISTS "/usr/include/sys/types.h") + # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs directory. + set(_CMAKE_OSX_SDKS_DIR "") + if(OSX_DEVELOPER_ROOT) + foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs) + file(GLOB _CMAKE_OSX_SDKS ${OSX_DEVELOPER_ROOT}/${d}/*) + if(_CMAKE_OSX_SDKS) + set(_CMAKE_OSX_SDKS_DIR ${OSX_DEVELOPER_ROOT}/${d}) + break() + endif() + endforeach() + endif() -# Use environment or default as initial cache value: -if(NOT ENV_SDKROOT STREQUAL "") - set(CMAKE_OSX_SYSROOT_VALUE ${ENV_SDKROOT}) -else() - set(CMAKE_OSX_SYSROOT_VALUE ${CMAKE_OSX_SYSROOT_DEFAULT}) + if(_CMAKE_OSX_SDKS_DIR) + # Select SDK for current OSX version accounting for the known + # specially named SDKs. + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") + set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9") + set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}}) + set(_CMAKE_OSX_SYSROOT_DEFAULT + "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") + else() + # Assume developer files are in root (such as Xcode 4.5 command-line tools). + set(_CMAKE_OSX_SYSROOT_DEFAULT "") + endif() endif() # Set cache variable - end user may change this during ccmake or cmake-gui configure. -set(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_VALUE} CACHE PATH +# Choose the type based on the current value. +set(_CMAKE_OSX_SYSROOT_TYPE STRING) +foreach(v CMAKE_OSX_SYSROOT _CMAKE_OSX_SYSROOT_DEFAULT) + if("x${${v}}" MATCHES "/") + set(_CMAKE_OSX_SYSROOT_TYPE PATH) + break() + endif() +endforeach() +set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT_TYPE} "The product will be built against the headers and libraries located inside the indicated SDK.") -#---------------------------------------------------------------------------- -function(SanityCheckSDKAndDeployTarget _sdk_path _deploy) - if(_deploy STREQUAL "") - return() +# Transform the cached value to something we can use. +set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}") +set(_CMAKE_OSX_SYSROOT_PATH "") +if(CMAKE_OSX_SYSROOT) + if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") + # This is a path to the SDK. Make sure it exists. + if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}") + message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" + "because the directory does not exist.") + set(CMAKE_OSX_SYSROOT "") + set(_CMAKE_OSX_SYSROOT_ORIG "") + endif() + set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") + else() + # Transform the sdk name into a path. + execute_process( + COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + if(NOT _failed AND IS_DIRECTORY "${_stdout}") + set(_CMAKE_OSX_SYSROOT_PATH "${_stdout}") + # For non-Xcode generators use the path. + if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_PATH}") + endif() + endif() endif() +endif() - if(_sdk_path STREQUAL "") - message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET='${_deploy}' but CMAKE_OSX_SYSROOT is empty... - either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty") +# Make sure the combination of SDK and Deployment Target are allowed +if(CMAKE_OSX_DEPLOYMENT_TARGET) + if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "^.*/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") + set(_sdk_ver "${CMAKE_MATCH_1}") + elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") + set(_sdk_ver "${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR + "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' " + "but CMAKE_OSX_SYSROOT:\n \"${_CMAKE_OSX_SYSROOT_ORIG}\"\n" + "is not set to a MacOSX SDK with a recognized version. " + "Either set CMAKE_OSX_SYSROOT to a valid SDK or set " + "CMAKE_OSX_DEPLOYMENT_TARGET to empty.") endif() - - string(REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK "${_sdk_path}") - if(_deploy GREATER "${SDK}") - message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK} or lower") + if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER "${_sdk_ver}") + message(FATAL_ERROR + "CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) " + "is greater than CMAKE_OSX_SYSROOT SDK:\n ${_CMAKE_OSX_SYSROOT_ORIG}\n" + "Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${_sdk_ver} or lower.") endif() -endfunction() -#---------------------------------------------------------------------------- - -# Make sure the combination of SDK and Deployment Target are allowed -SanityCheckSDKAndDeployTarget("${CMAKE_OSX_SYSROOT}" "${CMAKE_OSX_DEPLOYMENT_TARGET}") - -# set _CMAKE_OSX_MACHINE to uname -m -execute_process(COMMAND uname -m - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE _CMAKE_OSX_MACHINE) - -# check for Power PC and change to ppc -if(_CMAKE_OSX_MACHINE MATCHES "Power") - set(_CMAKE_OSX_MACHINE ppc) -endif() - -# check for environment variable CMAKE_OSX_ARCHITECTURES -# if it is set. -if(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - set(CMAKE_OSX_ARCHITECTURES_VALUE "$ENV{CMAKE_OSX_ARCHITECTURES}") -else() - set(CMAKE_OSX_ARCHITECTURES_VALUE "") endif() -# now put _CMAKE_OSX_MACHINE into the cache -set(CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES_VALUE} CACHE STRING - "Build architectures for OSX") - - if("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$") set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 3a30a2e..41e150a 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -98,11 +98,14 @@ macro(__windows_compiler_intel lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") if(_INTEL_COMPILER_SUPPORTS_MANIFEST) + if(CMAKE_GENERATOR MATCHES "Ninja") + set(NO_RSP_EXPAND _no_rsp_expand) + endif() set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") + "<CMAKE_COMMAND> -E vs_link_exe${NO_RSP_EXPAND} ${CMAKE_${lang}_LINK_EXECUTABLE}") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + "<CMAKE_COMMAND> -E vs_link_dll${NO_RSP_EXPAND} ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") set(CMAKE_${lang}_CREATE_SHARED_MODULE - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") + "<CMAKE_COMMAND> -E vs_link_dll${NO_RSP_EXPAND} ${CMAKE_${lang}_CREATE_SHARED_MODULE}") endif() endmacro() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index cc48cfe..da0dba9 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -212,8 +212,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZER macro(__windows_compiler_msvc lang) if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14) # for 2005 make sure the manifest is put in the dll with mt - set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ") - set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ") + if(CMAKE_GENERATOR MATCHES "Ninja") + set(NO_RSP_EXPAND _no_rsp_expand) + endif() + set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll${NO_RSP_EXPAND} ") + set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe${NO_RSP_EXPAND} ") endif() set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7b6af1e..581cd60 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 9) -set(CMake_VERSION_TWEAK 20120919) +set(CMake_VERSION_TWEAK 20120925) #set(CMake_VERSION_RC 1) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index a1ffa20..29daffd 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -25,6 +25,8 @@ if (Qt5Widgets_FOUND) qt5_add_resources(${ARGN}) endmacro() set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) + # Remove this when the minimum version of Qt is 4.6. + add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) else() set(QT_MIN_VERSION "4.4.0") find_package(Qt4 REQUIRED) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 94cd5c2..5e7e081 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1,6 +1,8 @@ #include "cmDocumentVariables.h" #include "cmake.h" +#include <cmsys/ios/sstream> + void cmDocumentVariables::DefineVariables(cmake* cm) { // Subsection: variables defined by cmake, that give @@ -992,12 +994,33 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables That Describe the System"); - cm->DefineProperty - ("MSVC80", cmProperty::VARIABLE, - "True when using Microsoft Visual C 8.0", - "Set to true when the compiler is version 8.0 of Microsoft Visual C.", - false, - "Variables That Describe the System"); + int msvc_versions[] = { 60, 70, 71, 80, 90, 100, 110, 0 }; + for (int i = 0; msvc_versions[i] != 0; i ++) + { + const char minor = (char)('0' + (msvc_versions[i] % 10)); + cmStdString varName = "MSVC"; + cmsys_ios::ostringstream majorStr; + + majorStr << (msvc_versions[i] / 10); + varName += majorStr.str(); + if (msvc_versions[i] < 100) + { + varName += minor; + } + + cmStdString verString = majorStr.str() + "." + minor; + + cmStdString shortStr = "True when using Microsoft Visual C " + verString; + cmStdString fullStr = "Set to true when the compiler is version " + + verString + + " of Microsoft Visual C."; + cm->DefineProperty + (varName.c_str(), cmProperty::VARIABLE, + shortStr.c_str(), + fullStr.c_str(), + false, + "Variables That Describe the System"); + } cm->DefineProperty ("MSVC_IDE", cmProperty::VARIABLE, @@ -1017,6 +1040,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) " 1400 = VS 8.0\n" " 1500 = VS 9.0\n" " 1600 = VS 10.0\n" + " 1700 = VS 11.0\n" "", false, "Variables That Describe the System"); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4d9eb79..8de24b3 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2767,30 +2767,31 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) else if(*i == "EXPECTED_HASH") { ++i; - if(i != args.end()) + if(i == args.end()) { - hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New(i->c_str())); - if(!hash.get()) - { - std::string err = "DOWNLOAD bad SHA type: "; - err += *i; - this->SetError(err.c_str()); - return false; - } - hashMatchMSG = *i; - hashMatchMSG += " hash"; - - ++i; + this->SetError("DOWNLOAD missing ALGO=value for EXPECTED_HASH."); + return false; } - if(i != args.end()) + std::string::size_type pos = i->find("="); + if(pos == std::string::npos) { - expectedHash = cmSystemTools::LowerCase(*i); + std::string err = + "DOWNLOAD EXPECTED_HASH expects ALGO=value but got: "; + err += *i; + this->SetError(err.c_str()); + return false; } - else + std::string algo = i->substr(0, pos); + expectedHash = cmSystemTools::LowerCase(i->substr(pos+1)); + hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str())); + if(!hash.get()) { - this->SetError("DOWNLOAD missing time for EXPECTED_HASH."); + std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; + err += algo; + this->SetError(err.c_str()); return false; } + hashMatchMSG = algo + " hash"; } ++i; } @@ -2855,6 +2856,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); check_curl_result(res, "DOWNLOAD cannot set http failure option: "); + res = ::curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/" LIBCURL_VERSION); + check_curl_result(res, "DOWNLOAD cannot set user agent option: "); + res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmWriteToFileCallback); check_curl_result(res, "DOWNLOAD cannot set write function: "); diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index bd6f612..b4aa903 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -83,8 +83,7 @@ public: " file(TO_NATIVE_PATH path result)\n" " file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]\n" - " [EXPECTED_HASH MD5|SHA1|SHA224|SHA256|SHA384|SHA512 hash]\n" - " [EXPECTED_MD5 sum]\n" + " [EXPECTED_HASH ALGO=value] [EXPECTED_MD5 sum]\n" " [TLS_VERIFY on|off] [TLS_CAINFO file])\n" " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" @@ -170,10 +169,11 @@ public: "timeout after time seconds, time should be specified as an integer. " "The INACTIVITY_TIMEOUT specifies an integer number of seconds of " "inactivity after which the operation should terminate. " - "If EXPECTED_HASH is specified, the operation will verify that the " - "downloaded file's actual hash matches the expected value. If it " - "does not match, the operation fails with an error. " - "(EXPECTED_MD5 is short-hand for EXPECTED_HASH MD5.) " + "If EXPECTED_HASH ALGO=value is specified, the operation will verify " + "that the downloaded file's actual hash matches the expected value, " + "where ALGO is one of MD5, SHA1, SHA224, SHA256, SHA384, or SHA512. " + "If it does not match, the operation fails with an error. " + "(\"EXPECTED_MD5 sum\" is short-hand for \"EXPECTED_HASH MD5=sum\".) " "If SHOW_PROGRESS is specified, progress information will be printed " "as status messages until the operation is complete. " "For https URLs CMake must be built with OpenSSL. " diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index acc844a..9f84ed2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -299,7 +299,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode std::string name = *parameters.begin(); cmsys::RegularExpression targetValidator; - targetValidator.compile("^[A-Za-z0-9_]+$"); + targetValidator.compile("^[A-Za-z0-9_.-]+$"); if (!targetValidator.find(name.c_str())) { ::reportError(context, content->GetOriginalExpression(), diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index 2a5cc7a..d3c4aa3 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -127,6 +127,11 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression( parameters.resize(parameters.size() + 1); ++this->it; } + if (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) + { + extendText(*(parameters.end() - 1), this->it); + ++this->it; + } if (this->it == this->Tokens.end()) { break; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index db88834..91f16d1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -219,78 +219,6 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GenerateTargetManifest(const char* config) -{ - cmMakefile* mf = this->Target->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); - - // Get the names. - std::string name; - std::string soName; - std::string realName; - std::string impName; - std::string pdbName; - if(this->GetType() == cmTarget::EXECUTABLE) - { - this->Target->GetExecutableNames(name, realName, impName, pdbName, - config); - } - else if(this->GetType() == cmTarget::STATIC_LIBRARY || - this->GetType() == cmTarget::SHARED_LIBRARY || - this->GetType() == cmTarget::MODULE_LIBRARY) - { - this->Target->GetLibraryNames(name, soName, realName, impName, pdbName, - config); - } - else - { - return; - } - - // Get the directory. - std::string dir = this->Target->GetDirectory(config, false); - - // Add each name. - std::string f; - if(!name.empty()) - { - f = dir; - f += "/"; - f += name; - gg->AddToManifest(config? config:"", f); - } - if(!soName.empty()) - { - f = dir; - f += "/"; - f += soName; - gg->AddToManifest(config? config:"", f); - } - if(!realName.empty()) - { - f = dir; - f += "/"; - f += realName; - gg->AddToManifest(config? config:"", f); - } - if(!pdbName.empty()) - { - f = dir; - f += "/"; - f += pdbName; - gg->AddToManifest(config? config:"", f); - } - if(!impName.empty()) - { - f = this->Target->GetDirectory(config, true); - f += "/"; - f += impName; - gg->AddToManifest(config? config:"", f); - } -} - -//---------------------------------------------------------------------------- cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(const char* config) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 060e25a..4487c11 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -60,9 +60,6 @@ public: void UseObjectLibraries(std::vector<std::string>& objs); - /** Add the target output files to the global generator manifest. */ - void GenerateTargetManifest(const char* config); - std::map<cmStdString, cmComputeLinkInformation*> LinkInformation; cmComputeLinkInformation* GetLinkInformation(const char* config); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index d188980..480c577 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -205,6 +205,8 @@ std::string cmGlobalVisualStudio10Generator { makeCommand += "Debug"; } + makeCommand += " /p:VisualStudioVersion="; + makeCommand += this->GetIDEVersion(); if ( additionalOptions ) { makeCommand += " "; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 7bb4d0c..23a1204 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -17,7 +17,10 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() { this->FindMakeProgramFile = "CMakeVS11FindMake.cmake"; - this->ExpressEdition = false; // TODO: VS 11 Express support + std::string vc11Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" + "ProductDir", vc11Express, cmSystemTools::KeyWOW64_32); this->PlatformToolset = "v110"; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 2e3b530..bca1754 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -48,7 +48,7 @@ void cmGlobalVisualStudio8Generator ::GetDocumentation(cmDocumentationEntry& entry) const { entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio .NET 2005 project files."; + entry.Brief = "Generates Visual Studio 8 2005 project files."; entry.Full = ""; } diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx index 164d116..4cbc275 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx @@ -27,7 +27,7 @@ void cmGlobalVisualStudio8Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const { entry.Name = this->GetName(); - entry.Brief = "Generates Visual Studio .NET 2005 Win64 project files."; + entry.Brief = "Generates Visual Studio 8 2005 Win64 project files."; entry.Full = ""; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f9a1503..39b0ffe 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3123,18 +3123,14 @@ void cmGlobalXCodeGenerator const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); - const char* sysrootDefault = - this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); if(osxArch && sysroot) { - bool flagsUsed = false; // recompute this as it may have been changed since enable language this->Architectures.clear(); cmSystemTools::ExpandListArgument(std::string(osxArch), this->Architectures); - flagsUsed = true; buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); std::string archString; @@ -3149,12 +3145,6 @@ void cmGlobalXCodeGenerator } buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); - if(!flagsUsed && sysrootDefault && - strcmp(sysroot, sysrootDefault) != 0) - { - buildSettings->AddAttribute("SDKROOT", - this->CreateString(sysroot)); - } } if(deploymentTarget && *deploymentTarget) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 662f876..d452658 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -533,11 +533,10 @@ void cmLocalGenerator::GenerateTargetManifest() this->Makefile->GetConfigurations(configNames); // Add our targets to the manifest for each configuration. - cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); - for(cmGeneratorTargetsType::iterator t = targets.begin(); - t != targets.end(); ++t) + cmTargets& targets = this->Makefile->GetTargets(); + for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { - cmGeneratorTarget& target = *t->second; + cmTarget& target = t->second; if(configNames.empty()) { target.GenerateTargetManifest(0); @@ -1794,46 +1793,34 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, { std::vector<std::string> archs; target->GetAppleArchs(config, archs); - const char* sysroot = - this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); - const char* sysrootDefault = - this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); + const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + if(sysroot && sysroot[0] == '/' && !sysroot[1]) + { sysroot = 0; } + std::string sysrootFlagVar = + std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; + const char* sysrootFlag = + this->Makefile->GetDefinition(sysrootFlagVar.c_str()); const char* deploymentTarget = this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT"; - bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str()); std::string deploymentTargetFlagVar = std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; const char* deploymentTargetFlag = this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); - bool flagsUsed = false; - if(!archs.empty() && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) - { - // if there is more than one arch add the -arch and - // -isysroot flags, or if there is one arch flag, but - // it is not the default -arch flag for the system, then - // add it. Otherwize do not add -arch and -isysroot - if(archs[0] != "") + if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F')) + { + for(std::vector<std::string>::iterator i = archs.begin(); + i != archs.end(); ++i) { - for( std::vector<std::string>::iterator i = archs.begin(); - i != archs.end(); ++i) - { - flags += " -arch "; - flags += *i; - } - if(hasIsysroot) - { - flags += " -isysroot "; - flags += sysroot; - } - flagsUsed = true; + flags += " -arch "; + flags += *i; } } - if(!flagsUsed && sysroot && sysrootDefault && - strcmp(sysroot, sysrootDefault) != 0 && hasIsysroot) + if(sysrootFlag && *sysrootFlag && sysroot && *sysroot) { - flags += " -isysroot "; + flags += " "; + flags += sysrootFlag; + flags += " "; flags += sysroot; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1d11aca..57997ee 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -167,11 +167,41 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Append old-style preprocessor definition flags. this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); - // Add target-specific and source-specific flags. - this->LocalGenerator->AppendFlags(flags, - this->Target->GetProperty("COMPILE_FLAGS")); - this->LocalGenerator->AppendFlags(flags, - source->GetProperty("COMPILE_FLAGS")); + // Add target-specific flags. + if(this->Target->GetProperty("COMPILE_FLAGS")) + { + std::string langIncludeExpr = "CMAKE_"; + langIncludeExpr += language; + langIncludeExpr += "_FLAG_REGEX"; + const char* regex = this->Makefile-> + GetDefinition(langIncludeExpr.c_str()); + if(regex) + { + cmsys::RegularExpression r(regex); + std::vector<std::string> args; + cmSystemTools::ParseWindowsCommandLine( + this->Target->GetProperty("COMPILE_FLAGS"), + args); + for(std::vector<std::string>::iterator i = args.begin(); + i != args.end(); ++i) + { + if(r.find(i->c_str())) + { + this->LocalGenerator->AppendFlags + (flags, i->c_str()); + } + } + } + else + { + this->LocalGenerator->AppendFlags + (flags, this->Target->GetProperty("COMPILE_FLAGS")); + } + } + + // Add source file specific flags. + this->LocalGenerator->AppendFlags(flags, + source->GetProperty("COMPILE_FLAGS")); // TODO: Handle Apple frameworks. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5a47d17..532d482 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3495,6 +3495,76 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, } //---------------------------------------------------------------------------- +void cmTarget::GenerateTargetManifest(const char* config) +{ + cmMakefile* mf = this->Makefile; + cmLocalGenerator* lg = mf->GetLocalGenerator(); + cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + + // Get the names. + std::string name; + std::string soName; + std::string realName; + std::string impName; + std::string pdbName; + if(this->GetType() == cmTarget::EXECUTABLE) + { + this->GetExecutableNames(name, realName, impName, pdbName, config); + } + else if(this->GetType() == cmTarget::STATIC_LIBRARY || + this->GetType() == cmTarget::SHARED_LIBRARY || + this->GetType() == cmTarget::MODULE_LIBRARY) + { + this->GetLibraryNames(name, soName, realName, impName, pdbName, config); + } + else + { + return; + } + + // Get the directory. + std::string dir = this->GetDirectory(config, false); + + // Add each name. + std::string f; + if(!name.empty()) + { + f = dir; + f += "/"; + f += name; + gg->AddToManifest(config? config:"", f); + } + if(!soName.empty()) + { + f = dir; + f += "/"; + f += soName; + gg->AddToManifest(config? config:"", f); + } + if(!realName.empty()) + { + f = dir; + f += "/"; + f += realName; + gg->AddToManifest(config? config:"", f); + } + if(!pdbName.empty()) + { + f = dir; + f += "/"; + f += pdbName; + gg->AddToManifest(config? config:"", f); + } + if(!impName.empty()) + { + f = this->GetDirectory(config, true); + f += "/"; + f += impName; + gg->AddToManifest(config? config:"", f); + } +} + +//---------------------------------------------------------------------------- void cmTarget::SetPropertyDefault(const char* property, const char* default_value) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a025eea..1f6bb46 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -367,6 +367,9 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0); + /** Add the target output files to the global generator manifest. */ + void GenerateTargetManifest(const char* config); + /** * Compute whether this target must be relinked before installing. */ diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e559fe0..6cb7aa4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1683,11 +1683,19 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) } else if (args[1] == "vs_link_exe") { - return cmake::VisualStudioLink(args, 1); + return cmake::VisualStudioLink(args, 1, false); } else if (args[1] == "vs_link_dll") { - return cmake::VisualStudioLink(args, 2); + return cmake::VisualStudioLink(args, 2, false); + } + else if (args[1] == "vs_link_exe_no_rsp_expand") + { + return cmake::VisualStudioLink(args, 1, true); + } + else if (args[1] == "vs_link_dll_no_rsp_expand") + { + return cmake::VisualStudioLink(args, 2, true); } #ifdef CMAKE_BUILD_WITH_CMAKE // Internal CMake color makefile support. @@ -2185,6 +2193,7 @@ int cmake::ActualConfigure() std::vector<std::string> vsVerions; vsVerions.push_back("VisualStudio\\"); vsVerions.push_back("VCExpress\\"); + vsVerions.push_back("WDExpress\\"); struct VSRegistryEntryName { const char* MSVersion; @@ -2197,10 +2206,11 @@ int cmake::ActualConfigure() {"8.0", "Visual Studio 8 2005"}, {"9.0", "Visual Studio 9 2008"}, {"10.0", "Visual Studio 10"}, + {"11.0", "Visual Studio 11"}, {0, 0}}; - for(size_t b=0; b < vsVerions.size() && installedCompiler.empty(); b++) + for(int i=0; version[i].MSVersion != 0; i++) { - for(int i =0; version[i].MSVersion != 0; i++) + for(size_t b=0; b < vsVerions.size(); b++) { std::string reg = vsregBase + vsVerions[b] + version[i].MSVersion; reg += ";InstallDir]"; @@ -2209,6 +2219,7 @@ int cmake::ActualConfigure() if (!(reg == "/registry")) { installedCompiler = version[i].GeneratorName; + break; } } } @@ -4010,7 +4021,8 @@ static bool cmakeCheckStampList(const char* stampList) // For visual studio 2005 and newer manifest files need to be embeded into // exe and dll's. This code does that in such a way that incremental linking // still works. -int cmake::VisualStudioLink(std::vector<std::string>& args, int type) +int cmake::VisualStudioLink(std::vector<std::string>& args, int type, + bool no_rsp_expand) { if(args.size() < 2) { @@ -4025,13 +4037,12 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type) for(std::vector<std::string>::iterator i = args.begin(); i != args.end(); ++i) { - // check for nmake temporary files - if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 ) + // check for nmake temporary files (there are two rsp files) + if(!no_rsp_expand && (*i)[0] == '@' && i->find("@CMakeFiles") != 0 ) { std::ifstream fin(i->substr(1).c_str()); std::string line; - while(cmSystemTools::GetLineFromStream(fin, - line)) + while(cmSystemTools::GetLineFromStream(fin, line)) { cmSystemTools::ParseWindowsCommandLine(line.c_str(), expandedArgs); } diff --git a/Source/cmake.h b/Source/cmake.h index 94c6f12..12e5edf 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -447,7 +447,8 @@ protected: std::string const& link); static int ExecuteEchoColor(std::vector<std::string>& args); static int ExecuteLinkScript(std::vector<std::string>& args); - static int VisualStudioLink(std::vector<std::string>& args, int type); + static int VisualStudioLink(std::vector<std::string>& args, int type, + bool no_rsp_expand); static int VisualStudioLinkIncremental(std::vector<std::string>& args, int type, bool verbose); diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 94a6325..bb4bccc 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -12,6 +12,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) + if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") + list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT}) + endif() set(SRCS main.s) add_custom_command( OUTPUT main.s diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 3f0ab50..91086c6 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -38,7 +38,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA1 50c614fc28b39c1281d0517bb6d5858b4359c9b7 + EXPECTED_HASH SHA1=50c614fc28b39c1281d0517bb6d5858b4359c9b7 ) message(STATUS "FileDownload:5") @@ -47,7 +47,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA224 73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 + EXPECTED_HASH SHA224=73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 ) message(STATUS "FileDownload:6") @@ -56,7 +56,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA256 2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 + EXPECTED_HASH SHA256=2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 ) message(STATUS "FileDownload:7") @@ -65,7 +65,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA384 398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 + EXPECTED_HASH SHA384=398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 ) message(STATUS "FileDownload:8") @@ -74,7 +74,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH SHA512 c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 + EXPECTED_HASH SHA512=c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 ) message(STATUS "FileDownload:9") file(DOWNLOAD @@ -82,7 +82,7 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status - EXPECTED_HASH MD5 d16778650db435bda3a8c3435c3ff5d1 + EXPECTED_HASH MD5=d16778650db435bda3a8c3435c3ff5d1 ) message(STATUS "FileDownload:10") @@ -1505,6 +1505,14 @@ set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man p set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" +# Suppress -isysroot if user-provided flags already have it. +if echo "${cmake_c_flags}" | grep isysroot >/dev/null 2>&1 && + echo "${cmake_cxx_flags}" | grep isysroot >/dev/null 2>&1; then + echo ' +set(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE) +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" +fi + # Add configuration settings given as command-line options. if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then echo ' |