diff options
53 files changed, 616 insertions, 206 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index b27cd69..66ec900 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -65,16 +65,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() endif() - # default component for IFW - if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) - set(_CPACK_IFW_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) - else() - set(_CPACK_IFW_COMPONENT_NAME Unspecified) - endif() - string(TOUPPER ${_CPACK_IFW_COMPONENT_NAME} _CPACK_IFW_COMPONENT_UNAME) - if(${CMAKE_SYSTEM_NAME} MATCHES Windows) - set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") + set(_CPACK_IFW_PACKAGE_ICON + "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") if(BUILD_QtDialog) set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") endif() @@ -87,7 +80,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" DESTINATION "." ) - set(_CPACK_IFW_COMPONENT_SCRIPT "set(CPACK_IFW_COMPONENT_${_CPACK_IFW_COMPONENT_UNAME}_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") + set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") endif() if(${CMAKE_SYSTEM_NAME} MATCHES Linux) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 5127220..57ed4ca 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -32,22 +32,25 @@ endif() include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) if(CPACK_GENERATOR MATCHES "IFW") - # Version with QtIFW limitations - set(CPACK_PACKAGE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") # Installer configuration set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool") set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org") @_CPACK_IFW_PACKAGE_ICON@ - set(CPACK_IFW_PACKAGE_WINDOW_ICON "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") - # Enable install default component - set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENT_NAME@") - # Component configuration - set(CPACK_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") - set(CPACK_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_DESCRIPTION "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") - # IFW component onfiguration - set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_NAME "@CPACK_PACKAGE_NAME@") - set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") - @_CPACK_IFW_COMPONENT_SCRIPT@ + set(CPACK_IFW_PACKAGE_WINDOW_ICON + "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") + # Package configuration group + set(CPACK_IFW_PACKAGE_GROUP CMake) + # Group configuration + set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME + "@CPACK_PACKAGE_NAME@") + set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION + "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") + # IFW group configuration + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES + "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") + @_CPACK_IFW_PACKAGE_SCRIPT@ endif() if(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 91fffe9..c279d50 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -23,6 +23,7 @@ All Modules /module/CheckCXXSourceRuns /module/CheckCXXSymbolExists /module/CheckFortranFunctionExists + /module/CheckFortranSourceCompiles /module/CheckFunctionExists /module/CheckIncludeFileCXX /module/CheckIncludeFile diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 43c2af3..2124f7d 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -190,6 +190,8 @@ Variables that Describe the System /variable/MSVC_VERSION /variable/UNIX /variable/WIN32 + /variable/WINDOWS_PHONE + /variable/WINDOWS_STORE /variable/XCODE_VERSION Variables that Control the Build diff --git a/Help/module/CheckFortranSourceCompiles.rst b/Help/module/CheckFortranSourceCompiles.rst new file mode 100644 index 0000000..b749a2a --- /dev/null +++ b/Help/module/CheckFortranSourceCompiles.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/CheckFortranSourceCompiles.cmake diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst index 16a5bc3..22c7c4f 100644 --- a/Help/policy/CMP0022.rst +++ b/Help/policy/CMP0022.rst @@ -22,7 +22,7 @@ downstream users of CMake versions older than 2.8.12. The target_link_libraries command will no longer populate the properties matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy is NEW. -Warning-free future-compatible code which works with CMake 2.8.9 onwards +Warning-free future-compatible code which works with CMake 2.8.7 onwards can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords of :command:`target_link_libraries`. diff --git a/Help/release/dev/add-CheckFortranSourceCompiles.rst b/Help/release/dev/add-CheckFortranSourceCompiles.rst new file mode 100644 index 0000000..b78c747 --- /dev/null +++ b/Help/release/dev/add-CheckFortranSourceCompiles.rst @@ -0,0 +1,5 @@ +add-CheckFortranSourceCompiles +------------------------------ + +* The :module:`CheckFortranSourceCompiles` module was added to + provide a ``CHECK_Fortran_SOURCE_COMPILES`` macro. diff --git a/Help/release/dev/vs-windows-phone-and-store.rst b/Help/release/dev/vs-windows-phone-and-store.rst new file mode 100644 index 0000000..b44e276 --- /dev/null +++ b/Help/release/dev/vs-windows-phone-and-store.rst @@ -0,0 +1,10 @@ +vs-windows-phone-and-store +-------------------------- + +* Generators for Visual Studio 11 (2012) and above learned to generate + projects for Windows Phone and Windows Store. One may set the + :variable:`CMAKE_SYSTEM_NAME` variable to ``WindowsPhone`` + or ``WindowsStore`` on the :manual:`cmake(1)` command-line + or in a :variable:`CMAKE_TOOLCHAIN_FILE` to activate these platforms. + Also set :variable:`CMAKE_SYSTEM_VERSION` to ``8.0`` or ``8.1`` to + specify the version of Windows to be targeted. diff --git a/Help/variable/WINDOWS_PHONE.rst b/Help/variable/WINDOWS_PHONE.rst new file mode 100644 index 0000000..61d91b0 --- /dev/null +++ b/Help/variable/WINDOWS_PHONE.rst @@ -0,0 +1,5 @@ +WINDOWS_PHONE +------------- + +True when the :variable:`CMAKE_SYSTEM_NAME` variable is set +to ``WindowsPhone``. diff --git a/Help/variable/WINDOWS_STORE.rst b/Help/variable/WINDOWS_STORE.rst new file mode 100644 index 0000000..dae3b53 --- /dev/null +++ b/Help/variable/WINDOWS_STORE.rst @@ -0,0 +1,5 @@ +WINDOWS_STORE +------------- + +True when the :variable:`CMAKE_SYSTEM_NAME` variable is set +to ``WindowsStore``. diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index e247885..19bcbcc 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -74,6 +74,7 @@ function(compiler_id_detection outvar lang) PGI Cray TI + Fujitsu ) if (lang STREQUAL C) list(APPEND ordered_compilers diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 025d296..1fca55d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -168,6 +168,23 @@ Id flags: ${testflags} else() set(id_toolset "") endif() + if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(id_system "<ApplicationType>Windows Phone</ApplicationType>") + elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(id_system "<ApplicationType>Windows Store</ApplicationType>") + else() + set(id_system "") + endif() + if(id_system AND CMAKE_SYSTEM_VERSION) + set(id_system_version "<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>") + else() + set(id_system_version "") + endif() + if(id_platform STREQUAL ARM) + set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>") + else() + set(id_WindowsSDKDesktopARMSupport "") + endif() if(CMAKE_VS_WINCE_VERSION) set(id_entrypoint "mainACRTStartup") if("${vs_version}" VERSION_LESS 9) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 29a0047..8463b5d 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -74,6 +74,15 @@ # # You can use predefined variables. # +# .. variable:: CPACK_IFW_PACKAGE_GROUP +# +# The group, which will be used to configure the root package +# +# .. variable:: CPACK_IFW_PACKAGE_NAME +# +# The root package name, which will be used if configuration group is not +# specified +# # Components # """""""""" # @@ -122,11 +131,10 @@ # # :: # -# cpack_ifw_configure_component(<compname> -# [COMMON] +# cpack_ifw_configure_component(<compname> [COMMON] +# [NAME <name>] # [VERSION <version>] # [SCRIPT <script>] -# [NAME <name>] # [PRIORITY <priority>] # [DEPENDS <com_id> ...] # [LICENSES <display_name> <file_path> ...]) @@ -163,6 +171,7 @@ # cpack_ifw_configure_component_group(<grpname> # [VERSION <version>] # [NAME <name>] +# [SCRIPT <script>] # [PRIORITY <priority>] # [LICENSES <display_name> <file_path> ...]) # @@ -174,6 +183,9 @@ # ``NAME`` is used to create domain-like identification for this component group. # By default used origin component group name. # +# ``SCRIPT`` is relative or absolute path to operations script +# for this component group. +# # ``PRIORITY`` is priority of the component group in the tree. # # ``LICENSES`` pair of <display_name> and <file_path> of license text for this @@ -329,6 +341,20 @@ if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED) include(CMakeParseArguments) endif() +# Resolve full filename for script file +macro(_cpack_ifw_resolve_script _variable) + set(_ifw_script_macro ${_variable}) + set(_ifw_script_file ${${_ifw_script_macro}}) + if(DEFINED ${_ifw_script_macro}) + get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE) + set(_ifw_script_file ${${_ifw_script_macro}}) + if(NOT EXISTS ${_ifw_script_file}) + message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists") + set(${_ifw_script_macro}) + endif() + endif() +endmacro() + # Resolve full path to lisense file macro(_cpack_ifw_resolve_lisenses _variable) if(${_variable}) @@ -357,18 +383,7 @@ macro(cpack_ifw_configure_component compname) set(_IFW_MULTI_ARGS DEPENDS LICENSES) cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) - # Resolve full filename for script file - set(_IFW_SCRIPT_MACRO CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) - set(_IFW_SCRIPT_FILE ${${_IFW_SCRIPT_MACRO}}) - if(DEFINED ${_IFW_SCRIPT_MACRO}) - get_filename_component(${_IFW_SCRIPT_MACRO} ${_IFW_SCRIPT_FILE} ABSOLUTE) - set(_IFW_SCRIPT_FILE ${${_IFW_SCRIPT_MACRO}}) - if(NOT EXISTS ${_IFW_SCRIPT_FILE}) - message(WARNING "CPack IFW: script file \"${_IFW_SCRIPT_FILE}\" for component \"${compname}\" is not exists" ) - set(${_IFW_SCRIPT_MACRO}) - endif() - endif() - + _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES) set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n") @@ -403,10 +418,11 @@ macro(cpack_ifw_configure_component_group grpname) string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME) set(_IFW_OPT) - set(_IFW_ARGS VERSION NAME PRIORITY) + set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY) set(_IFW_MULTI_ARGS LICENSES) cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) + _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES) set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n") diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake new file mode 100644 index 0000000..63e4539 --- /dev/null +++ b/Modules/CheckFortranSourceCompiles.cmake @@ -0,0 +1,110 @@ +#.rst: +# CheckFortranSourceCompiles +# -------------------------- +# +# Check if given Fortran source compiles and links into an executable:: +# +# CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>]) +# +# The arguments are: +# +# ``<code>`` +# Source code to try to compile. It must define a PROGRAM entry point. +# ``<var>`` +# Variable to store whether the source code compiled. +# ``<fail-regex>`` +# Fail if test output matches this regex. +# +# The following variables may be set before calling this macro to modify +# the way the check is run:: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages + +#============================================================================= +# Copyright 2005-2009 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.) + + + +macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR) + if(NOT DEFINED "${VAR}") + set(_FAIL_REGEX) + set(_key) + foreach(arg ${ARGN}) + if("${arg}" MATCHES "^(FAIL_REGEX)$") + set(_key "${arg}") + elseif(_key) + list(APPEND _${_key} "${arg}") + else() + message(FATAL_ERROR "Unknown argument:\n ${arg}\n") + endif() + endforeach() + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F" + "${SOURCE}\n") + + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() + try_compile(${VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + + foreach(_regex ${_FAIL_REGEX}) + if("${OUTPUT}" MATCHES "${_regex}") + set(${VAR} 0) + endif() + endforeach() + + if(${VAR}) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + endif() + endif() +endmacro() diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake new file mode 100644 index 0000000..73ee38c --- /dev/null +++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake @@ -0,0 +1,2 @@ + +set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)") diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in index 1a7a539..a17d03d 100644 --- a/Modules/CompilerId/VS-10.vcxproj.in +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -10,6 +10,9 @@ <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid> <RootNamespace>CompilerId@id_lang@</RootNamespace> <Keyword>Win32Proj</Keyword> + @id_system@ + @id_system_version@ + @id_WindowsSDKDesktopARMSupport@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration"> diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 6e15f3b..3be5e3c 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -522,6 +522,7 @@ endfunction() # Most mpi distros have some form of mpiexec which gives us something we can reliably look for. find_program(MPIEXEC NAMES ${_MPI_EXEC_NAMES} + HINTS ${MPI_HOME} $ENV{MPI_HOME} PATHS ${_MPI_PREFIX_PATH} PATH_SUFFIXES bin DOC "Executable for running MPI programs.") @@ -584,7 +585,9 @@ foreach (lang C CXX Fortran) find_program(MPI_${lang}_COMPILER NAMES ${_MPI_${lang}_COMPILER_NAMES} - PATHS "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH}) + HINTS ${_MPI_BASE_DIR}/bin + PATHS ${_MPI_PREFIX_PATH} + ) interrogate_mpi_compiler(${lang} ${try_libs}) mark_as_advanced(MPI_${lang}_COMPILER) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e51c592..0c2e21b 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -162,10 +162,22 @@ if(WINCE) if (MSVC_VERSION LESS 1600) set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib") endif () +elseif(WINDOWS_PHONE OR WINDOWS_STORE) + set(_FLAGS_C " /DUNICODE /D_UNICODE") + set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc") + if(WINDOWS_PHONE) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") + elseif(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") + else() + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() else() set(_PLATFORM_DEFINES "/DWIN32") - if(MSVC_VERSION GREATER 1310) + if(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM) + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") + elseif(MSVC_VERSION GREATER 1310) set(_RTC1 "/RTC1") set(_FLAGS_CXX " /GR /EHsc") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") @@ -199,10 +211,12 @@ unset(_MACHINE_ARCH_FLAG) # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it set( MSVC_INCREMENTAL_YES_FLAG "") -if(NOT MSVC_INCREMENTAL_DEFAULT) - set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") -else() - set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) +if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE) + if(NOT MSVC_INCREMENTAL_DEFAULT) + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") + else() + set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) + endif() endif() if (CMAKE_COMPILER_SUPPORTS_PDBTYPE) diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index 7e97111..9a937a7 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -2,6 +2,10 @@ set(WIN32 1) if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") set(WINCE 1) +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(WINDOWS_PHONE 1) +elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(WINDOWS_STORE 1) endif() set(CMAKE_STATIC_LIBRARY_PREFIX "") diff --git a/Modules/Platform/WindowsPhone-MSVC-C.cmake b/Modules/Platform/WindowsPhone-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsPhone-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsPhone.cmake b/Modules/Platform/WindowsPhone.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsPhone.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Modules/Platform/WindowsStore-MSVC-C.cmake b/Modules/Platform/WindowsStore-MSVC-C.cmake new file mode 100644 index 0000000..ce8060b --- /dev/null +++ b/Modules/Platform/WindowsStore-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/WindowsStore-MSVC-CXX.cmake new file mode 100644 index 0000000..281eadc --- /dev/null +++ b/Modules/Platform/WindowsStore-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsStore.cmake b/Modules/Platform/WindowsStore.cmake new file mode 100644 index 0000000..65b2eae --- /dev/null +++ b/Modules/Platform/WindowsStore.cmake @@ -0,0 +1 @@ +include(Platform/Windows) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e685083..7a5d940 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140811) +set(CMake_VERSION_PATCH 20140818) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index e7c97c6..732938b 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -33,8 +33,6 @@ //---------------------------------------------------------------------------- cmCPackIFWGenerator::cmCPackIFWGenerator() { - // Change the default behavior - componentPackageMethod = ONE_PACKAGE_PER_COMPONENT; } //---------------------------------------------------------------------------- @@ -374,9 +372,6 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(const std::string &projectName, const std::string &groupName) { - ComponentGoupsMap::iterator git = ComponentGroups.find(groupName); - if ( git != ComponentGroups.end() ) return &(git->second); - cmCPackComponentGroup* group = cmCPackGenerator::GetComponentGroup(projectName, groupName); if(!group) return group; @@ -388,7 +383,7 @@ cmCPackIFWGenerator::GetComponentGroup(const std::string &projectName, cmCPackIFWPackage *package = &Packages[name]; package->Name = name; package->Generator = this; - if(package->ConfigureFromComponentGroup(group)) + if(package->ConfigureFromGroup(group)) { package->Installer = &Installer; Installer.Packages.insert( @@ -436,17 +431,29 @@ bool cmCPackIFWGenerator::IsOnePackage() const } //---------------------------------------------------------------------------- -std::string cmCPackIFWGenerator::GetRootPackageName() const +std::string cmCPackIFWGenerator::GetRootPackageName() { + // Default value std::string name = "root"; - if(const char* optIFW_ROOT_PACKAGE_NAME = - this->GetOption("CPACK_IFW_ROOT_PACKAGE_NAME")) + if (const char* optIFW_PACKAGE_GROUP = + this->GetOption("CPACK_IFW_PACKAGE_GROUP")) + { + // Configure from root group + cmCPackIFWPackage package; + package.Generator = this; + package.ConfigureFromGroup(optIFW_PACKAGE_GROUP); + name = package.Name; + } + else if (const char* optIFW_PACKAGE_NAME = + this->GetOption("CPACK_IFW_PACKAGE_NAME")) { - name = optIFW_ROOT_PACKAGE_NAME; + // Configure from root package name + name = optIFW_PACKAGE_NAME; } else if (const char* optPACKAGE_NAME = this->GetOption("CPACK_PACKAGE_NAME")) { + // Configure from package name name = optPACKAGE_NAME; } return name; diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index e871f7c..7211e04 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -97,7 +97,7 @@ protected: // Methods bool IsOnePackage() const; - std::string GetRootPackageName() const; + std::string GetRootPackageName(); std::string GetGroupPackageName(cmCPackComponentGroup *group) const; std::string GetComponentPackageName(cmCPackComponent *component) const; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 78b2ffb..fcb07e6 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -48,9 +48,15 @@ const char *cmCPackIFWInstaller::GetOption(const std::string &op) const void cmCPackIFWInstaller::ConfigureFromOptions() { // Name; - if (const char* option = GetOption("CPACK_PACKAGE_NAME")) + if (const char* optIFW_PACKAGE_NAME = + this->GetOption("CPACK_IFW_PACKAGE_NAME")) { - Name = option; + Name = optIFW_PACKAGE_NAME; + } + else if (const char* optPACKAGE_NAME = + this->GetOption("CPACK_PACKAGE_NAME")) + { + Name = optPACKAGE_NAME; } else { @@ -274,7 +280,16 @@ void cmCPackIFWInstaller::GeneratePackageFiles() cmCPackIFWPackage package; package.Generator = Generator; package.Installer = this; - package.ConfigureFromOptions(); + // Check package group + if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP")) + { + package.ConfigureFromGroup(option); + package.ForcedInstallation = "true"; + } + else + { + package.ConfigureFromOptions(); + } package.GeneratePackageFile(); return; } diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 02cd07b..1630a94 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,7 +13,7 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h -#include "cmStandardIncludes.h" +#include <cmStandardIncludes.h> class cmCPackIFWPackage; class cmCPackIFWGenerator; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 5e7a7c7..3c45639 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -121,7 +121,14 @@ cmCPackIFWPackage::cmCPackIFWPackage() : //---------------------------------------------------------------------------- const char *cmCPackIFWPackage::GetOption(const std::string &op) const { - return Generator ? Generator->GetOption(op) : 0; + const char *option = Generator ? Generator->GetOption(op) : 0; + return option && *option ? option : 0; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsOn(const std::string &op) const +{ + return Generator ? Generator->IsOn(op) : false; } //---------------------------------------------------------------------------- @@ -232,7 +239,6 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent *component) // Script if (const char* option = GetOption(prefix + "SCRIPT")) { - // TODO: add check file exist Script = option; } @@ -306,7 +312,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent *component) //---------------------------------------------------------------------------- int -cmCPackIFWPackage::ConfigureFromComponentGroup(cmCPackComponentGroup *group) +cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup *group) { if(!group) return 0; @@ -335,6 +341,12 @@ cmCPackIFWPackage::ConfigureFromComponentGroup(cmCPackComponentGroup *group) Version = "1.0.0"; } + // Script + if (const char* option = GetOption(prefix + "SCRIPT")) + { + Script = option; + } + // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { @@ -359,6 +371,48 @@ cmCPackIFWPackage::ConfigureFromComponentGroup(cmCPackComponentGroup *group) } //---------------------------------------------------------------------------- +int cmCPackIFWPackage::ConfigureFromGroup(const std::string &groupName) +{ + // Group configuration + + cmCPackComponentGroup group; + std::string prefix = "CPACK_COMPONENT_GROUP_" + + cmsys::SystemTools::UpperCase(groupName) + + "_"; + + if (const char *option = GetOption(prefix + "DISPLAY_NAME")) + { + group.DisplayName = option; + } + else + { + group.DisplayName = group.Name; + } + + if (const char* option = GetOption(prefix + "DESCRIPTION")) + { + group.Description = option; + } + group.IsBold = IsOn(prefix + "BOLD_TITLE"); + group.IsExpandedByDefault = IsOn(prefix + "EXPANDED"); + + // Package configuration + + group.Name = groupName; + + if(Generator) + { + Name = Generator->GetGroupPackageName(&group); + } + else + { + Name = group.Name; + } + + return ConfigureFromGroup(&group); +} + +//---------------------------------------------------------------------------- void cmCPackIFWPackage::GeneratePackageFile() { // Lazy directory initialization diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 868c15d..9fc9bd0 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -13,7 +13,7 @@ #ifndef cmCPackIFWPackage_h #define cmCPackIFWPackage_h -#include "cmStandardIncludes.h" +#include <cmStandardIncludes.h> class cmCPackComponent; class cmCPackComponentGroup; @@ -105,6 +105,7 @@ public: // Configuration public: // Internal implementation const char* GetOption(const std::string& op) const; + bool IsOn(const std::string& op) const; std::string GetComponentName(cmCPackComponent *component); @@ -112,7 +113,8 @@ public: // Internal implementation int ConfigureFromOptions(); int ConfigureFromComponent(cmCPackComponent *component); - int ConfigureFromComponentGroup(cmCPackComponentGroup *group); + int ConfigureFromGroup(cmCPackComponentGroup *group); + int ConfigureFromGroup(const std::string &groupName); void GeneratePackageFile(); diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 8a37797..0574681 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -756,6 +756,9 @@ bool CMakeSetupDialog::setupFirstConfigure() QString systemName = dialog.getSystemName(); m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME", tr("CMake System Name"), systemName, false); + QString systemVersion = dialog.getSystemVersion(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_VERSION", + tr("CMake System Version"), systemVersion, false); QString cxxCompiler = dialog.getCXXCompiler(); m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", tr("CXX compiler."), cxxCompiler, false); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4007789..c708a08 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -97,6 +97,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); + this->SystemIsWindowsPhone = false; + this->SystemIsWindowsStore = false; this->MasmEnabled = false; this->MSBuildCommandInitialized = false; } @@ -146,12 +148,46 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s, } //---------------------------------------------------------------------------- -bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile*) +bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) { + if(this->SystemName == "WindowsPhone") + { + this->SystemIsWindowsPhone = true; + if(!this->InitializeWindowsPhone(mf)) + { + return false; + } + } + else if(this->SystemName == "WindowsStore") + { + this->SystemIsWindowsStore = true; + if(!this->InitializeWindowsStore(mf)) + { + return false; + } + } return true; } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf) +{ + cmOStringStream e; + e << this->GetName() << " does not support Windows Phone."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; +} + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf) +{ + cmOStringStream e; + e << this->GetName() << " does not support Windows Store."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator ::AddVSPlatformToolsetDefinition(cmMakefile* mf) const { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index b042559..6245b28 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -70,6 +70,14 @@ public: /** Return the CMAKE_SYSTEM_VERSION. */ std::string const& GetSystemVersion() const { return this->SystemVersion; } + /** Return true if building for WindowsPhone */ + bool TargetsWindowsPhone() const + { return this->SystemIsWindowsPhone; } + + /** Return true if building for WindowsStore */ + bool TargetsWindowsStore() const + { return this->SystemIsWindowsStore; } + /** * Where does this version of Visual Studio look for macros for the * current user? Returns the empty string if this version of Visual @@ -99,6 +107,10 @@ public: protected: virtual void Generate(); virtual bool InitializeSystem(cmMakefile* mf); + virtual bool InitializeWindowsPhone(cmMakefile* mf); + virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual std::string SelectWindowsPhoneToolset() const { return ""; } + virtual std::string SelectWindowsStoreToolset() const { return ""; } virtual const char* GetIDEVersion() { return "10.0"; } @@ -108,6 +120,8 @@ protected: std::string DefaultPlatformToolset; std::string SystemName; std::string SystemVersion; + bool SystemIsWindowsPhone; + bool SystemIsWindowsStore; bool ExpressEdition; bool MasmEnabled; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index e5a159b..39bbdc0 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -129,6 +129,56 @@ cmGlobalVisualStudio11Generator::MatchesGeneratorName( } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf) +{ + this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset(); + if(this->DefaultPlatformToolset.empty()) + { + cmOStringStream e; + e << this->GetName() << " supports Windows Phone '8.0', but not '" + << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf) +{ + this->DefaultPlatformToolset = this->SelectWindowsStoreToolset(); + if(this->DefaultPlatformToolset.empty()) + { + cmOStringStream e; + e << this->GetName() << " supports Windows Store '8.0', but not '" + << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset() const +{ + if(this->SystemVersion == "8.0") + { + return "v110_wp80"; + } + return this->cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset() const +{ + if(this->SystemVersion == "8.0") + { + return "v110"; + } + return this->cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(); +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) { fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; @@ -192,3 +242,17 @@ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs() return ret; } + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio11Generator::NeedsDeploy(cmTarget::TargetType type) const +{ + if((type == cmTarget::EXECUTABLE || + type == cmTarget::SHARED_LIBRARY) && + (this->SystemIsWindowsPhone || + this->SystemIsWindowsStore)) + { + return true; + } + return cmGlobalVisualStudio10Generator::NeedsDeploy(type); +} diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 3d89a94..bbd935c 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -34,9 +34,16 @@ public: /** TODO: VS 11 user macro support. */ virtual std::string GetUserMacrosDirectory() { return ""; } protected: + virtual bool InitializeWindowsPhone(cmMakefile* mf); + virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual std::string SelectWindowsPhoneToolset() const; + virtual std::string SelectWindowsStoreToolset() const; virtual const char* GetIDEVersion() { return "11.0"; } bool UseFolderProperty(); static std::set<std::string> GetInstalledWindowsCESDKs(); + + /** Return true if the configuration needs to be deployed */ + virtual bool NeedsDeploy(cmTarget::TargetType type) const; private: class Factory; friend class Factory; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 4235cbc..29ecfe0 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -109,6 +109,56 @@ cmGlobalVisualStudio12Generator::MatchesGeneratorName( } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) +{ + this->DefaultPlatformToolset = this->SelectWindowsPhoneToolset(); + if(this->DefaultPlatformToolset.empty()) + { + cmOStringStream e; + e << this->GetName() << " supports Windows Phone '8.0' and '8.1', " + "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf) +{ + this->DefaultPlatformToolset = this->SelectWindowsStoreToolset(); + if(this->DefaultPlatformToolset.empty()) + { + cmOStringStream e; + e << this->GetName() << " supports Windows Store '8.0' and '8.1', " + "but not '" << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + return true; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio12Generator::SelectWindowsPhoneToolset() const +{ + if(this->SystemVersion == "8.1") + { + return "v120_wp81"; + } + return this->cmGlobalVisualStudio11Generator::SelectWindowsPhoneToolset(); +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio12Generator::SelectWindowsStoreToolset() const +{ + if(this->SystemVersion == "8.1") + { + return "v120"; + } + return this->cmGlobalVisualStudio11Generator::SelectWindowsStoreToolset(); +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio12Generator::WriteSLNHeader(std::ostream& fout) { fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 8ac2d1d..ec85f10 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -39,6 +39,10 @@ public: //version number virtual const char* GetToolsVersion() { return "12.0"; } protected: + virtual bool InitializeWindowsPhone(cmMakefile* mf); + virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual std::string SelectWindowsPhoneToolset() const; + virtual std::string SelectWindowsStoreToolset() const; virtual const char* GetIDEVersion() { return "12.0"; } private: class Factory; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 758c8e4..7849d12 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -361,9 +361,13 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() for(std::set<std::string>::const_iterator l = languages.begin(); l != languages.end(); ++l) { - *this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n"; - *this->FlagFileStream << *l << "_DEFINES = " << this->GetDefines(*l) << - "\n\n"; + std::string flags = this->GetFlags(*l); + std::string defines = this->GetDefines(*l); + // Escape comment characters so they do not terminate assignment. + cmSystemTools::ReplaceString(flags, "#", "\\#"); + cmSystemTools::ReplaceString(defines, "#", "\\#"); + *this->FlagFileStream << *l << "_FLAGS = " << flags << "\n\n"; + *this->FlagFileStream << *l << "_DEFINES = " << defines << "\n\n"; } } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 18d8951..1e9e8e8 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -286,6 +286,11 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("<ProjectGUID>", 2); (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n"; + if(this->MSTools && this->Target->GetType() <= cmTarget::UTILITY) + { + this->WriteApplicationTypeSettings(); + } + const char* vsProjectTypes = this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES"); if(vsProjectTypes) @@ -2100,3 +2105,37 @@ bool cmVisualStudio10TargetGenerator:: expectedResxHeaders.find(headerFile); return it != expectedResxHeaders.end(); } + +void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() +{ + bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone(); + bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); + std::string const& v = this->GlobalGenerator->GetSystemVersion(); + if(isWindowsPhone || isWindowsStore) + { + this->WriteString("<ApplicationType>", 2); + (*this->BuildFileStream) << (isWindowsPhone ? + "Windows Phone" : "Windows Store") + << "</ApplicationType>\n"; + this->WriteString("<ApplicationTypeRevision>", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(v) + << "</ApplicationTypeRevision>\n"; + if(v == "8.1") + { + // Visual Studio 12.0 is necessary for building 8.1 apps + this->WriteString("<MinimumVisualStudioVersion>12.0" + "</MinimumVisualStudioVersion>\n", 2); + } + else if (v == "8.0") + { + // Visual Studio 11.0 is necessary for building 8.0 apps + this->WriteString("<MinimumVisualStudioVersion>11.0" + "</MinimumVisualStudioVersion>\n", 2); + } + } + if (this->Platform == "ARM") + { + this->WriteString("<WindowsSDKDesktopARMSupport>true" + "</WindowsSDKDesktopARMSupport>", 2); + } +} diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 7436372..2bbdb8c 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -91,6 +91,7 @@ private: void WriteCustomCommand(cmSourceFile const* sf); void WriteGroups(); void WriteProjectReferences(); + void WriteApplicationTypeSettings(); bool OutputSourceSpecificFlags(cmSourceFile const* source); void AddLibraries(cmComputeLinkInformation& cli, std::vector<std::string>& libVec); diff --git a/Source/kwsys/CPU.h.in b/Source/kwsys/CPU.h.in index 2e1a584..626914b 100644 --- a/Source/kwsys/CPU.h.in +++ b/Source/kwsys/CPU.h.in @@ -80,6 +80,10 @@ #elif defined(__mips) || defined(__mips__) || defined(__MIPS__) # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG +/* OpenRISC 1000 */ +#elif defined(__or1k__) +# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG + /* RS/6000 */ #elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 241e295..ca9d424 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -68,6 +68,7 @@ do. #include <signal.h> /* sigaction */ #include <dirent.h> /* DIR, dirent */ #include <ctype.h> /* isspace */ +#include <assert.h> /* assert */ #if defined(__VMS) # define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK @@ -450,6 +451,7 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command) } for(i=0; i < n; ++i) { + assert(command[i]); /* Quiet Clang scan-build. */ newCommands[cp->NumberOfCommands][i] = strdup(command[i]); if(!newCommands[cp->NumberOfCommands][i]) { diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index dcfd49c..e34bb43 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4600,111 +4600,6 @@ void SystemTools::Delay(unsigned int msec) #endif } -void SystemTools::ConvertWindowsCommandLineToUnixArguments( - const char *cmd_line, int *argc, char ***argv) -{ - if (!cmd_line || !argc || !argv) - { - return; - } - - // A space delimites an argument except when it is inside a quote - - (*argc) = 1; - - size_t cmd_line_len = strlen(cmd_line); - - size_t i; - for (i = 0; i < cmd_line_len; i++) - { - while (isspace(cmd_line[i]) && i < cmd_line_len) - { - i++; - } - if (i < cmd_line_len) - { - if (cmd_line[i] == '\"') - { - i++; - while (cmd_line[i] != '\"' && i < cmd_line_len) - { - i++; - } - (*argc)++; - } - else - { - while (!isspace(cmd_line[i]) && i < cmd_line_len) - { - i++; - } - (*argc)++; - } - } - } - - (*argv) = new char* [(*argc) + 1]; - (*argv)[(*argc)] = NULL; - - // Set the first arg to be the exec name - - (*argv)[0] = new char [1024]; -#ifdef _WIN32 - wchar_t tmp[1024]; - ::GetModuleFileNameW(0, tmp, 1024); - strcpy((*argv)[0], Encoding::ToNarrow(tmp).c_str()); -#else - (*argv)[0][0] = '\0'; -#endif - - // Allocate the others - - int j; - for (j = 1; j < (*argc); j++) - { - (*argv)[j] = new char [cmd_line_len + 10]; - } - - // Grab the args - - size_t pos; - int argc_idx = 1; - - for (i = 0; i < cmd_line_len; i++) - { - while (isspace(cmd_line[i]) && i < cmd_line_len) - { - i++; - } - if (i < cmd_line_len) - { - if (cmd_line[i] == '\"') - { - i++; - pos = i; - while (cmd_line[i] != '\"' && i < cmd_line_len) - { - i++; - } - memcpy((*argv)[argc_idx], &cmd_line[pos], i - pos); - (*argv)[argc_idx][i - pos] = '\0'; - argc_idx++; - } - else - { - pos = i; - while (!isspace(cmd_line[i]) && i < cmd_line_len) - { - i++; - } - memcpy((*argv)[argc_idx], &cmd_line[pos], i - pos); - (*argv)[argc_idx][i - pos] = '\0'; - argc_idx++; - } - } - } - } - kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() { kwsys_stl::string res; diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 2514699..e88bc8f 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -856,15 +856,6 @@ public: */ static kwsys_stl::string GetOperatingSystemNameAndVersion(); - /** - * Convert windows-style arguments given as a command-line string - * into more traditional argc/argv arguments. - * Note that argv[0] will be assigned the executable name using - * the GetModuleFileName() function. - */ - static void ConvertWindowsCommandLineToUnixArguments( - const char *cmd_line, int *argc, char ***argv); - /** ----------------------------------------------------------------- * URL Manipulation Routines * ----------------------------------------------------------------- diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx index 3b84c38..b65c37f 100644 --- a/Source/kwsys/testCommandLineArguments1.cxx +++ b/Source/kwsys/testCommandLineArguments1.cxx @@ -21,6 +21,7 @@ # include "kwsys_ios_iostream.h.in" #endif +#include <assert.h> /* assert */ #include <string.h> /* strcmp */ int testCommandLineArguments1(int argc, char* argv[]) @@ -83,6 +84,7 @@ int testCommandLineArguments1(int argc, char* argv[]) } for ( cc = 0; cc < newArgc; ++ cc ) { + assert(newArgv[cc]); /* Quiet Clang scan-build. */ kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]" << kwsys_ios::endl; if ( cc >= 9 ) diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 3d62822..47c3fb0 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -20,6 +20,7 @@ # include "Encoding.h.in" #endif +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -104,6 +105,7 @@ static int test4(int argc, const char* argv[]) fprintf(stderr, "Output before crash on stderr from crash test.\n"); fflush(stdout); fflush(stderr); + assert(invalidAddress); /* Quiet Clang scan-build. */ /* Provoke deliberate crash by writing to the invalid address. */ *invalidAddress = 0; fprintf(stdout, "Output after crash on stdout from crash test.\n"); diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 15123eb..04ab4fc 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -507,28 +507,6 @@ static bool CheckStringOperations() res = false; } - int targc; - char **targv; - kwsys::SystemTools::ConvertWindowsCommandLineToUnixArguments - ("\"Local Mojo\\Voodoo.asp\" -CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"", - &targc, &targv); - if (targc != 4 || strcmp(targv[1],"Local Mojo\\Voodoo.asp") || - strcmp(targv[2],"-CastHex") || - strcmp(targv[3],"D:\\My Secret Mojo\\Voodoo.mp3")) - { - kwsys_ios::cerr - << "Problem with ConvertWindowsCommandLineToUnixArguments" - << "\'\"Local Mojo\\Voodoo.asp\" " - << "-CastHex \"D:\\My Secret Mojo\\Voodoo.mp3\"\'" - << kwsys_ios::endl; - res = false; - } - for (;targc >=0; --targc) - { - delete [] targv[targc]; - } - delete [] targv; - return res; } diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 0e0a872..ffa6999 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -3,6 +3,10 @@ #include <string.h> #include <stdlib.h> +#if defined(_MSC_VER) +# pragma warning(disable:4996) /* deprecation */ +#endif + @CMAKE_TESTDRIVER_EXTRA_INCLUDES@ diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 9b6c9c2..05a5f82 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,6 +22,12 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") + set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS + "-DTEST_OCTOTHORPE=\"#\"" + ) +endif() + target_link_libraries(CompileOptions testlib) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 42f4cca..f3c1355 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -17,6 +17,9 @@ int main() { return (strcmp(NEEDS_ESCAPE, "E$CAPE") == 0 +#ifdef TEST_OCTOTHORPE + && strcmp(TEST_OCTOTHORPE, "#") == 0 +#endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0 && TEST_C_COMPILER_VERSION_EQUALITY == 1 diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index d57a8b2..a3f83c9 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -43,3 +43,25 @@ add_custom_target(checksayhello ALL COMMAND ${CMAKE_COMMAND} -P ${FortranOnly_SOURCE_DIR}/checksayhello.cmake ) add_dependencies(checksayhello sayhello) + +# Exclude this test on IBM XL for now because the check strangely +# fails with 'ld: 0706-029 Use a number with the -H flag'. +if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL XL) + set(err_log ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log) + file(REMOVE "${err_log}") + include(CheckFortranSourceCompiles) + unset(HAVE_PRINT CACHE) + CHECK_Fortran_SOURCE_COMPILES([[ + PROGRAM TEST_HAVE_PRINT + PRINT *, 'Hello' + END +]] HAVE_PRINT) + if(NOT HAVE_PRINT) + if(EXISTS "${err_log}") + file(READ "${err_log}" err) + endif() + string(REPLACE "\n" "\n " err " ${err}") + message(SEND_ERROR "CHECK_Fortran_SOURCE_COMPILES for HAVE_PRINT failed:\n" + "${err}") + endif() +endif() |