Re: [cmake-developers] [PATCH] Imported targets for XercesC

2015-11-20 Thread Roger Leigh

On 19/11/2015 16:15, Brad King wrote:

On 11/18/2015 12:07 PM, rle...@codelibre.net wrote:

Patch attached to add imported target (XercesC::XercesC),
along with a unit test.


Looks good, but please also update the module documentation.
We'll also need a release note, e.g.

 $ cat Help/release/dev/FindXercesC-imported-targets.rst
 FindXercesC-imported-targets
 

 * The :module:`FindXercesC` module now provides imported targets.


No problem, I've done this in the attached patch.

Thanks,
Roger

>From ff9ee3e81010e3db81cbcee95b1a15d28117789c Mon Sep 17 00:00:00 2001
From: Roger Leigh 
Date: Wed, 18 Nov 2015 16:45:54 +
Subject: [PATCH] XercesC: Add imported targets and unit test

---
 Help/release/dev/FindXercesC-imported-targets.rst |  4 ++
 Modules/FindXercesC.cmake | 67 +++
 Tests/CMakeLists.txt  |  4 ++
 Tests/FindXercesC/CMakeLists.txt  | 10 
 Tests/FindXercesC/Test/CMakeLists.txt | 17 ++
 Tests/FindXercesC/Test/main.cxx   |  7 +++
 6 files changed, 99 insertions(+), 10 deletions(-)
 create mode 100644 Help/release/dev/FindXercesC-imported-targets.rst
 create mode 100644 Tests/FindXercesC/CMakeLists.txt
 create mode 100644 Tests/FindXercesC/Test/CMakeLists.txt
 create mode 100644 Tests/FindXercesC/Test/main.cxx

diff --git a/Help/release/dev/FindXercesC-imported-targets.rst 
b/Help/release/dev/FindXercesC-imported-targets.rst
new file mode 100644
index 000..69cec5c
--- /dev/null
+++ b/Help/release/dev/FindXercesC-imported-targets.rst
@@ -0,0 +1,4 @@
+FindXercesC-imported-targets
+
+
+* The :module:`FindXercesC` module now provides imported targets.
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index cf84826..a4b80e5 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -4,23 +4,42 @@
 #
 # Find the Apache Xerces-C++ validating XML parser headers and libraries.
 #
-# This module reports information about the Xerces installation in
-# several variables.  General variables::
+# Imported targets
+# 
 #
-#   XercesC_FOUND - true if the Xerces headers and libraries were found
-#   XercesC_VERSION - Xerces release version
-#   XercesC_INCLUDE_DIRS - the directory containing the Xerces headers
-#   XercesC_LIBRARIES - Xerces libraries to be linked
+# This module defines the following :prop_tgt:`IMPORTED` targets:
 #
-# The following cache variables may also be set::
+# ``XercesC::XercesC``
+#   The Xerces-C++ ``xerces-c`` library, if found.
 #
-#   XercesC_INCLUDE_DIR - the directory containing the Xerces headers
-#   XercesC_LIBRARY - the Xerces library
+# Result variables
+# 
+#
+# This module will set the following variables in your project:
+#
+# ``XercesC_FOUND``
+#   true if the Xerces headers and libraries were found
+# ``XercesC_VERSION``
+#   Xerces release version
+# ``XercesC_INCLUDE_DIRS``
+#   the directory containing the Xerces headers
+# ``XercesC_LIBRARIES``
+#   Xerces libraries to be linked
+#
+# Cache variables
+# ^^^
+#
+# The following cache variables may also be set:
+#
+# ``XercesC_INCLUDE_DIR``
+#   the directory containing the Xerces headers
+# ``XercesC_LIBRARY``
+#   the Xerces library
 
 # Written by Roger Leigh 
 
 #=
-# Copyright 2014 University of Dundee
+# Copyright 2014-2015 University of Dundee
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -90,4 +109,32 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XercesC
 if(XercesC_FOUND)
   set(XercesC_INCLUDE_DIRS "${XercesC_INCLUDE_DIR}")
   set(XercesC_LIBRARIES "${XercesC_LIBRARY}")
+
+  # For header-only libraries
+  if(NOT TARGET XercesC::XercesC)
+add_library(XercesC::XercesC UNKNOWN IMPORTED)
+if(XercesC_INCLUDE_DIRS)
+  set_target_properties(XercesC::XercesC PROPERTIES
+INTERFACE_INCLUDE_DIRECTORIES "${XercesC_INCLUDE_DIRS}")
+endif()
+if(EXISTS "${XercesC_LIBRARY}")
+  set_target_properties(XercesC::XercesC PROPERTIES
+IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
+IMPORTED_LOCATION "${XercesC_LIBRARY}")
+endif()
+if(EXISTS "${XercesC_LIBRARY_DEBUG}")
+  set_property(TARGET XercesC::XercesC APPEND PROPERTY
+IMPORTED_CONFIGURATIONS DEBUG)
+  set_target_properties(XercesC::XercesC PROPERTIES
+IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+IMPORTED_LOCATION_DEBUG "${XercesC_LIBRARY_DEBUG}")
+endif()
+if(EXISTS "${XercesC_LIBRARY_RELEASE}")
+  set_property(TARGET XercesC::XercesC APPEND PROPERTY
+IMPORTED_CONFIGURATIONS RELEASE)
+  set_target_properties(XercesC::XercesC PROPERTIES
+IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
+IMPORTED_LOCATION_RELEASE "${XercesC_LIBRARY_RELEASE}")
+ 

Re: [cmake-developers] Adding source files not built by targets to CMake project

2015-11-20 Thread Marcus D. Hanwell
On Fri, Nov 20, 2015 at 10:46 AM, Nils Gladitz  wrote:
> On 11/20/2015 04:43 PM, Marcus D. Hanwell wrote:
>>
>> I would like to see these files listed in Qt Creator (or insert your
>> IDE of choice here). Is there anyway to do this, knowing that these
>> files are not going to be built for a target (or compiled in any way).
>> Any trick I am missing to make this work? When I include a .cmake file
>> I see it is added, so I feel like there is some plumbing already in
>> place to feed through these source files that are not built by
>> targets.
>
>
> If they are related to an existing build target
> (add_executable()/add_library()) you can list them there with your regular
> sources.
> Otherwise e.g. add_custom_target(my_custom_target SOURCES foo.py bar.json
> ...) should work.
>
Thanks, the add_custom_target works great. I hadn't thought of trying
that, glad the answer was so simple.

Marcus
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] MSVC_VERSION

2015-11-20 Thread Ben Boeckel
On Fri, Nov 20, 2015 at 17:22:33 +, Robert Goulet wrote:
> I'm looking to find where is MSVC_VERSION defined in CMake? I added a
> new platform support that builds in Visual Studio, but MSVC_VERSION is
> not defined for my new platform and I would like to do it just like we
> do for standard Windows projects. Is it in .cmake files or in .cpp
> files? Thanks!

It appears to be set in:

Modules/Platform/Windows-MSVC.cmake

--Ben
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] MSVC_VERSION

2015-11-20 Thread Robert Goulet
Hi,

I'm looking to find where is MSVC_VERSION defined in CMake? I added a new 
platform support that builds in Visual Studio, but MSVC_VERSION is not defined 
for my new platform and I would like to do it just like we do for standard 
Windows projects. Is it in .cmake files or in .cpp files? Thanks!

-Robert Goulet

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

[cmake-developers] FW: [PATCH] CMake 3.4.0rc3 Apple documentation update

2015-11-20 Thread Bartosz Kosiorek
Hello
Could you please give me an feedback regarding that documentation patch?
I have some spare time to fix that.

Because I didn't tested cmake with watchOS and TVos, I wasn't mention about 
other than OSX and iOS system.
Once I have such hardware and test it, I will update documentation.

Thanks in advance
Bartosz

-Original Message-
From: cmake-developers [mailto:cmake-developers-boun...@cmake.org] On Behalf Of 
Bartosz Kosiorek
Sent: Wednesday, November 11, 2015 5:48 AM
To: Gregor Jasny; cmake-developers@cmake.org
Subject: [SPAM] [cmake-developers] [PATCH] CMake 3.4.0rc3 Apple documentation 
update
Importance: Low

Hello.

I think before release CMake 3.4.0 the documentation needs to be updated, to 
reflect last changes in CMake regarding Apple platform.

I have created bug report for that issue:
https://public.kitware.com/Bug/view.php?id=15843

I also updated documentation. Please take a look at attachment.

Best Regards
Bartosz
From f4889ec1dbe8348baab544e6aa378f8cee12b2b7 Mon Sep 17 00:00:00 2001
From: Bartosz Kosiorek 
Date: Wed, 11 Nov 2015 05:37:15 +0100
Subject: [PATCH] Update documentation to reflect support for iOS.

---
 Help/manual/cmake-buildsystem.7.rst   |  9 ++---
 Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst  | 26 +
 Help/prop_tgt/BUNDLE.rst  |  6 +++---
 Help/prop_tgt/BUNDLE_EXTENSION.rst|  4 ++--
 Help/prop_tgt/ENABLE_EXPORTS.rst  |  4 ++--
 Help/prop_tgt/FRAMEWORK.rst   | 28 +++
 Help/prop_tgt/FRAMEWORK_VERSION.rst   |  3 +++
 Help/prop_tgt/MACOSX_BUNDLE.rst   | 16 +++
 Help/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.rst|  4 ++--
 Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst |  4 ++--
 Help/prop_tgt/MACOSX_RPATH.rst|  6 +++---
 Help/prop_tgt/OSX_ARCHITECTURES_CONFIG.rst|  2 +-
 Help/prop_tgt/PRIVATE_HEADER.rst  | 10 +-
 Help/prop_tgt/PUBLIC_HEADER.rst   | 12 ++--
 Help/prop_tgt/RESOURCE.rst| 12 ++--
 Help/variable/APPLE.rst   |  4 ++--
 Help/variable/CMAKE_ENABLE_EXPORTS.rst|  8 
 Help/variable/CMAKE_HOST_SYSTEM_NAME.rst  |  2 +-
 Help/variable/CMAKE_INSTALL_NAME_DIR.rst  |  2 +-
 Help/variable/CMAKE_MACOSX_RPATH.rst  |  2 +-
 Help/variable/CMAKE_OSX_ARCHITECTURES.rst |  2 +-
 21 files changed, 97 insertions(+), 69 deletions(-)

diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index bc633e6..475d241 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -95,15 +95,18 @@ Apple Frameworks
 
 
 A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK`
-target property to create an OS X Framework:
+target property to create an OS X or iOS Framework Bundle.
+The :prop_tgt:`MACOSX_FRAMEWORK_IDENTIFIER` sets ``CFBundleIdentifier`` key
+and it uniquely identifies the bundle. 
 
 .. code-block:: cmake
 
   add_library(MyFramework SHARED MyFramework.cpp)
   set_target_properties(MyFramework PROPERTIES
-FRAMEWORK 1
+FRAMEWORK TRUE
 FRAMEWORK_VERSION A
-)
+MACOSX_FRAMEWORK_IDENTIFIER org.cmake.MyFramework
+  )
 
 .. _`Object Libraries`:
 
diff --git a/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst b/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst
index 27f2929..1b5b97b 100644
--- a/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst
+++ b/Help/prop_sf/MACOSX_PACKAGE_LOCATION.rst
@@ -1,19 +1,21 @@
 MACOSX_PACKAGE_LOCATION
 ---
 
-Place a source file inside a Mac OS X bundle, CFBundle, or framework.
+Place a source file inside a Application Bundle (:prop_tgt:`MACOSX_BUNDLE`), 
+Core Foundation Bundle (:prop_tgt:`BUNDLE`), or Framework Bundle (:prop_tgt:`FRAMEWORK`). 
+It is applicable for OS X and iOS.
 
-Executable targets with the MACOSX_BUNDLE property set are built as
-Mac OS X application bundles on Apple platforms.  Shared library
-targets with the FRAMEWORK property set are built as Mac OS X
-frameworks on Apple platforms.  Module library targets with the BUNDLE
-property set are built as Mac OS X CFBundle bundles on Apple
+Executable targets with the :prop_tgt:`MACOSX_BUNDLE` property set are built as
+OS X or iOS application bundles on Apple platforms.  Shared library
+targets with the :prop_tgt:`FRAMEWORK` property set are built as OS X or iOS
+frameworks on Apple platforms.  Module library targets with the :prop_tgt:`BUNDLE`
+property set are built as OS X ``CFBundle`` bundles on Apple
 platforms.  Source files listed in the target with this property set
 will be copied to a directory inside the bundle or framework content
-folder specified by the property value.  For bundles the content
-folder is ".app/Contents".  For frameworks the content folder is
-".framework/Versions/".  For cfbundles the content
-folder is ".bundle/Contents" (unless the extension is changed).
-See the 

Re: [cmake-developers] Adding source files not built by targets to CMake project

2015-11-20 Thread Nils Gladitz

On 11/20/2015 04:43 PM, Marcus D. Hanwell wrote:

I would like to see these files listed in Qt Creator (or insert your
IDE of choice here). Is there anyway to do this, knowing that these
files are not going to be built for a target (or compiled in any way).
Any trick I am missing to make this work? When I include a .cmake file
I see it is added, so I feel like there is some plumbing already in
place to feed through these source files that are not built by
targets.


If they are related to an existing build target 
(add_executable()/add_library()) you can list them there with your 
regular sources.
Otherwise e.g. add_custom_target(my_custom_target SOURCES foo.py 
bar.json ...) should work.


Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] Adding source files not built by targets to CMake project

2015-11-20 Thread Marcus D. Hanwell
Hi,

As far as I know this is not possible, but I would love for someone to
point out the CMake invocation I missed. More and more we use a
mixture of languages in projects, such as in VTK where we have Python
wrapping, and tomviz where we have a number of algorithms implemented
in Python (and I am looking at adding some metadata files that are
JSON, others are using XML).

I would like to see these files listed in Qt Creator (or insert your
IDE of choice here). Is there anyway to do this, knowing that these
files are not going to be built for a target (or compiled in any way).
Any trick I am missing to make this work? When I include a .cmake file
I see it is added, so I feel like there is some plumbing already in
place to feed through these source files that are not built by
targets.

Sorry if this came up already, my Google skills couldn't find anything...

Thanks,

Marcus
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH] Fix Resource directory structure for iOS Bundles (Framework and Application), and update documentation

2015-11-20 Thread Brad King
On 11/18/2015 11:05 AM, Bartosz Kosiorek wrote:
> With this simple patch in attachment I would like to do two things:

Thanks for working on this.  Here are some comments on the documentation.

> +This property may be set to a list of files to be placed in the 
> corresponding  directory (eg. ``Resources`` directory for OS X) inside the 
> bundle.  On non-Apple

Please wrap long lines.

> +Following example of Application Bundle:
> +::
> +  add_executable(ExecutableTarget
> +addDemo.c
> +resourcefile.txt
> +appresourcedir/appres.txt
> +  )

CMake code examples should use the `.. code-block:: cmake` directive.

> +  set_target_properties(ExecutableTarget PROPERTIES
> +MACOSX_BUNDLE TRUE
> +MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
> +RESOURCE "${RESOURCE_FILES}"
> +  )
> +::

In reStructuredText syntax there is no trailing `::` in code blocks.

> +
> +will produce flat structure for iOS systems:
> +::
> +  ExecutableTarget.app
> +appres.txt
> +ExecutableTarget
> +Info.plist
> +resourcefile.txt
> +::

This can be written like this:

 will produce flat structure for iOS systems::

   ExecutableTarget.app
 appres.txt
 ExecutableTarget
 Info.plist
 resourcefile.txt

> \ No newline at end of file

Please add a trailing newline.

> Please let me know what do you think about that patch implementation.

Good start.  Please also extend the Tests/RunCMake/Framework
test FrameworkLayout case to cover such resource files.

Thanks,
-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers