summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/find_library.rst7
-rw-r--r--Help/manual/cmake-modules.7.rst1
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/module/CSharpUtilities.rst1
-rw-r--r--Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst2
-rw-r--r--Help/prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS.rst2
-rw-r--r--Help/prop_sf/VS_CSHARP_tagname.rst19
-rw-r--r--Help/release/3.8.rst14
-rw-r--r--Help/release/dev/find_library-custom-lib-suffix.rst6
-rw-r--r--Help/variable/CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX.rst11
-rw-r--r--Modules/CSharpUtilities.cmake298
-rw-r--r--Modules/FindHDF5.cmake81
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmFindLibraryCommand.cxx28
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx37
-rw-r--r--Source/cmGlobalXCodeGenerator.h4
-rw-r--r--Source/cmSourceFile.h1
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx93
-rw-r--r--Source/cmXCodeScheme.cxx49
-rw-r--r--Source/cmXCodeScheme.h12
-rw-r--r--Source/cmXMLWriter.cxx11
-rw-r--r--Source/cmXMLWriter.h3
-rw-r--r--Tests/CMakeOnly/find_library/CMakeLists.txt15
-rw-r--r--Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a0
-rw-r--r--Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a0
-rw-r--r--Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a0
-rw-r--r--Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a0
-rw-r--r--Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a0
-rw-r--r--Tests/CMakeOnly/find_library/libXYZ/libtest7.a0
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake23
-rw-r--r--Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake11
-rw-r--r--Tests/RunCMake/VS10Project/foo.cs3
34 files changed, 619 insertions, 118 deletions
diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst
index 1eb50f7..e912040 100644
--- a/Help/command/find_library.rst
+++ b/Help/command/find_library.rst
@@ -49,6 +49,13 @@ path to the framework ``<fullPath>/A.framework``. When a full path to a
framework is used as a library, CMake will use a ``-framework A``, and a
``-F<fullPath>`` to link the framework to the target.
+If the :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable is set all
+search paths will be tested as normal, with the suffix appended, and with
+all matches of ``lib/`` replaced with
+``lib${CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}/``. This variable overrides
+the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS`
+and :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` global properties.
+
If the :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` global property is set
all search paths will be tested as normal, with ``32/`` appended, and
with all matches of ``lib/`` replaced with ``lib32/``. This property is
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 2dd56c7..5e96d79 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -66,6 +66,7 @@ All Modules
/module/CPackRPM
/module/CPack
/module/CPackWIX
+ /module/CSharpUtilities
/module/CTest
/module/CTestCoverageCollectGCOV
/module/CTestScriptMode
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 3db2e41..5bd6365 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -370,6 +370,7 @@ Properties on Source Files
/prop_sf/SKIP_AUTOUIC
/prop_sf/SYMBOLIC
/prop_sf/VS_COPY_TO_OUT_DIR
+ /prop_sf/VS_CSHARP_tagname
/prop_sf/VS_DEPLOYMENT_CONTENT
/prop_sf/VS_DEPLOYMENT_LOCATION
/prop_sf/VS_INCLUDE_IN_VSIX
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 73fd73c..79c7cd8 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -130,6 +130,7 @@ Variables that Change Behavior
/variable/CMAKE_SYSROOT
/variable/CMAKE_FIND_APPBUNDLE
/variable/CMAKE_FIND_FRAMEWORK
+ /variable/CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX
/variable/CMAKE_FIND_LIBRARY_PREFIXES
/variable/CMAKE_FIND_LIBRARY_SUFFIXES
/variable/CMAKE_FIND_NO_INSTALL_PREFIX
diff --git a/Help/module/CSharpUtilities.rst b/Help/module/CSharpUtilities.rst
new file mode 100644
index 0000000..3621bbc
--- /dev/null
+++ b/Help/module/CSharpUtilities.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/CSharpUtilities.cmake
diff --git a/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst b/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst
index ce18b65..8396026 100644
--- a/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst
+++ b/Help/prop_gbl/FIND_LIBRARY_USE_LIB32_PATHS.rst
@@ -8,3 +8,5 @@ Whether the :command:`find_library` command should automatically search
:command:`find_library` command should automatically search the ``lib32``
variant of directories called ``lib`` in the search path when building 32-bit
binaries.
+
+See also the :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable.
diff --git a/Help/prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS.rst b/Help/prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS.rst
index e52f8eb..ed343ba 100644
--- a/Help/prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS.rst
+++ b/Help/prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS.rst
@@ -8,3 +8,5 @@ FIND_LIBRARY_USE_LIB64_PATHS is a boolean specifying whether the
:command:`find_library` command should automatically search the lib64
variant of directories called lib in the search path when building
64-bit binaries.
+
+See also the :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable.
diff --git a/Help/prop_sf/VS_CSHARP_tagname.rst b/Help/prop_sf/VS_CSHARP_tagname.rst
new file mode 100644
index 0000000..d42159f
--- /dev/null
+++ b/Help/prop_sf/VS_CSHARP_tagname.rst
@@ -0,0 +1,19 @@
+VS_CSHARP_<tagname>
+-------------------
+
+Visual Studio and CSharp source-file-specific configuration.
+
+Tell the Visual Studio generator to set the source file tag
+``<tagname>`` to a given value in the generated Visual Studio CSharp
+project. Ignored on other generators and languages. This property
+can be used to define dependencies between source files or set any
+other Visual Studio specific parameters.
+
+Example usage:
+
+.. code-block:: cmake
+
+ set_source_files_property(<filename>
+ PROPERTIES
+ VS_CSHARP_DependentUpon <other file>
+ VS_CSHARP_SubType "Form")
diff --git a/Help/release/3.8.rst b/Help/release/3.8.rst
index d427a63..efb2aa5 100644
--- a/Help/release/3.8.rst
+++ b/Help/release/3.8.rst
@@ -34,15 +34,6 @@ C#
Visual Studio (``VS_*``) are worth a look (for setting toolset
versions, root namespaces, assembly icons, ...).
-* Auto-linking in ``.csproj`` files: In C#/.NET development with
- Visual Studio there are a number of visual editors used which
- generate code. Both the generated files and the ones edited
- with the UI are connected in the ``.csproj`` file using
- ``<DependentUpon>`` tags. If CMake finds within a C# project
- any source file with extension ``.Designer.cs`` or ``.xaml.cs``,
- it checks sibling files with extension ``.xaml``, ``.settings``,
- ``.resx`` or ``.cs`` and establishes the dependency connection.
-
CUDA
^^^^
@@ -229,6 +220,11 @@ Properties
Modules
-------
+* A :module:`CSharpUtilities` module was added to aid parameterization of
+ Visual Studio C# targets. It provides functions to allow automated
+ setting of source file properties to support Windows Forms, WPF/XAML or
+ other technologies as needed.
+
* The :module:`ExternalData` module learned to support multiple
content links for one data file using different hashes, e.g.
``img.png.sha256`` and ``img.png.sha1``. This allows objects
diff --git a/Help/release/dev/find_library-custom-lib-suffix.rst b/Help/release/dev/find_library-custom-lib-suffix.rst
new file mode 100644
index 0000000..824b27e
--- /dev/null
+++ b/Help/release/dev/find_library-custom-lib-suffix.rst
@@ -0,0 +1,6 @@
+find_library-custom-lib-suffix
+------------------------------
+
+* A :variable:`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable was added to
+ tell the :command:`find_library` command to search in a ``lib<suffix>``
+ directory before each ``lib`` directory that would normally be searched.
diff --git a/Help/variable/CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX.rst b/Help/variable/CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX.rst
new file mode 100644
index 0000000..f7c6524
--- /dev/null
+++ b/Help/variable/CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX.rst
@@ -0,0 +1,11 @@
+CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX
+------------------------------------
+
+Specify a ``<suffix>`` to tell the :command:`find_library` command to
+search in a ``lib<suffix>`` directory before each ``lib`` directory that
+would normally be searched.
+
+This overrides the behavior of related global properties:
+
+* :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS`
+* :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS`
diff --git a/Modules/CSharpUtilities.cmake b/Modules/CSharpUtilities.cmake
new file mode 100644
index 0000000..ddad85a
--- /dev/null
+++ b/Modules/CSharpUtilities.cmake
@@ -0,0 +1,298 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+CSharpUtilities
+---------------
+
+Functions to make configuration of CSharp/.NET targets easier.
+
+A collection of CMake utility functions useful for dealing with CSharp
+targets for Visual Studio generators from version 2010 and later.
+
+The following functions are provided by this module:
+
+**Main functions**
+
+- :command:`csharp_set_windows_forms_properties`
+- :command:`csharp_set_designer_cs_properties`
+- :command:`csharp_set_xaml_cs_properties`
+
+**Helper functions**
+
+- :command:`csharp_get_filename_keys`
+- :command:`csharp_get_filename_key_base`
+- :command:`csharp_get_dependentupon_name`
+
+Main functions provided by the module
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: csharp_set_windows_forms_properties
+
+ Sets source file properties for use of Windows Forms. Use this, if your CSharp
+ target uses windows forms::
+
+ csharp_set_windows_forms_properties([<file1> [<file2> [...]]])
+
+ ``<fileN>``
+ List of all source files which are relevant for setting the
+ :prop_sf:`VS_CSHARP_<tagname>` properties (including ``.cs``, ``.resx`` and
+ ``.Designer.cs`` extensions).
+
+ In the list of all given files for all files ending with ``.Designer.cs`` and
+ ``.resx`` is searched. For every *designer* or *resource* file a file with the
+ same base name but only ``.cs`` as extension is searched. If this is found, the
+ :prop_sf:`VS_CSHARP_<tagname>` properties are set as follows:
+
+ for the **.cs** file:
+ - VS_CSHARP_SubType "Form"
+
+ for the **.Designer.cs** file (if it exists):
+ - VS_CSHARP_DependentUpon <cs-filename>
+ - VS_CSHARP_DesignTime "" (delete tag if previously defined)
+ - VS_CSHARP_AutoGen ""(delete tag if previously defined)
+
+ for the **.resx** file (if it exists):
+ - VS_RESOURCE_GENERATOR "" (delete tag if previously defined)
+ - VS_CSHARP_DependentUpon <cs-filename>
+ - VS_CSHARP_SubType "Designer"
+
+.. command:: csharp_set_designer_cs_properties
+
+ Sets source file properties for use of WPF/XAML. Use this, if your CSharp
+ target uses WPF/XAML::
+
+ csharp_set_designer_cs_properties([<file1> [<file2> [...]]])
+
+ ``<fileN>``
+ List of all source files which are relevant for setting the
+ :prop_sf:`VS_CSHARP_<tagname>` properties (including ``.cs``,
+ ``.resx``, ``.settings`` and ``.Designer.cs`` extensions).
+
+ In the list of all given files for all files ending with
+ ``.Designer.cs`` is searched. For every *designer* file all files
+ with the same base name but different extensions are searched. If
+ a match is found, the source file properties of the *designer* file
+ are set depending on the extension of the matched file:
+
+ if match is **.resx** file:
+ - VS_CSHARP_AutoGen "True"
+ - VS_CSHARP_DesignTime "True"
+ - VS_CSHARP_DependentUpon <resx-filename>
+
+ if match is **.cs** file:
+ - VS_CSHARP_DependentUpon <cs-filename>
+
+ if match is **.settings** file:
+ - VS_CSHARP_AutoGen "True"
+ - VS_CSHARP_DesignTimeSharedInput "True"
+ - VS_CSHARP_DependentUpon <settings-filename>
+
+.. command:: csharp_set_xaml_cs_properties
+
+ Sets source file properties for use of WPF/XAML. Use this, if your
+ CSharp target uses WPF/XAML::
+
+ csharp_set_xaml_cs_properties([<file1> [<file2> [...]]])
+
+ ``<fileN>``
+ List of all source files which are relevant for setting the
+ :prop_sf:`VS_CSHARP_<tagname>` properties (including ``.cs``,
+ ``.xaml``, and ``.xaml.cs`` extensions).
+
+ In the list of all given files for all files ending with
+ ``.xaml.cs`` is searched. For every xaml file, a file
+ with the same base name but extension ``.xaml`` is searched.
+ If a match is found, the source file properties of the ``.xaml.cs``
+ file are set:
+
+ - VS_CSHARP_DependentUpon <xaml-filename>
+
+Helper functions which are used by the above ones
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. command:: csharp_get_filename_keys
+
+ Helper function which computes a list of key values to identify
+ source files independently of relative/absolute paths given in cmake
+ and eliminates case sensitivity::
+
+ csharp_get_filename_keys(OUT [<file1> [<file2> [...]]])
+
+ ``OUT``
+ name of the variable in which the list of keys is stored
+
+ ``<fileN>``
+ filename as given to to CSharp target using :command:`add_library`
+ or :command:`add_executable`
+
+ In some way the function applies a canonicalization to the source names.
+ This is necessary to find file matches if the files have been added to
+ the target with different directory prefixes:
+
+ .. code-block:: cmake
+
+ add_library(lib
+ myfile.cs
+ ${CMAKE_CURRENT_SOURCE_DIR}/myfile.Designer.cs)
+
+ set_source_files_properties(myfile.Designer.cs PROPERTIES
+ VS_CSHARP_DependentUpon myfile.cs)
+
+ # this will fail, because in cmake
+ # - ${CMAKE_CURRENT_SOURCE_DIR}/myfile.Designer.cs
+ # - myfile.Designer.cs
+ # are not the same source file. The source file property is not set.
+
+.. command:: csharp_get_filename_key_base
+
+ Returns the full filepath and name **withouth** extension of a key.
+ KEY is expected to be a key from csharp_get_filename_keys. In BASE
+ the value of KEY without the file extension is returned::
+
+ csharp_get_filename_key_base(BASE KEY)
+
+ ``BASE``
+ The computed "base" of ``KEY``.
+
+ ``KEY``
+ The key of which the base will be computed. Expected to be a
+ upper case full filename.
+
+.. command:: csharp_get_dependentupon_name
+
+ Computes a string which can be used as value for the source file property
+ :prop_sf:`VS_CSHARP_<tagname>` with *target* being ``DependentUpon``::
+
+ csharp_get_dependentupon_name(NAME FILE)
+
+ ``NAME``
+ result value
+
+ ``FILE``
+ filename to convert to DependentUpon value
+
+ Actually this is only the filename without any path given at the moment.
+
+#]=======================================================================]
+
+function(csharp_get_filename_keys OUT)
+ set(${OUT} "")
+ foreach(f ${ARGN})
+ get_filename_component(f ${f} REALPATH)
+ string(TOUPPER ${f} f)
+ list(APPEND ${OUT} ${f})
+ endforeach()
+ set(${OUT} "${${OUT}}" PARENT_SCOPE)
+endfunction()
+
+function(csharp_get_filename_key_base base key)
+ get_filename_component(dir ${key} DIRECTORY)
+ get_filename_component(fil ${key} NAME_WE)
+ set(${base} "${dir}/${fil}" PARENT_SCOPE)
+endfunction()
+
+function(csharp_get_dependentupon_name out in)
+ get_filename_component(${out} ${in} NAME)
+ set(${out} ${${out}} PARENT_SCOPE)
+endfunction()
+
+function(csharp_set_windows_forms_properties)
+ csharp_get_filename_keys(fileKeys ${ARGN})
+ foreach(key ${fileKeys})
+ get_filename_component(ext ${key} EXT)
+ if(${ext} STREQUAL ".DESIGNER.CS" OR
+ ${ext} STREQUAL ".RESX")
+ csharp_get_filename_key_base(NAME_BASE ${key})
+ list(FIND fileKeys "${NAME_BASE}.CS" FILE_INDEX)
+ if(NOT ${FILE_INDEX} EQUAL -1)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ # set properties of main form file
+ set_source_files_properties("${FILE_NAME}"
+ PROPERTIES
+ VS_CSHARP_SubType "Form")
+ csharp_get_dependentupon_name(LINK "${FILE_NAME}")
+ # set properties of designer file (if found)
+ list(FIND fileKeys "${NAME_BASE}.DESIGNER.CS" FILE_INDEX)
+ if(NOT ${FILE_INDEX} EQUAL -1)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ set_source_files_properties("${FILE_NAME}"
+ PROPERTIES
+ VS_CSHARP_DependentUpon "${LINK}"
+ VS_CSHARP_DesignTime ""
+ VS_CSHARP_AutoGen "")
+ endif()
+ # set properties of corresponding resource file (if found)
+ list(FIND fileKeys "${NAME_BASE}.RESX" FILE_INDEX)
+ if(NOT ${FILE_INDEX} EQUAL -1)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ set_source_files_properties("${FILE_NAME}"
+ PROPERTIES
+ VS_RESOURCE_GENERATOR ""
+ VS_CSHARP_DependentUpon "${LINK}"
+ VS_CSHARP_SubType "Designer")
+ endif()
+ endif()
+ endif()
+ endforeach()
+endfunction()
+
+function(csharp_set_designer_cs_properties)
+ csharp_get_filename_keys(fileKeys ${ARGN})
+ set(INDEX -1)
+ foreach(key ${fileKeys})
+ math(EXPR INDEX "${INDEX}+1")
+ list(GET ARGN ${INDEX} source)
+ get_filename_component(ext ${key} EXT)
+ if(${ext} STREQUAL ".DESIGNER.CS")
+ csharp_get_filename_key_base(NAME_BASE ${key})
+ if("${NAME_BASE}.RESX" IN_LIST fileKeys)
+ list(FIND fileKeys "${NAME_BASE}.RESX" FILE_INDEX)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ csharp_get_dependentupon_name(LINK "${FILE_NAME}")
+ set_source_files_properties("${source}"
+ PROPERTIES
+ VS_CSHARP_AutoGen "True"
+ VS_CSHARP_DesignTime "True"
+ VS_CSHARP_DependentUpon "${LINK}")
+ elseif("${NAME_BASE}.CS" IN_LIST fileKeys)
+ list(FIND fileKeys "${NAME_BASE}.CS" FILE_INDEX)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ csharp_get_dependentupon_name(LINK "${FILE_NAME}")
+ set_source_files_properties("${source}"
+ PROPERTIES
+ VS_CSHARP_DependentUpon "${LINK}")
+ elseif("${NAME_BASE}.SETTINGS" IN_LIST fileKeys)
+ list(FIND fileKeys "${NAME_BASE}.SETTINGS" FILE_INDEX)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ csharp_get_dependentupon_name(LINK "${FILE_NAME}")
+ set_source_files_properties("${source}"
+ PROPERTIES
+ VS_CSHARP_AutoGen "True"
+ VS_CSHARP_DesignTimeSharedInput "True"
+ VS_CSHARP_DependentUpon "${LINK}")
+ endif()
+ endif()
+ endforeach()
+endfunction()
+
+function(csharp_set_xaml_cs_properties)
+ csharp_get_filename_keys(fileKeys ${ARGN})
+ set(INDEX -1)
+ foreach(key ${fileKeys})
+ math(EXPR INDEX "${INDEX}+1")
+ list(GET ARGN ${INDEX} source)
+ get_filename_component(ext ${key} EXT)
+ if(${ext} STREQUAL ".XAML.CS")
+ csharp_get_filename_key_base(NAME_BASE ${key})
+ if("${NAME_BASE}.XAML" IN_LIST fileKeys)
+ list(FIND fileKeys "${NAME_BASE}.XAML" FILE_INDEX)
+ list(GET ARGN ${FILE_INDEX} FILE_NAME)
+ csharp_get_dependentupon_name(LINK "${FILE_NAME}")
+ set_source_files_properties("${source}"
+ PROPERTIES
+ VS_CSHARP_DependentUpon "${LINK}")
+ endif()
+ endif()
+ endforeach()
+endfunction()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 65a825d..927ec64 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -59,12 +59,16 @@
# bindings, if the HL component is enabled
#
# Available components are: C CXX Fortran and HL. For each enabled language
-# binding, a corresponding HDF5_${LANG}_LIBRARIES variable will be defined.
+# binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially
+# HDF5_${LANG}_DEFINITIONS, will be defined.
# If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will
# also be defined. With all components enabled, the following variables will be defined:
#
# ::
#
+# HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings
+# HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings
+# HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings
# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings
# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings
# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
@@ -90,6 +94,8 @@
# The following variable can be set to guide the search for HDF5 libraries and includes:
#
# HDF5_ROOT
+#
+# Set HDF5_FIND_DEBUG to true to get some extra debugging output.
# This module is maintained by Will Dicharry <wdicharry@stellarscience.com>.
@@ -396,15 +402,23 @@ if(NOT HDF5_FOUND)
${_HDF5_SEARCH_OPTS}
)
if( HDF5_FOUND)
+ if(HDF5_FIND_DEBUG)
+ message(STATUS "Found HDF5 at ${HDF5_DIR} via NO_MODULE. Now trying to extract locations etc.")
+ endif()
set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
set(HDF5_LIBRARIES)
- set(HDF5_C_TARGET hdf5)
- set(HDF5_C_HL_TARGET hdf5_hl)
- set(HDF5_CXX_TARGET hdf5_cpp)
- set(HDF5_CXX_HL_TARGET hdf5_hl_cpp)
- set(HDF5_Fortran_TARGET hdf5_fortran)
- set(HDF5_Fortran_HL_TARGET hdf5_hl_fortran)
+ if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared)
+ # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc
+ set(_target_prefix "hdf5::")
+ endif()
+ set(HDF5_C_TARGET ${_target_prefix}hdf5)
+ set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl)
+ set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp)
+ set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp)
+ set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran)
+ set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran)
+ set(HDF5_DEFINITIONS "")
if(HDF5_USE_STATIC_LIBRARIES)
set(_suffix "-static")
else()
@@ -416,7 +430,7 @@ if(NOT HDF5_FOUND)
#if we detect that occurrence clear the suffix
if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix})
if(NOT TARGET ${HDF5_${_lang}_TARGET})
- #cant find this component with our without the suffix
+ #cant find this component with or without the suffix
#so bail out, and let the following locate HDF5
set(HDF5_FOUND FALSE)
break()
@@ -424,21 +438,29 @@ if(NOT HDF5_FOUND)
set(_suffix "")
endif()
- get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION)
+ if(HDF5_FIND_DEBUG)
+ message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}")
+ endif()
+ # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib.
+ get_target_property(_imported_conf ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_CONFIGURATIONS)
+ get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_imported_conf} )
+ if (NOT _lang_location)
+ # no import lib, just try LOCATION
+ get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION)
+ endif()
if( _lang_location )
- set(HDF5_${_lang}_LIBRARY ${_lang_location} CACHE PATH
- "HDF5 ${_lang} library" )
- mark_as_advanced(HDF5_${_lang}_LIBRARY)
+ set(HDF5_${_lang}_LIBRARY ${_lang_location})
list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_${_lang}_FOUND True)
endif()
if(FIND_HL)
- get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
+ get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_imported_conf} )
+ if (NOT _lang_hl_location)
+ get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
+ endif()
if( _lang_hl_location )
- set(HDF5_${_lang}_HL_LIBRARY ${_lang_hl_location} CACHE PATH
- "HDF5 ${_lang} HL library" )
- mark_as_advanced(HDF5_${_lang}_HL_LIBRARY)
+ set(HDF5_${_lang}_HL_LIBRARY ${_lang_hl_location})
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
set(HDF5_HL_FOUND True)
@@ -483,10 +505,6 @@ if(NOT HDF5_FOUND)
set(HDF5_${__lang}_HL_LIBRARIES)
mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE)
- mark_as_advanced(HDF5_${__lang}_DEFINITIONS)
- mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
- mark_as_advanced(HDF5_${__lang}_LIBRARIES)
- mark_as_advanced(HDF5_${__lang}_HL_LIBRARIES)
set(HDF5_${__lang}_FOUND True)
set(HDF5_HL_FOUND True)
@@ -576,9 +594,6 @@ if(NOT HDF5_FOUND)
endif()
set(HDF5_${__lang}_FOUND True)
- mark_as_advanced(HDF5_${__lang}_DEFINITIONS)
- mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
- mark_as_advanced(HDF5_${__lang}_LIBRARIES)
_HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS)
_HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS)
_HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES)
@@ -822,3 +837,23 @@ find_package_handle_standard_args(HDF5
)
unset(_HDF5_SEARCH_OPTS)
+
+if( HDF5_FOUND AND NOT HDF5_DIR)
+ # hide HDF5_DIR for the non-advanced user to avoid confusion with
+ # HDF5_DIR-NOT_FOUND while HDF5 was found.
+ mark_as_advanced(HDF5_DIR)
+endif()
+
+if (HDF5_FIND_DEBUG)
+ message(STATUS "HDF5_DIR: ${HDF5_DIR}")
+ message(STATUS "HDF5_DEFINITIONS: ${HDF5_DEFINITIONS}")
+ message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
+ message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}")
+ foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
+ message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}")
+ message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}")
+ message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}")
+ message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}")
+ message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}")
+ endforeach()
+endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index f85bd64..62324e8 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 8)
-set(CMake_VERSION_PATCH 20170301)
+set(CMake_VERSION_PATCH 20170302)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index c86f9c1..69f9078 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -43,20 +43,22 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
return true;
}
- if (this->Makefile->GetState()->GetGlobalPropertyAsBool(
- "FIND_LIBRARY_USE_LIB32_PATHS")) {
- // add special 32 bit paths if this is a 32 bit compile.
- if (this->Makefile->PlatformIs32Bit()) {
- this->AddArchitecturePaths("32");
- }
+ // add custom lib<qual> paths instead of using fixed lib32 or lib64
+ if (const char* customLib = this->Makefile->GetDefinition(
+ "CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX")) {
+ this->AddArchitecturePaths(customLib);
}
-
- if (this->Makefile->GetState()->GetGlobalPropertyAsBool(
- "FIND_LIBRARY_USE_LIB64_PATHS")) {
- // add special 64 bit paths if this is a 64 bit compile.
- if (this->Makefile->PlatformIs64Bit()) {
- this->AddArchitecturePaths("64");
- }
+ // add special 32 bit paths if this is a 32 bit compile.
+ else if (this->Makefile->PlatformIs32Bit() &&
+ this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "FIND_LIBRARY_USE_LIB32_PATHS")) {
+ this->AddArchitecturePaths("32");
+ }
+ // add special 64 bit paths if this is a 64 bit compile.
+ else if (this->Makefile->PlatformIs64Bit() &&
+ this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "FIND_LIBRARY_USE_LIB64_PATHS")) {
+ this->AddArchitecturePaths("64");
}
std::string library = this->FindLibrary();
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d1b6130..b023d5c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3344,7 +3344,8 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
if (this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
"XCODE_GENERATE_SCHEME") &&
this->XcodeVersion >= 70) {
- this->OutputXCodeSharedSchemes(xcodeDir, root);
+ this->OutputXCodeSharedSchemes(xcodeDir);
+ this->OutputXCodeWorkspaceSettings(xcodeDir);
}
this->ClearXCodeObjects();
@@ -3356,7 +3357,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
}
void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
- const std::string& xcProjDir, cmLocalGenerator* root)
+ const std::string& xcProjDir)
{
for (std::vector<cmXCodeObject*>::const_iterator i =
this->XCodeObjects.begin();
@@ -3368,11 +3369,41 @@ void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes(
cmXCodeScheme schm(obj, this->CurrentConfigurationTypes,
this->XcodeVersion);
schm.WriteXCodeSharedScheme(xcProjDir,
- root->GetCurrentSourceDirectory());
+ this->RelativeToSource(xcProjDir.c_str()));
}
}
}
+void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings(
+ const std::string& xcProjDir)
+{
+ std::string xcodeSharedDataDir = xcProjDir;
+ xcodeSharedDataDir += "/project.xcworkspace/xcshareddata";
+ cmSystemTools::MakeDirectory(xcodeSharedDataDir);
+
+ std::string workspaceSettingsFile = xcodeSharedDataDir;
+ workspaceSettingsFile += "/WorkspaceSettings.xcsettings";
+
+ cmGeneratedFileStream fout(workspaceSettingsFile.c_str());
+ fout.SetCopyIfDifferent(true);
+ if (!fout) {
+ return;
+ }
+
+ cmXMLWriter xout(fout);
+ xout.StartDocument();
+ xout.Doctype("plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\""
+ "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"");
+ xout.StartElement("plist");
+ xout.Attribute("version", "1.0");
+ xout.StartElement("dict");
+ xout.Element("key", "IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded");
+ xout.Element("false");
+ xout.EndElement(); // dict
+ xout.EndElement(); // plist
+ xout.EndDocument();
+}
+
void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmLocalGenerator*,
std::vector<cmLocalGenerator*>&)
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index c9157b0..9eacdef 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -166,8 +166,8 @@ private:
void OutputXCodeProject(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
// Write shared scheme files for all the native targets
- void OutputXCodeSharedSchemes(const std::string& xcProjDir,
- cmLocalGenerator* root);
+ void OutputXCodeSharedSchemes(const std::string& xcProjDir);
+ void OutputXCodeWorkspaceSettings(const std::string& xcProjDir);
void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string& fullpath,
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index b193f65..bbcc300 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -86,6 +86,7 @@ public:
// Get the properties
cmPropertyMap& GetProperties() { return this->Properties; }
+ const cmPropertyMap& GetProperties() const { return this->Properties; }
/**
* Check whether the given source file location could refer to this
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index eac48ee..fbf7447 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -707,20 +707,40 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
if (const char* g = (*oi)->GetProperty("VS_RESOURCE_GENERATOR")) {
generator = g;
}
- this->WriteString("<Generator>", 3);
- (*this->BuildFileStream) << cmVS10EscapeXML(generator)
- << "</Generator>\n";
- if (designerResource.find(srcDir) == 0) {
- designerResource = designerResource.substr(srcDir.length() + 1);
- } else if (designerResource.find(binDir) == 0) {
- designerResource = designerResource.substr(binDir.length() + 1);
- } else {
- designerResource =
- cmsys::SystemTools::GetFilenameName(designerResource);
+ if (!generator.empty()) {
+ this->WriteString("<Generator>", 3);
+ (*this->BuildFileStream) << cmVS10EscapeXML(generator)
+ << "</Generator>\n";
+ if (designerResource.find(srcDir) == 0) {
+ designerResource = designerResource.substr(srcDir.length() + 1);
+ } else if (designerResource.find(binDir) == 0) {
+ designerResource = designerResource.substr(binDir.length() + 1);
+ } else {
+ designerResource =
+ cmsys::SystemTools::GetFilenameName(designerResource);
+ }
+ this->ConvertToWindowsSlash(designerResource);
+ this->WriteString("<LastGenOutput>", 3);
+ (*this->BuildFileStream) << designerResource
+ << "</LastGenOutput>\n";
+ }
+ }
+ const cmPropertyMap& props = (*oi)->GetProperties();
+ for (cmPropertyMap::const_iterator p = props.begin(); p != props.end();
+ ++p) {
+ static const std::string propNamePrefix = "VS_CSHARP_";
+ if (p->first.find(propNamePrefix.c_str()) == 0) {
+ std::string tagName = p->first.substr(propNamePrefix.length());
+ if (!tagName.empty()) {
+ std::string value = props.GetPropertyValue(p->first);
+ if (!value.empty()) {
+ this->WriteString("<", 3);
+ (*this->BuildFileStream) << tagName << ">";
+ (*this->BuildFileStream) << cmVS10EscapeXML(value);
+ (*this->BuildFileStream) << "</" << tagName << ">\n";
+ }
+ }
}
- this->ConvertToWindowsSlash(designerResource);
- this->WriteString("<LastGenOutput>", 3);
- (*this->BuildFileStream) << designerResource << "</LastGenOutput>\n";
}
}
@@ -1969,42 +1989,21 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
sourceFileTags["Link"] = link;
}
}
- // check if file is a generated .Designer.cs or .xaml.cs file
- // to add additional necessary tags
- const std::string fileExtension =
- cmsys::SystemTools::GetFilenameExtension(f);
- if (fileExtension == ".Designer.cs" || fileExtension == ".xaml.cs") {
- f = f.substr(0, f.length() - fileExtension.length());
- if (sourceFileTags.find("Link") == sourceFileTags.end() &&
- !this->InSourceBuild) {
- // add link fallback
- sourceFileTags["Link"] =
- cmsys::SystemTools::GetFilenameName(f) + fileExtension;
- }
- std::vector<std::string> extensions;
- extensions.push_back(".resx");
- extensions.push_back(".settings");
- extensions.push_back(".xaml");
- extensions.push_back(".cs");
- std::string dependencyExtension;
- for (std::vector<std::string>::iterator i = extensions.begin();
- i != extensions.end(); ++i) {
- if (cmsys::SystemTools::FileExists(f + *i)) {
- dependencyExtension = *i;
- // There should never be more than one match. Otherwise
- // one cannot tell on which match the file depends.
- break;
+ const cmPropertyMap& props = sf.GetProperties();
+ for (cmPropertyMap::const_iterator p = props.begin(); p != props.end();
+ ++p) {
+ static const std::string propNamePrefix = "VS_CSHARP_";
+ if (p->first.find(propNamePrefix.c_str()) == 0) {
+ std::string tagName = p->first.substr(propNamePrefix.length());
+ if (!tagName.empty()) {
+ const std::string val = props.GetPropertyValue(p->first);
+ if (!val.empty()) {
+ sourceFileTags[tagName] = val;
+ } else {
+ sourceFileTags.erase(tagName);
+ }
}
}
- if (dependencyExtension == ".resx") {
- sourceFileTags["DesignTime"] = "True";
- sourceFileTags["AutoGen"] = "True";
- } else if (dependencyExtension == ".settings") {
- sourceFileTags["DesignTimeSharedInput"] = "True";
- sourceFileTags["AutoGen"] = "True";
- }
- sourceFileTags["DependentUpon"] =
- cmsys::SystemTools::GetFilenameName(f) + dependencyExtension;
}
// write source file specific tags
if (!sourceFileTags.empty()) {
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index 3c8c0b7..5c22531 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -3,6 +3,7 @@
#include "cmXCodeScheme.h"
#include <iomanip>
+#include <iostream>
#include <sstream>
#include "cmGeneratedFileStream.h"
@@ -12,7 +13,9 @@
cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj,
const std::vector<std::string>& configList,
unsigned int xcVersion)
- : TargetName(xcObj->GetTarget()->GetName())
+ : Target(xcObj)
+ , TargetName(xcObj->GetTarget()->GetName())
+ , BuildableName(xcObj->GetTarget()->GetFullName())
, TargetId(xcObj->GetId())
, ConfigList(configList)
, XcodeVersion(xcVersion)
@@ -20,7 +23,7 @@ cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj,
}
void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
- const std::string sourceRoot)
+ const std::string& container)
{
// Create shared scheme sub-directory tree
//
@@ -39,14 +42,14 @@ void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
return;
}
- std::string xcProjRelDir = xcProjDir.substr(sourceRoot.size() + 1);
- WriteXCodeXCScheme(fout, xcProjRelDir);
+ WriteXCodeXCScheme(fout, container);
}
void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
- const std::string& xcProjDir)
+ const std::string& container)
{
cmXMLWriter xout(fout);
+ xout.SetIndentationElement(std::string(3, ' '));
xout.StartDocument();
xout.StartElement("Scheme");
@@ -54,9 +57,9 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
xout.Attribute("LastUpgradeVersion", WriteVersionString());
xout.Attribute("version", "1.3");
- WriteBuildAction(xout, xcProjDir);
+ WriteBuildAction(xout, container);
WriteTestAction(xout, FindConfiguration("Debug"));
- WriteLaunchAction(xout, FindConfiguration("Debug"), xcProjDir);
+ WriteLaunchAction(xout, FindConfiguration("Debug"), container);
WriteProfileAction(xout, FindConfiguration("Release"));
WriteAnalyzeAction(xout, FindConfiguration("Debug"));
WriteArchiveAction(xout, FindConfiguration("Release"));
@@ -65,7 +68,7 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
}
void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
- const std::string& xcProjDir)
+ const std::string& container)
{
xout.StartElement("BuildAction");
xout.BreakAttributes();
@@ -85,9 +88,9 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout,
xout.BreakAttributes();
xout.Attribute("BuildableIdentifier", "primary");
xout.Attribute("BlueprintIdentifier", this->TargetId);
- xout.Attribute("BuildableName", this->TargetName);
+ xout.Attribute("BuildableName", this->BuildableName);
xout.Attribute("BlueprintName", this->TargetName);
- xout.Attribute("ReferencedContainer", "container:" + xcProjDir);
+ xout.Attribute("ReferencedContainer", "container:" + container);
xout.EndElement();
xout.EndElement(); // BuildActionEntry
@@ -118,7 +121,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout,
void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
std::string configuration,
- const std::string& xcProjDir)
+ const std::string& container)
{
xout.StartElement("LaunchAction");
xout.BreakAttributes();
@@ -134,15 +137,22 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
xout.Attribute("debugServiceExtension", "internal");
xout.Attribute("allowLocationSimulation", "YES");
- xout.StartElement("MacroExpansion");
+ if (IsExecutable(this->Target)) {
+ xout.StartElement("BuildableProductRunnable");
+ xout.BreakAttributes();
+ xout.Attribute("runnableDebuggingMode", "0");
+
+ } else {
+ xout.StartElement("MacroExpansion");
+ }
xout.StartElement("BuildableReference");
xout.BreakAttributes();
xout.Attribute("BuildableIdentifier", "primary");
xout.Attribute("BlueprintIdentifier", this->TargetId);
- xout.Attribute("BuildableName", this->TargetName);
+ xout.Attribute("BuildableName", this->BuildableName);
xout.Attribute("BlueprintName", this->TargetName);
- xout.Attribute("ReferencedContainer", "container:" + xcProjDir);
+ xout.Attribute("ReferencedContainer", "container:" + container);
xout.EndElement();
xout.EndElement(); // MacroExpansion
@@ -204,3 +214,14 @@ std::string cmXCodeScheme::FindConfiguration(const std::string& name)
return name;
}
+
+bool cmXCodeScheme::IsExecutable(const cmXCodeObject* target)
+{
+ cmGeneratorTarget* gt = target->GetTarget();
+ if (!gt) {
+ cmSystemTools::Error("Error no target on xobject\n");
+ return false;
+ }
+
+ return gt->GetType() == cmStateEnums::EXECUTABLE;
+}
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index b174c51..0a8e737 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -21,26 +21,30 @@ public:
unsigned int xcVersion);
void WriteXCodeSharedScheme(const std::string& xcProjDir,
- const std::string sourceRoot);
+ const std::string& container);
private:
+ const cmXCodeObject* const Target;
const std::string& TargetName;
+ const std::string BuildableName;
const std::string& TargetId;
const std::vector<std::string>& ConfigList;
const unsigned int XcodeVersion;
- void WriteXCodeXCScheme(std::ostream& fout, const std::string& xcProjDir);
+ void WriteXCodeXCScheme(std::ostream& fout, const std::string& container);
- void WriteBuildAction(cmXMLWriter& xout, const std::string& xcProjDir);
+ void WriteBuildAction(cmXMLWriter& xout, const std::string& container);
void WriteTestAction(cmXMLWriter& xout, std::string configuration);
void WriteLaunchAction(cmXMLWriter& xout, std::string configuration,
- const std::string& xcProjDir);
+ const std::string& container);
void WriteProfileAction(cmXMLWriter& xout, std::string configuration);
void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration);
void WriteArchiveAction(cmXMLWriter& xout, std::string configuration);
std::string WriteVersionString();
std::string FindConfiguration(const std::string& name);
+
+ static bool IsExecutable(const cmXCodeObject* target);
};
#endif
diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx
index 2f50fe9..541cb3d 100644
--- a/Source/cmXMLWriter.cxx
+++ b/Source/cmXMLWriter.cxx
@@ -7,6 +7,7 @@
cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level)
: Output(output)
+ , IndentationElement(1, '\t')
, Level(level)
, ElementOpen(false)
, BreakAttrib(false)
@@ -100,10 +101,18 @@ void cmXMLWriter::FragmentFile(const char* fname)
this->Output << fin.rdbuf();
}
+void cmXMLWriter::SetIndentationElement(std::string const& element)
+{
+ this->IndentationElement = element;
+}
+
void cmXMLWriter::ConditionalLineBreak(bool condition, std::size_t indent)
{
if (condition) {
- this->Output << '\n' << std::string(indent + this->Level, '\t');
+ this->Output << '\n';
+ for (std::size_t i = 0; i < indent + this->Level; ++i) {
+ this->Output << this->IndentationElement;
+ }
}
}
diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h
index 904f73b..6d1e6b4 100644
--- a/Source/cmXMLWriter.h
+++ b/Source/cmXMLWriter.h
@@ -60,6 +60,8 @@ public:
void FragmentFile(const char* fname);
+ void SetIndentationElement(std::string const& element);
+
private:
cmXMLWriter(const cmXMLWriter&);
cmXMLWriter& operator=(const cmXMLWriter&);
@@ -107,6 +109,7 @@ private:
private:
std::ostream& Output;
std::stack<std::string, std::vector<std::string> > Elements;
+ std::string IndentationElement;
std::size_t Level;
bool ElementOpen;
bool BreakAttrib;
diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt
index 9958650..9c1aad8 100644
--- a/Tests/CMakeOnly/find_library/CMakeLists.txt
+++ b/Tests/CMakeOnly/find_library/CMakeLists.txt
@@ -24,7 +24,7 @@ endmacro()
macro(test_find_library_subst expected)
get_filename_component(dir ${expected} PATH)
get_filename_component(name ${expected} NAME)
- string(REGEX REPLACE "lib/?64" "lib" dir "${dir}")
+ string(REGEX REPLACE "lib/?[36X][24Y][Z]*" "lib" dir "${dir}")
test_find_library(", searched as ${dir}" "${expected}"
NAMES ${name}
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}
@@ -79,3 +79,16 @@ test_find_library("" A/libtestA.a
NAMES testB testA NAMES_PER_DIR
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
)
+
+set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "XYZ")
+foreach(libXYZ
+ lib/XYZ/libtest1.a
+ lib/A/libXYZ/libtest2.a
+ lib/libtest3.a
+ libXYZ/A/lib/libtest4.a
+ libXYZ/A/libXYZ/libtest5.a
+ libXYZ/A/libtest6.a
+ libXYZ/libtest7.a
+ )
+ test_find_library_subst(${libXYZ})
+endforeach()
diff --git a/Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a b/Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a
diff --git a/Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a b/Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a
diff --git a/Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a b/Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a
diff --git a/Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a b/Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a
diff --git a/Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a b/Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a
diff --git a/Tests/CMakeOnly/find_library/libXYZ/libtest7.a b/Tests/CMakeOnly/find_library/libXYZ/libtest7.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/libXYZ/libtest7.a
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index bc1ec97..3af877f 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -3,3 +3,4 @@ run_cmake(VsConfigurationType)
run_cmake(VsTargetsFileReferences)
run_cmake(VsCustomProps)
run_cmake(VsDebuggerWorkingDir)
+run_cmake(VsCSharpCustomTags)
diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake
new file mode 100644
index 0000000..70ea193
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags-check.cmake
@@ -0,0 +1,23 @@
+set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj")
+if(NOT EXISTS "${csProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.")
+ return()
+endif()
+
+set(tagFound FALSE)
+
+set(tagName "MyCustomTag")
+set(tagValue "MyCustomValue")
+
+file(STRINGS "${csProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<${tagName}>${tagValue}</${tagName}>")
+ message(STATUS "foo.csproj has tag ${tagName} with value ${tagValue} defined")
+ set(tagFound TRUE)
+ endif()
+endforeach()
+
+if(NOT tagFound)
+ set(RunCMake_TEST_FAILED "Source file tag ${tagName} with value ${tagValue} not found.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake
new file mode 100644
index 0000000..c51e9c3
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpCustomTags.cmake
@@ -0,0 +1,11 @@
+enable_language(CSharp)
+add_library(foo foo.cs)
+
+set(props_file "${CMAKE_CURRENT_SOURCE_DIR}/my.props")
+
+set(tagName "MyCustomTag")
+set(tagValue "MyCustomValue")
+
+set_source_files_properties(foo.cs
+ PROPERTIES
+ VS_CSHARP_${tagName} "${tagValue}")
diff --git a/Tests/RunCMake/VS10Project/foo.cs b/Tests/RunCMake/VS10Project/foo.cs
new file mode 100644
index 0000000..3695dc9
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/foo.cs
@@ -0,0 +1,3 @@
+void foo()
+{
+}