[cmake-developers] How to work with QtDialog?

2015-02-15 Thread Robert Dailey
I'm making minor modifications to add -T support to cmake-gui.
However, I'm not familiar with how to develop CMake's GUI application.
Do I generate for Visual Studio 2013 (I'm on windows)? I'm able to
compile the QT dialog application and run it from Visual Studio,
however if I have to add new signals, i end up having to manually edit
the moc_* files. I assume those are generated.

Could I get some workflow tips? Thanks.
-- 

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] Conflicting types for 'cmsysProcess_SetPipeNative' compiling in MinGW

2015-02-15 Thread vano
Completely puzzled by this: a declaration conflicts with... itself?!

$ uname -a
MINGW32_NT-6.1 IVAN-POWERPC 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys

The error part follows, full output is attached.
This happens with both cmake-3.2.0-rc1 and cmake-3.1.3.

...
gcc -I/c/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk 
-I/c/Users/native_api/Documents/cmake-3.2.0-rc1/Source   
-I/c/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk 
-DKWSYS_NAMESPACE=cmsys  -c 
/c/Users/native_api/Documents/cmake-3.2.0-rc1/Source/kwsys/ProcessWin32.c -o 
ProcessWin32.o
In file included from 
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk/cmsys/Process.h:15:0,
 from 
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Source/kwsys/ProcessWin32.c:13:
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk/cmsys/Configure.h:40:22:
 error: conflicting types for 'cmsysProcess_SetPipeNative'
 # define kwsys_ns(x) cmsys##x
  ^
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk/cmsys/Process.h:35:43:
 note: in expansion of macro 'kwsys_ns'
 # define kwsysProcess_SetPipeNative   kwsys_ns(Process_SetPipeNative)
   ^
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Source/kwsys/ProcessWin32.c:749:6:
 note: in expansion of macro 'kwsysProcess_SetPipeNative'
 void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe, HANDLE p[2])
  ^
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk/cmsys/Configure.h:40:22:
 note: previous declaration of 'cmsysProcess_SetPipeNative' was here
 # define kwsys_ns(x) cmsys##x
  ^
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk/cmsys/Process.h:35:43:
 note: in expansion of macro 'kwsys_ns'
 # define kwsysProcess_SetPipeNative   kwsys_ns(Process_SetPipeNative)
   ^
c:/Users/native_api/Documents/cmake-3.2.0-rc1/Bootstrap.cmk/cmsys/Process.h:175:18:
 note: in expansion of macro 'kwsysProcess_SetPipeNative'
 kwsysEXPORT void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe,
  ^
make: *** [ProcessWin32.o] Error 1
-
Error when bootstrapping CMake:
Problem while running make
-

bootstrap.tar.xz
Description: application/xz-compressed-tar
-- 

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] [PATCH] Also add xctest support for Cocoa App Bundles

2015-02-15 Thread Gregor Jasny
Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Modules/XCTestUtilities.cmake  |  23 +-
 Tests/XCTest/CMakeLists.txt|  25 +-
 Tests/XCTest/CocoaExample/AppDelegate.h|   7 +
 Tests/XCTest/CocoaExample/AppDelegate.m|  18 +
 Tests/XCTest/CocoaExample/Info.plist   |  30 +
 Tests/XCTest/CocoaExample/MainMenu.xib | 680 +
 Tests/XCTest/CocoaExample/main.m   |   5 +
 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m |  13 +
 8 files changed, 797 insertions(+), 4 deletions(-)
 create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.h
 create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.m
 create mode 100644 Tests/XCTest/CocoaExample/Info.plist
 create mode 100644 Tests/XCTest/CocoaExample/MainMenu.xib
 create mode 100644 Tests/XCTest/CocoaExample/main.m
 create mode 100644 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m

diff --git a/Modules/XCTestUtilities.cmake b/Modules/XCTestUtilities.cmake
index 6b1de92..437a6dd 100644
--- a/Modules/XCTestUtilities.cmake
+++ b/Modules/XCTestUtilities.cmake
@@ -7,8 +7,12 @@ function(add_xctest target testee)
   # check that testee is a valid target type
   get_target_property(TESTEE_TYPE ${testee} TYPE)
   get_target_property(TESTEE_FRAMEWORK ${testee} FRAMEWORK)
+  get_target_property(TESTEE_MACOSX_BUNDLE ${testee} MACOSX_BUNDLE)
+
   if(TESTEE_TYPE STREQUAL SHARED_LIBRARY AND TESTEE_FRAMEWORK)
 # found a framework
+  elseif(TESTEE_TYPE STREQUAL EXECUTABLE AND TESTEE_MACOSX_BUNDLE)
+# found an app bundle
   else()
message(FATAL_ERROR Testee ${testee} is of unsupported type: 
${TESTEE_TYPE})
   endif()
@@ -29,10 +33,23 @@ function(add_xctest target testee)
 message(STATUS Could not find XCTest Framework.)
   endif()
 
-  target_link_libraries(${target} PRIVATE ${testee} ${FOUNDATION_LIBRARY} 
${XCTEST_LIBRARY})
+  target_link_libraries(${target} PRIVATE ${FOUNDATION_LIBRARY} 
${XCTEST_LIBRARY})
+
+  if(TESTEE_TYPE STREQUAL SHARED_LIBRARY AND TESTEE_FRAMEWORK)
+target_link_libraries(${target} PRIVATE ${testee})
 
-  # set rpath to find testee
-  target_link_libraries(${target} PRIVATE 
${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}$TARGET_LINKER_FILE_DIR:${testee})
+# set rpath to find testee
+target_link_libraries(${target} PRIVATE 
${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}$TARGET_LINKER_FILE_DIR:${testee})
+  elseif(TESTEE_TYPE STREQUAL EXECUTABLE AND TESTEE_MACOSX_BUNDLE)
+add_dependencies(${target} ${testee})
+if(XCODE)
+  set_target_properties(${target} PROPERTIES
+XCODE_ATTRIBUTE_BUNDLE_LOADER $(TEST_HOST)
+XCODE_ATTRIBUTE_TEST_HOST $TARGET_FILE:${testee})
+else(XCODE)
+  target_link_libraries(${target} PRIVATE -bundle_loader 
$TARGET_FILE:${testee})
+endif(XCODE)
+  endif()
 endfunction(add_xctest)
 
 function(add_test_xctest target)
diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt
index aeaccc4..dbfe23f 100644
--- a/Tests/XCTest/CMakeLists.txt
+++ b/Tests/XCTest/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
 
 set(CMAKE_OSX_SYSROOT macosx)
 
-project(XCTestFramework)
+project(XCTestExamples)
 
 include(XCTestUtilities)
 
@@ -36,3 +36,26 @@ set_target_properties(FrameworkExampleTests PROPERTIES
   )
 
 add_test_xctest(FrameworkExampleTests)
+
+# Cocoa App Bundle
+
+add_executable(CocoaExample MACOSX_BUNDLE
+  CocoaExample/main.m
+  CocoaExample/AppDelegate.m
+  CocoaExample/AppDelegate.h
+  CocoaExample/MainMenu.xib
+)
+
+find_library(FOUNDATION_LIBRARY Foundation)
+find_library(APPKIT_LIBRARY AppKit)
+
+target_link_libraries(CocoaExample PRIVATE ${FOUNDATION_LIBRARY} 
${APPKIT_LIBRARY})
+
+set_target_properties(CocoaExample PROPERTIES
+  MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CocoaExample/Info.plist
+  RESOURCE CocoaExample/MainMenu.xib)
+
+# XCTest for Cocoa App Bundle
+
+add_xctest(CocoaExampleTest CocoaExample
+  CocoaExampleTests/CocoaExampleTests.m)
diff --git a/Tests/XCTest/CocoaExample/AppDelegate.h 
b/Tests/XCTest/CocoaExample/AppDelegate.h
new file mode 100644
index 000..69b6e0f
--- /dev/null
+++ b/Tests/XCTest/CocoaExample/AppDelegate.h
@@ -0,0 +1,7 @@
+#import Cocoa/Cocoa.h
+
+@interface AppDelegate : NSObject NSApplicationDelegate
+
+
+@end
+
diff --git a/Tests/XCTest/CocoaExample/AppDelegate.m 
b/Tests/XCTest/CocoaExample/AppDelegate.m
new file mode 100644
index 000..07af62f
--- /dev/null
+++ b/Tests/XCTest/CocoaExample/AppDelegate.m
@@ -0,0 +1,18 @@
+#import AppDelegate.h
+
+@interface AppDelegate ()
+
+@property (assign) IBOutlet NSWindow *window;
+@end
+
+@implementation AppDelegate
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+// Insert code here to initialize your application
+}
+
+- (void)applicationWillTerminate:(NSNotification *)aNotification {
+// Insert code here to tear down your application
+}
+
+@end
diff --git 

[cmake-developers] [PATCH] User may now specify toolset through CMake GUI

2015-02-15 Thread rcdailey . lists
From: Robert Dailey rcdai...@gmail.com

The -T parameter to CMake may now be specified through QtDialog
(cmake-gui) via a new text field in the first-time configure
wizard (below the generator chooser).
---
 Source/QtDialog/CMakeSetupDialog.cxx |  1 +
 Source/QtDialog/FirstConfigure.cxx   | 18 +-
 Source/QtDialog/FirstConfigure.h |  3 +++
 Source/QtDialog/QCMake.cxx   | 12 +++-
 Source/QtDialog/QCMake.h |  5 +
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/Source/QtDialog/CMakeSetupDialog.cxx 
b/Source/QtDialog/CMakeSetupDialog.cxx
index b8077f2..dfe1e7c 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -705,6 +705,7 @@ bool CMakeSetupDialog::setupFirstConfigure()
 {
 dialog.saveToSettings();
 this-CMakeThread-cmakeInstance()-setGenerator(dialog.getGenerator());
+this-CMakeThread-cmakeInstance()-setToolset(dialog.getToolset());
 
 QCMakeCacheModel* m = this-CacheValues-cacheModel();
 
diff --git a/Source/QtDialog/FirstConfigure.cxx 
b/Source/QtDialog/FirstConfigure.cxx
index 6de9f00..d22acd0 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -15,6 +15,12 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p)
   l-addWidget(new QLabel(tr(Specify the generator for this project)));
   this-GeneratorOptions = new QComboBox(this);
   l-addWidget(this-GeneratorOptions);
+
+  // Add the ability to specify toolset (-T parameter)
+  l-addWidget(new QLabel(tr(Optional toolset to use (-T parameter;
+  this-Toolset = new QLineEdit(this);
+  l-addWidget(this-Toolset);
+
   l-addSpacing(6);
 
   this-CompilerSetupOptions[0] = new QRadioButton(tr(Use default native 
compilers), this);
@@ -59,7 +65,12 @@ void StartCompilerSetup::setCurrentGenerator(const QString 
gen)
 
 QString StartCompilerSetup::getGenerator() const
 {
-  return this-GeneratorOptions-currentText();
+   return this-GeneratorOptions-currentText();
+};
+
+QString StartCompilerSetup::getToolset() const
+{
+   return this-Toolset-text();
 };
 
 bool StartCompilerSetup::defaultSetup() const
@@ -335,6 +346,11 @@ QString FirstConfigure::getGenerator() const
   return this-mStartCompilerSetupPage-getGenerator();
 }
 
+QString FirstConfigure::getToolset() const
+{
+  return this-mStartCompilerSetupPage-getToolset();
+}
+
 void FirstConfigure::loadFromSettings()
 {
   QSettings settings;
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index be390b0..1848a9d 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -30,6 +30,7 @@ class StartCompilerSetup : public QWizardPage
 void setGenerators(const QStringList gens);
 void setCurrentGenerator(const QString gen);
 QString getGenerator() const;
+QString getToolset() const;
 
 bool defaultSetup() const;
 bool compilerSetup() const;
@@ -46,6 +47,7 @@ class StartCompilerSetup : public QWizardPage
 
   protected:
 QComboBox* GeneratorOptions;
+QLineEdit* Toolset;
 QRadioButton* CompilerSetupOptions[4];
 };
 
@@ -142,6 +144,7 @@ public:
 
   void setGenerators(const QStringList gens);
   QString getGenerator() const;
+  QString getToolset() const;
 
   bool defaultSetup() const;
   bool compilerSetup() const;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index b833648..b05b06d 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -125,7 +125,6 @@ void QCMake::setBinaryDirectory(const QString _dir)
 }
 }
 
-
 void QCMake::setGenerator(const QString gen)
 {
   if(this-Generator != gen)
@@ -135,6 +134,15 @@ void QCMake::setGenerator(const QString gen)
 }
 }
 
+void QCMake::setToolset(const QString toolset)
+{
+  if(this-Toolset != toolset)
+{
+this-Toolset = toolset;
+emit this-toolsetChanged(this-Toolset);
+}
+}
+
 void QCMake::configure()
 {
 #ifdef Q_OS_WIN
@@ -147,6 +155,8 @@ void QCMake::configure()
   
this-CMakeInstance-SetStartOutputDirectory(this-BinaryDirectory.toLocal8Bit().data());
   this-CMakeInstance-SetGlobalGenerator(
 
this-CMakeInstance-CreateGlobalGenerator(this-Generator.toLocal8Bit().data()));
+  this-CMakeInstance-SetGeneratorToolset(
+ this-Toolset.toLocal8Bit().data());
   this-CMakeInstance-LoadCache();
   this-CMakeInstance-SetSuppressDevWarnings(this-SuppressDevWarnings);
   this-CMakeInstance-SetWarnUninitialized(this-WarnUninitializedMode);
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index d910eb7..e25430d 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -73,6 +73,8 @@ public slots:
   void setBinaryDirectory(const QString dir);
   /// set the desired generator to use
   void setGenerator(const QString generator);
+  /// set the desired generator to use
+  void setToolset(const QString toolset);
   /// do the configure step
   void configure();
   /// generate the files
@@ -130,6 +132,8 @@ signals:
 

Re: [cmake-developers] [PATCH] CPackRPM: Fix cross-building rpms

2015-02-15 Thread Domen Vrankar
 I've finally had some time to read over the Tests section, and it is a
 bit overwhelming.
 I'm going to describe the use cases for my patch and perhaps you can
 give me some guidance on adding an actual test.

 There are three, maybe four use cases:
 1) native rpm (e.g. x86_64)
 2) noarch rpm (a noarch package should contain scripts, artwork, etc,
 but no compiled code)
 3) a non-native, but compatible rpm (e.g. building x86 on a multilib
 x86_64 system)
 4) incompatible cross-compiled package (e.g. building for arm or ppc)

 in each case the way you know it worked is
 a) make package successfully produces an rpm file
 b) running rpm -qip my_rpm_file.my_arch.rpm returns a description of the rpm,
  including the line Architecture: my_arch

Sorry for the late reply.

I've finally had some time to go through the patch:
1) If I understand you correctly BuildArch should never be set except
in noarch case. This would mean that CPACK_RPM_PACKAGE_ARCHITECTURE
value should set --target and if set to noarch should also (if
necessary) set BuildArch as before. Your patch currently silently
ignores all user settings of CPACK_RPM_PACKAGE_ARCHITECTURE except
noarch,
2) Since you are already writing a patch for
CPACK_RPM_PACKAGE_ARCHITECTURE you should also add
CPACK_RPM_component_PACKAGE_ARCHITECTURE so that you can set the
architecture per component.

Regarding the tests:
1) You should add the test setup for noarch and auto defined and auto
detected architecture in
Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in -
just define architecture for headers component (implement 2. from
above for this) and leave the rest of components to auto detection
provided by your patch,
2) Write result verification in
Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake - just extend
the tests at the bottom of this file since pqy query is already used
there.

I am not certain regarding where to put cross-compiled package test...
If rpmbuild is not testing the binaries that will get packed you can
simply set a nonexisting XYZ architecture to only one component - like
with noarch.

Regards,
Domen
-- 

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] KWSys patches

2015-02-15 Thread Domen Vrankar
Hi everyone,

I am having problems with a patch for Glob functionality because Glob
is part of KWSys repository.

I tried to register to http://review.source.kitware.com so that I
would be able to commit patches to KWSys repository but after I put in
my OpenID I got a Not Found error.

How can I contribute this patch?

Attached are KWSys patch and KWSys+CMake patch.

Thanks,
Domen
From 9c113fe546669a064d461004ae7e74be07744e40 Mon Sep 17 00:00:00 2001
From: Domen Vrankar domen.vran...@gmail.com
Date: Sun, 15 Feb 2015 20:42:16 +0100
Subject: [PATCH] handle cyclic recursion when using glob recurse with follow
 symlinks

Prevent cyclic recursion of type a/b/c-a when
glob recurse is used with follow symlinks so
that each directory symbolic link is traversed
only once and skipped on revisit.
---
 Source/kwsys/Directory.cxx | 35 ++
 Source/kwsys/Directory.hxx.in  |  7 +
 Source/kwsys/Glob.cxx  | 32 +++-
 Source/kwsys/Glob.hxx.in   |  2 ++
 .../file/GLOB_RECURSE-symlink-recursion-stderr.txt |  2 ++
 .../file/GLOB_RECURSE-symlink-recursion.cmake  | 10 +++
 Tests/RunCMake/file/RunCMakeTest.cmake |  1 +
 7 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-symlink-recursion-stderr.txt
 create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-symlink-recursion.cmake

diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index 58cea63..5494908 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -18,6 +18,7 @@
 
 #include KWSYS_HEADER(stl/string)
 #include KWSYS_HEADER(stl/vector)
+#include KWSYS_HEADER(stl/stdexcept)
 
 // Work-around CMake dependency scanning limitation.  This must
 // duplicate the above list of headers.
@@ -28,8 +29,11 @@
 # include kwsys_stl.hxx.in
 # include kwsys_stl_string.hxx.in
 # include kwsys_stl_vector.hxx.in
+# include kwsys_stl_stdexcept.hxx.in
 #endif
 
+#include stdlib.h
+
 namespace KWSYS_NAMESPACE
 {
 
@@ -79,6 +83,37 @@ const char* Directory::GetPath() const
 }
 
 //
+kwsys_stl::string Directory::GetCanonicalPath() const
+{
+/* The maximum length of a file name. */
+#if defined(PATH_MAX)
+  #define CANONICAL_PATH_MAX_LEN PATH_MAX
+#elif defined(MAXPATHLEN)
+  #define CANONICAL_PATH_MAX_LEN MAXPATHLEN
+#else
+  #define CANONICAL_PATH_MAX_LEN 16384
+#endif
+
+  char out_path[CANONICAL_PATH_MAX_LEN];
+
+#if defined(_WIN32)  !defined(__CYGWIN__)
+  /* Implementation for Windows.  */
+  DWORD n = GetFullPathNameA(this-Internal-Path.c_str(),
+  CANONICAL_PATH_MAX_LEN], out_path, 0);
+  if( n  0  n = CANONICAL_PATH_MAX_LEN )
+#else
+  /* Implementation for UNIX.  */
+  if( !realpath(this-Internal-Path.c_str(), out_path) )
+#endif
+{
+throw kwsys_stl::runtime_error(Failed to convert path '
+  + this-Internal-Path + ' to canonical form.);
+}
+
+  return out_path;
+}
+
+//
 void Directory::Clear()
 {
   this-Internal-Path.resize(0);
diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in
index 1bcf90e..453b578 100644
--- a/Source/kwsys/Directory.hxx.in
+++ b/Source/kwsys/Directory.hxx.in
@@ -68,6 +68,13 @@ public:
   const char* GetPath() const;
 
   /**
+   * Return path to Open'ed directory without symbolic links, dot or
+   * dot-dot elements. runtime_error is thrown if canonical path
+   * could not be created.
+   */
+   kwsys_stl::string GetCanonicalPath() const;
+
+  /**
* Clear the internal structure. Used internally at beginning of Load(...)
* to clear the cache.
*/
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 5a96aed..22bab9f 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -30,11 +30,14 @@
 # include SystemTools.hxx.in
 # include kwsys_stl.hxx.in
 # include kwsys_stl_string.hxx.in
+# include kwsys_stl_vector.hxx.in
 #endif
 
 #include ctype.h
 #include stdio.h
 #include string.h
+#include stdlib.h
+#include iostream
 namespace KWSYS_NAMESPACE
 {
 #if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
@@ -265,8 +268,35 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
   if (isSymLink)
 {
 ++this-FollowedSymlinkCount;
+kwsys_stl::string canonicalPath(d.GetCanonicalPath());
+
+if(VisitedSymlinks.find(canonicalPath) == VisitedSymlinks.end())
+  {
+  // structure for handling symbolic link path even if an exception
+  // is thrown
+  struct ScopedSymlinkPath
+  {
+ScopedSymlinkPath(
+  kwsys_stl::setkwsys_stl::string visitedSymlinks,
+  const std::string canonicalPath)
+  : RefVisitedSymlinks(visitedSymlinks)
+  , RefCanonicalPath(canonicalPath)
+  

[cmake-developers] [PATCH 1/6] Add handling for XCTest bundles

2015-02-15 Thread Gregor Jasny
An XCTest bundle is a CFBundle with a special product-type and bundle
extension. It gets loaded directly into the AppBundle
it should test. For more information about XCTest visit the Mac
Developer library at:

  
http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/

To build a XCTest bundle, you need to create a CFBundle and set the
XCTEST property.

add_library(CocoaExampleTest MODULE ...)
set_target_properties(CocoaExampleTest PROPERTIES
  BUNDLE TRUE
  XCTEST TRUE)

Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Help/manual/cmake-properties.7.rst |  1 +
 Help/prop_tgt/XCTEST.rst   | 10 ++
 Source/cmGlobalXCodeGenerator.cxx  | 12 ++--
 Source/cmTarget.cxx| 16 +++-
 Source/cmTarget.h  |  3 +++
 5 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 Help/prop_tgt/XCTEST.rst

diff --git a/Help/manual/cmake-properties.7.rst 
b/Help/manual/cmake-properties.7.rst
index 25f989f..d795c6e 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -243,6 +243,7 @@ Properties on Targets
/prop_tgt/VS_WINRT_REFERENCES
/prop_tgt/WIN32_EXECUTABLE
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
+   /prop_tgt/XCTEST
 
 Properties on Tests
 ===
diff --git a/Help/prop_tgt/XCTEST.rst b/Help/prop_tgt/XCTEST.rst
new file mode 100644
index 000..3a3adf6
--- /dev/null
+++ b/Help/prop_tgt/XCTEST.rst
@@ -0,0 +1,10 @@
+XCTEST
+--
+
+This target is a XCTest CFBundle on the Mac.
+
+If a module library target has this property set to true it will be
+built as a CFBundle when built on the mac.  It will have the directory
+structure required for a CFBundle.
+
+This property depends on :prop_tgt:`BUNDLE` to be effective.
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index aea134e..784bc24 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -804,6 +804,10 @@ GetSourcecodeValueFromFileExtension(const std::string 
_ext,
 {
 sourcecode = compiled.mach-o.objfile;
 }
+  else if(ext == xctest)
+{
+sourcecode = wrapper.cfbundle;
+}
   else if(ext == xib)
 {
 keepLastKnownFileType = true;
@@ -2598,7 +2602,9 @@ const char* 
cmGlobalXCodeGenerator::GetTargetFileType(cmTarget cmtarget)
 case cmTarget::STATIC_LIBRARY:
   return archive.ar;
 case cmTarget::MODULE_LIBRARY:
-  if (cmtarget.IsCFBundleOnApple())
+  if (cmtarget.IsXCTestOnApple())
+return wrapper.cfbundle;
+  else if (cmtarget.IsCFBundleOnApple())
 return wrapper.plug-in;
   else
 return ((this-XcodeVersion = 22)?
@@ -2622,7 +2628,9 @@ const char* 
cmGlobalXCodeGenerator::GetTargetProductType(cmTarget cmtarget)
 case cmTarget::STATIC_LIBRARY:
   return com.apple.product-type.library.static;
 case cmTarget::MODULE_LIBRARY:
-  if (cmtarget.IsCFBundleOnApple())
+  if (cmtarget.IsXCTestOnApple())
+return com.apple.product-type.bundle.unit-test;
+  else if (cmtarget.IsCFBundleOnApple())
 return com.apple.product-type.bundle;
   else
 return ((this-XcodeVersion = 22)?
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 526a923..6ce165a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -615,6 +615,13 @@ bool cmTarget::IsCFBundleOnApple() const
 }
 
 //
+bool cmTarget::IsXCTestOnApple() const
+{
+  return (this-IsCFBundleOnApple() 
+  this-GetPropertyAsBool(XCTEST));
+}
+
+//
 bool cmTarget::IsBundleOnApple() const
 {
   return this-IsFrameworkOnApple() || this-IsAppBundleOnApple() ||
@@ -6781,7 +6788,14 @@ std::string cmTarget::GetCFBundleDirectory(const 
std::string config,
   const char *ext = this-GetProperty(BUNDLE_EXTENSION);
   if (!ext)
 {
-ext = bundle;
+if (this-IsXCTestOnApple())
+  {
+  ext = xctest;
+  }
+else
+  {
+  ext = bundle;
+  }
 }
   fpath += ext;
   fpath += /Contents;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index ddd9859..b58e0a0 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -526,6 +526,9 @@ public:
   /** Return whether this target is a CFBundle (plugin) on Apple.  */
   bool IsCFBundleOnApple() const;
 
+  /** Return whether this target is a XCTest on Apple.  */
+  bool IsXCTestOnApple() const;
+
   /** Return whether this target is an executable Bundle on Apple.  */
   bool IsAppBundleOnApple() const;
 
-- 
2.3.0

-- 

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 

[cmake-developers] [PATCH 4/6] Add XCTest helper utilities

2015-02-15 Thread Gregor Jasny
Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Help/manual/cmake-modules.7.rst |   1 +
 Help/module/XCTestUtilities.rst |   1 +
 Modules/XCTestUtilities.cmake   | 120 
 3 files changed, 122 insertions(+)
 create mode 100644 Help/module/XCTestUtilities.rst
 create mode 100644 Modules/XCTestUtilities.cmake

diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index 76058f9..ea0d1c1 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -240,5 +240,6 @@ All Modules
/module/UseSWIG
/module/UsewxWidgets
/module/Use_wxWindows
+   /module/XCTestUtilities
/module/WriteBasicConfigVersionFile
/module/WriteCompilerDetectionHeader
diff --git a/Help/module/XCTestUtilities.rst b/Help/module/XCTestUtilities.rst
new file mode 100644
index 000..c96f515
--- /dev/null
+++ b/Help/module/XCTestUtilities.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/XCTestUtilities.cmake
diff --git a/Modules/XCTestUtilities.cmake b/Modules/XCTestUtilities.cmake
new file mode 100644
index 000..33124fe
--- /dev/null
+++ b/Modules/XCTestUtilities.cmake
@@ -0,0 +1,120 @@
+#.rst:
+# XCTestUtilities
+# ---
+#
+# Functions to help creating and executing XCTest bundles.
+#
+# An XCTest bundle is a CFBundle with a special product-type
+# and bundle extension. For more information about XCTest visit
+# the Mac Developer library at:
+# 
http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/
+#
+# The following functions are provided by this module:
+#
+# ::
+#
+#add_xctest
+#add_test_xctest
+#
+# ::
+#
+#   add_xctest(target testee)
+#
+# Create a XCTest bundle named target which will test the target
+# testee. Supported target types for testee are Frameworks and
+# App Bundles.
+#
+# ::
+#
+#   add_test_xctest(target)
+#
+# Add an XCTest bundle to the project to be run by :manual:`ctest(1)`.
+
+#=
+# Copyright 2015 Gregor Jasny
+#
+# 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.)
+
+function(add_xctest target testee)
+
+  if(NOT CMAKE_OSX_SYSROOT)
+message(STATUS Adding XCTest bundles requires CMAKE_OSX_SYSROOT to be 
set.)
+  endif()
+
+  # check that testee is a valid target type
+  get_target_property(TESTEE_TYPE ${testee} TYPE)
+  get_target_property(TESTEE_FRAMEWORK ${testee} FRAMEWORK)
+  get_target_property(TESTEE_MACOSX_BUNDLE ${testee} MACOSX_BUNDLE)
+
+  if(TESTEE_TYPE STREQUAL SHARED_LIBRARY AND TESTEE_FRAMEWORK)
+# found a framework
+  elseif(TESTEE_TYPE STREQUAL EXECUTABLE AND TESTEE_MACOSX_BUNDLE)
+# found an app bundle
+  else()
+   message(FATAL_ERROR Testee ${testee} is of unsupported type: 
${TESTEE_TYPE})
+  endif()
+
+  add_library(${target} MODULE ${ARGN})
+
+  set_target_properties(${target} PROPERTIES
+BUNDLE TRUE
+XCTEST TRUE)
+
+  find_library(FOUNDATION_LIBRARY Foundation)
+  if(NOT FOUNDATION_LIBRARY)
+message(STATUS Could not find Foundation Framework.)
+  endif()
+
+  find_library(XCTEST_LIBRARY XCTest)
+  if(NOT XCTEST_LIBRARY)
+message(STATUS Could not find XCTest Framework.)
+  endif()
+
+  target_link_libraries(${target} PRIVATE ${FOUNDATION_LIBRARY} 
${XCTEST_LIBRARY})
+
+  if(TESTEE_TYPE STREQUAL SHARED_LIBRARY AND TESTEE_FRAMEWORK)
+target_link_libraries(${target} PRIVATE ${testee})
+
+# set rpath to find testee
+target_link_libraries(${target} PRIVATE 
${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}$TARGET_LINKER_FILE_DIR:${testee})
+  elseif(TESTEE_TYPE STREQUAL EXECUTABLE AND TESTEE_MACOSX_BUNDLE)
+add_dependencies(${target} ${testee})
+if(XCODE)
+  set_target_properties(${target} PROPERTIES
+XCODE_ATTRIBUTE_BUNDLE_LOADER $(TEST_HOST)
+XCODE_ATTRIBUTE_TEST_HOST $TARGET_FILE:${testee})
+else(XCODE)
+  target_link_libraries(${target} PRIVATE -bundle_loader 
$TARGET_FILE:${testee})
+endif(XCODE)
+  endif()
+endfunction(add_xctest)
+
+function(add_test_xctest target)
+  get_target_property(TARGET_TYPE ${target} TYPE)
+  get_target_property(TARGET_XCTEST ${target} XCTEST)
+
+  if(NOT TARGET_TYPE STREQUAL MODULE_LIBRARY OR NOT TARGET_XCTEST)
+   message(FATAL_ERROR Test ${target} is not a XCTest)
+  endif()
+
+  execute_process(
+COMMAND xcrun --find xctest
+OUTPUT_VARIABLE XCTEST_EXECUTABLE
+OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  if(NOT XCTEST_EXECUTABLE)
+message(STATUS Unable to finc xctest binary.)
+  endif()
+
+ 

[cmake-developers] [PATCH 6/6] Add XCTest example to test Cocoa App Bundles

2015-02-15 Thread Gregor Jasny
Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Tests/XCTest/CMakeLists.txt|  25 +
 Tests/XCTest/CocoaExample/AppDelegate.h|   7 +
 Tests/XCTest/CocoaExample/AppDelegate.m|  18 +
 Tests/XCTest/CocoaExample/Info.plist   |  30 +
 Tests/XCTest/CocoaExample/MainMenu.xib | 680 +
 Tests/XCTest/CocoaExample/main.m   |   5 +
 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m |  13 +
 7 files changed, 778 insertions(+)
 create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.h
 create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.m
 create mode 100644 Tests/XCTest/CocoaExample/Info.plist
 create mode 100644 Tests/XCTest/CocoaExample/MainMenu.xib
 create mode 100644 Tests/XCTest/CocoaExample/main.m
 create mode 100644 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m

diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt
index e31e9ab..f42020d 100644
--- a/Tests/XCTest/CMakeLists.txt
+++ b/Tests/XCTest/CMakeLists.txt
@@ -36,3 +36,28 @@ set_target_properties(FrameworkExampleTests PROPERTIES
   )
 
 add_test_xctest(FrameworkExampleTests)
+
+# Cocoa App Bundle
+
+add_executable(CocoaExample MACOSX_BUNDLE
+  CocoaExample/main.m
+  CocoaExample/AppDelegate.m
+  CocoaExample/AppDelegate.h
+  CocoaExample/MainMenu.xib
+)
+
+find_library(FOUNDATION_LIBRARY Foundation)
+find_library(APPKIT_LIBRARY AppKit)
+
+target_link_libraries(CocoaExample PRIVATE ${FOUNDATION_LIBRARY} 
${APPKIT_LIBRARY})
+
+set_target_properties(CocoaExample PROPERTIES
+  MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/CocoaExample/Info.plist
+  RESOURCE CocoaExample/MainMenu.xib)
+
+# XCTest for Cocoa App Bundle
+
+add_xctest(CocoaExampleTests CocoaExample
+  CocoaExampleTests/CocoaExampleTests.m)
+
+add_test_xctest(CocoaExampleTests)
diff --git a/Tests/XCTest/CocoaExample/AppDelegate.h 
b/Tests/XCTest/CocoaExample/AppDelegate.h
new file mode 100644
index 000..69b6e0f
--- /dev/null
+++ b/Tests/XCTest/CocoaExample/AppDelegate.h
@@ -0,0 +1,7 @@
+#import Cocoa/Cocoa.h
+
+@interface AppDelegate : NSObject NSApplicationDelegate
+
+
+@end
+
diff --git a/Tests/XCTest/CocoaExample/AppDelegate.m 
b/Tests/XCTest/CocoaExample/AppDelegate.m
new file mode 100644
index 000..07af62f
--- /dev/null
+++ b/Tests/XCTest/CocoaExample/AppDelegate.m
@@ -0,0 +1,18 @@
+#import AppDelegate.h
+
+@interface AppDelegate ()
+
+@property (assign) IBOutlet NSWindow *window;
+@end
+
+@implementation AppDelegate
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+// Insert code here to initialize your application
+}
+
+- (void)applicationWillTerminate:(NSNotification *)aNotification {
+// Insert code here to tear down your application
+}
+
+@end
diff --git a/Tests/XCTest/CocoaExample/Info.plist 
b/Tests/XCTest/CocoaExample/Info.plist
new file mode 100644
index 000..5267c63
--- /dev/null
+++ b/Tests/XCTest/CocoaExample/Info.plist
@@ -0,0 +1,30 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN 
http://www.apple.com/DTDs/PropertyList-1.0.dtd;
+plist version=1.0
+dict
+   keyCFBundleDevelopmentRegion/key
+   stringen/string
+   keyCFBundleExecutable/key
+   stringCocoaExample/string
+   keyCFBundleIconFile/key
+   string/string
+   keyCFBundleIdentifier/key
+   stringorg.cmake.CocoaExample/string
+   keyCFBundleInfoDictionaryVersion/key
+   string6.0/string
+   keyCFBundleName/key
+   stringCocoaExample/string
+   keyCFBundlePackageType/key
+   stringAPPL/string
+   keyCFBundleShortVersionString/key
+   string1.0/string
+   keyCFBundleSignature/key
+   string/string
+   keyCFBundleVersion/key
+   string1/string
+   keyNSMainNibFile/key
+   stringMainMenu/string
+   keyNSPrincipalClass/key
+   stringNSApplication/string
+/dict
+/plist
diff --git a/Tests/XCTest/CocoaExample/MainMenu.xib 
b/Tests/XCTest/CocoaExample/MainMenu.xib
new file mode 100644
index 000..9498a0a
--- /dev/null
+++ b/Tests/XCTest/CocoaExample/MainMenu.xib
@@ -0,0 +1,680 @@
+?xml version=1.0 encoding=UTF-8 standalone=no?
+document type=com.apple.InterfaceBuilder3.Cocoa.XIB version=3.0 
toolsVersion=6233 systemVersion=14A329f targetRuntime=MacOSX.Cocoa 
propertyAccessControl=none useAutolayout=YES 
customObjectInstantitationMethod=direct
+dependencies
+plugIn identifier=com.apple.InterfaceBuilder.CocoaPlugin 
version=6233/
+/dependencies
+objects
+customObject id=-2 userLabel=File's Owner 
customClass=NSApplication
+connections
+outlet property=delegate destination=Voe-Tx-rLC 
id=GzC-gU-4Uq/
+/connections
+/customObject
+customObject id=-1 userLabel=First Responder 
customClass=FirstResponder/
+customObject id=-3 userLabel=Application customClass=NSObject/
+customObject id=Voe-Tx-rLC 

[cmake-developers] [PATCH 0/6] XCTest Bundles v4

2015-02-15 Thread Gregor Jasny
Hello,

this series contains the latest XCTest patches.

Changes since v3:
  Added Cocoa App Bundle Test example
  Added documentation to XCTestUtilities.cmake
  Some minor cleanups

This patch set is also available on github:
  URL: https://github.com/gjasny/CMake.git 
  Branch: feature/xctest-for-frameworks

Thanks,
Gregor

Gregor Jasny (6):
  Add handling for XCTest bundles
  Shorten CFBundleExecutable to file name only
  Also add Platform specific Frameworks to Darwin Framework search path
  Add XCTest helper utilities
  Add XCTest example to test Frameworks
  Add XCTest example to test Cocoa App Bundles

 Help/manual/cmake-modules.7.rst|   1 +
 Help/manual/cmake-properties.7.rst |   1 +
 Help/module/XCTestUtilities.rst|   1 +
 Help/prop_tgt/XCTEST.rst   |  10 +
 Modules/Platform/Darwin.cmake  |   5 +
 Modules/XCTestUtilities.cmake  | 120 
 Source/cmGlobalXCodeGenerator.cxx  |  12 +-
 Source/cmOSXBundleGenerator.cxx|   3 +-
 Source/cmTarget.cxx|  16 +-
 Source/cmTarget.h  |   3 +
 Tests/XCTest/CMakeLists.txt|  63 ++
 Tests/XCTest/CocoaExample/AppDelegate.h|   7 +
 Tests/XCTest/CocoaExample/AppDelegate.m|  18 +
 Tests/XCTest/CocoaExample/Info.plist   |  30 +
 Tests/XCTest/CocoaExample/MainMenu.xib | 680 +
 Tests/XCTest/CocoaExample/main.m   |   5 +
 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m |  13 +
 Tests/XCTest/FrameworkExample/FrameworkExample.c   |   6 +
 Tests/XCTest/FrameworkExample/FrameworkExample.h   |   1 +
 Tests/XCTest/FrameworkExample/Info.plist   |  28 +
 .../FrameworkExampleTests/FrameworkExampleTests.m  |  16 +
 Tests/XCTest/FrameworkExampleTests/Info.plist  |  24 +
 Tests/XcodePlatformFrameworks/CMakeLists.txt   |  38 ++
 23 files changed, 1097 insertions(+), 4 deletions(-)
 create mode 100644 Help/module/XCTestUtilities.rst
 create mode 100644 Help/prop_tgt/XCTEST.rst
 create mode 100644 Modules/XCTestUtilities.cmake
 create mode 100644 Tests/XCTest/CMakeLists.txt
 create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.h
 create mode 100644 Tests/XCTest/CocoaExample/AppDelegate.m
 create mode 100644 Tests/XCTest/CocoaExample/Info.plist
 create mode 100644 Tests/XCTest/CocoaExample/MainMenu.xib
 create mode 100644 Tests/XCTest/CocoaExample/main.m
 create mode 100644 Tests/XCTest/CocoaExampleTests/CocoaExampleTests.m
 create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.c
 create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.h
 create mode 100644 Tests/XCTest/FrameworkExample/Info.plist
 create mode 100644 Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m
 create mode 100644 Tests/XCTest/FrameworkExampleTests/Info.plist
 create mode 100644 Tests/XcodePlatformFrameworks/CMakeLists.txt

-- 
2.3.0

-- 

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] [PATCH 2/6] Shorten CFBundleExecutable to file name only

2015-02-15 Thread Gregor Jasny
Shorten the CFBundleExecutable in the PList file of Bundles to
the file name only as it is done for Frameworks, too.

Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Source/cmOSXBundleGenerator.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 55e20ab..a8eef82 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -181,8 +181,9 @@ void cmOSXBundleGenerator::CreateCFBundle(const 
std::string targetName,
   std::string plist = root + / +
 this-GT-Target-GetCFBundleDirectory(this-ConfigName, true);
   plist += /Info.plist;
+  std::string name = cmSystemTools::GetFilenameName(targetName);
   this-LocalGenerator-GenerateAppleInfoPList(this-GT-Target,
-   targetName,
+   name,
plist.c_str());
   this-Makefile-AddCMakeOutputFile(plist);
 }
-- 
2.3.0

-- 

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] [PATCH 5/6] Add XCTest example to test Frameworks

2015-02-15 Thread Gregor Jasny
Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Tests/XCTest/CMakeLists.txt| 38 ++
 Tests/XCTest/FrameworkExample/FrameworkExample.c   |  6 
 Tests/XCTest/FrameworkExample/FrameworkExample.h   |  1 +
 Tests/XCTest/FrameworkExample/Info.plist   | 28 
 .../FrameworkExampleTests/FrameworkExampleTests.m  | 16 +
 Tests/XCTest/FrameworkExampleTests/Info.plist  | 24 ++
 6 files changed, 113 insertions(+)
 create mode 100644 Tests/XCTest/CMakeLists.txt
 create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.c
 create mode 100644 Tests/XCTest/FrameworkExample/FrameworkExample.h
 create mode 100644 Tests/XCTest/FrameworkExample/Info.plist
 create mode 100644 Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m
 create mode 100644 Tests/XCTest/FrameworkExampleTests/Info.plist

diff --git a/Tests/XCTest/CMakeLists.txt b/Tests/XCTest/CMakeLists.txt
new file mode 100644
index 000..e31e9ab
--- /dev/null
+++ b/Tests/XCTest/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.1)
+
+set(CMAKE_OSX_SYSROOT macosx)
+
+project(XCTestExamples)
+
+include(XCTestUtilities)
+
+enable_testing()
+
+# Framework
+
+add_library(FrameworkExample SHARED
+  FrameworkExample/FrameworkExample.c
+  FrameworkExample/FrameworkExample.h
+  FrameworkExample/Info.plist)
+
+target_include_directories(FrameworkExample PUBLIC .)
+
+set_target_properties(FrameworkExample PROPERTIES
+  FRAMEWORK TRUE
+  VERSION 1.0.0
+  SOVERSION 1.0.0
+  FRAMEWORK_VERSION A
+  MACOSX_FRAMEWORK_INFO_PLIST 
${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExample/Info.plist
+  PUBLIC_HEADER FrameworkExample/FrameworkExample.h)
+
+# XCTest for Framework
+
+add_xctest(FrameworkExampleTests FrameworkExample
+  FrameworkExampleTests/FrameworkExampleTests.m
+  FrameworkExampleTests/Info.plist)
+ 
+set_target_properties(FrameworkExampleTests PROPERTIES
+  MACOSX_BUNDLE_INFO_PLIST 
${CMAKE_CURRENT_SOURCE_DIR}/FrameworkExampleTests/Info.plist
+  )
+
+add_test_xctest(FrameworkExampleTests)
diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.c 
b/Tests/XCTest/FrameworkExample/FrameworkExample.c
new file mode 100644
index 000..2da78da
--- /dev/null
+++ b/Tests/XCTest/FrameworkExample/FrameworkExample.c
@@ -0,0 +1,6 @@
+#include FrameworkExample.h
+
+int FourtyTwo()
+{
+return 42;
+}
diff --git a/Tests/XCTest/FrameworkExample/FrameworkExample.h 
b/Tests/XCTest/FrameworkExample/FrameworkExample.h
new file mode 100644
index 000..2e0b499
--- /dev/null
+++ b/Tests/XCTest/FrameworkExample/FrameworkExample.h
@@ -0,0 +1 @@
+int FourtyTwo();
diff --git a/Tests/XCTest/FrameworkExample/Info.plist 
b/Tests/XCTest/FrameworkExample/Info.plist
new file mode 100644
index 000..a22acea
--- /dev/null
+++ b/Tests/XCTest/FrameworkExample/Info.plist
@@ -0,0 +1,28 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN 
http://www.apple.com/DTDs/PropertyList-1.0.dtd;
+plist version=1.0
+dict
+   keyCFBundleDevelopmentRegion/key
+   stringen/string
+   keyCFBundleExecutable/key
+   stringFrameworkExample/string
+   keyCFBundleIdentifier/key
+   stringorg.cmake.FrameworkExample/string
+   keyCFBundleInfoDictionaryVersion/key
+   string6.0/string
+   keyCFBundleName/key
+   stringFrameworkExample/string
+   keyCFBundlePackageType/key
+   stringFMWK/string
+   keyCFBundleShortVersionString/key
+   string1.0/string
+   keyCFBundleSignature/key
+   string/string
+   keyCFBundleVersion/key
+   string/string
+   keyNSHumanReadableCopyright/key
+   string/string
+   keyNSPrincipalClass/key
+   string/string
+/dict
+/plist
diff --git a/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m 
b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m
new file mode 100644
index 000..7cba23e
--- /dev/null
+++ b/Tests/XCTest/FrameworkExampleTests/FrameworkExampleTests.m
@@ -0,0 +1,16 @@
+#import XCTest/XCTest.h
+
+#import FrameworkExample/FrameworkExample.h
+
+@interface FrameworkExampleTests : XCTestCase
+
+@end
+
+@implementation FrameworkExampleTests
+
+- (void)testFourtyTwo {
+// This is an example of a functional test case.
+XCTAssertEqual(42, FourtyTwo());
+}
+
+@end
diff --git a/Tests/XCTest/FrameworkExampleTests/Info.plist 
b/Tests/XCTest/FrameworkExampleTests/Info.plist
new file mode 100644
index 000..293921b
--- /dev/null
+++ b/Tests/XCTest/FrameworkExampleTests/Info.plist
@@ -0,0 +1,24 @@
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN 
http://www.apple.com/DTDs/PropertyList-1.0.dtd;
+plist version=1.0
+dict
+   keyCFBundleDevelopmentRegion/key
+   stringen/string
+   keyCFBundleExecutable/key
+   stringFrameworkExampleTests/string
+   keyCFBundleIdentifier/key
+   stringorg.cmake.FrameworkExampleTests/string
+   keyCFBundleInfoDictionaryVersion/key
+   

[cmake-developers] [PATCH 3/6] Also add Platform specific Frameworks to Darwin Framework search path

2015-02-15 Thread Gregor Jasny
Otherwise find_library is unable to lookup the XCTest framework which
is not located in the SDK serach path:

In the 10.10 SDK the SDK frameworks are located here:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
  Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/

whereas the Platform SDKs are located here:
  Developer/Library/Frameworks

Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Modules/Platform/Darwin.cmake|  5 
 Tests/XcodePlatformFrameworks/CMakeLists.txt | 38 
 2 files changed, 43 insertions(+)
 create mode 100644 Tests/XcodePlatformFrameworks/CMakeLists.txt

diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index e5c5f36..e3d705d 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -166,6 +166,11 @@ if(_CMAKE_OSX_SYSROOT_PATH)
 ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks
 ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks
 )
+  if(IS_DIRECTORY ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks)
+list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
+  ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks
+  )
+  endif()
 endif()
 list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
   /Library/Frameworks
diff --git a/Tests/XcodePlatformFrameworks/CMakeLists.txt 
b/Tests/XcodePlatformFrameworks/CMakeLists.txt
new file mode 100644
index 000..09e374a
--- /dev/null
+++ b/Tests/XcodePlatformFrameworks/CMakeLists.txt
@@ -0,0 +1,38 @@
+cmake_minimum_required(VERSION 3.1)
+
+set(CMAKE_OSX_SYSROOT macosx)
+
+project(XcodePlatformFrameworks)
+
+# detect Xcode version
+
+execute_process(
+  COMMAND xcodebuild -version
+  OUTPUT_VARIABLE _stdout
+  OUTPUT_STRIP_TRAILING_WHITESPACE
+  ERROR_VARIABLE _stderr
+  RESULT_VARIABLE _failed
+  )
+
+if(_failed)
+  message(FATAL_ERROR Error while running xcodebuild: ${_stderr})
+endif()
+
+set(XCODE_VERSION_REGEX .*Xcode +([0-9.]+).*)
+
+if(NOT _stdout MATCHES ${XCODE_VERSION_REGEX})
+  message(FATAL_ERROR Cannot find Xcode version in ${_stdout})
+endif()
+
+string(REGEX REPLACE ${XCODE_VERSION_REGEX} \\1 XCODE_VERSION ${_stdout})
+
+message(STATUS Xcode version: ${XCODE_VERSION})
+
+if(NOT XCODE_VERSION VERSION_LESS 5.0)
+  find_library(XCTEST_LIBRARY XCTest)
+  if(XCTEST_LIBRARY)
+message(STATUS XCTest found: ${XCTEST_LIBRARY})
+  else()
+message(FATAL_ERROR XCTest Framework not found.)
+  endif()
+endif()
-- 
2.3.0

-- 

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