[CMake] Linking error with VS2005

2010-05-21 Thread Daanen Vincent
Dear Cmake users,

I'm facing to a problem I can't resolve. 
I'm developping on a windows XP SP3 box with Visual Studio 2005.

I have a project using itk which compile fine.
For  some reason, I try to use cmake to generate the same project and I
got linker error (conflict between msvcrtd.lib and libcmtd.lib)

- I check that the librairies are declared in the same order in both project
and it's ok
- Try to ignore either msvcrtd.lib or libcmtd.lib but I does not work :
other linker errors appear.

I could not find what is specifically added by cmake so that the
cmake-generated project fails to build the binray whereas the
manually-generated project file succeeds...

Is there someone who could help me ?

Thanks

 Vince

___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking error with VS2005

2010-05-21 Thread John Drescher
On Fri, May 21, 2010 at 8:01 AM, Daanen Vincent daa...@koelis.com wrote:
 Dear Cmake users,

 I'm facing to a problem I can't resolve.
 I'm developping on a windows XP SP3 box with Visual Studio 2005.

 I have a project using itk which compile fine.
 For  some reason, I try to use cmake to generate the same project and I
 got linker error (conflict between msvcrtd.lib and libcmtd.lib)

 - I check that the librairies are declared in the same order in both project
 and it's ok
 - Try to ignore either msvcrtd.lib or libcmtd.lib but I does not work :
 other linker errors appear.

 I could not find what is specifically added by cmake so that the
 cmake-generated project fails to build the binray whereas the
 manually-generated project file succeeds...

 Is there someone who could help me ?


Can you post the exact error. Are all libraries in your project
(including itk) compiled by the same compiler version?

John
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Using objects in different targets

2010-05-21 Thread Christoph Rüdiger

Am 20.05.2010 um 13:33 schrieb Michael Hertling:


On 05/20/2010 01:04 PM, Christoph Rüdiger wrote:

[...]
I've a directory src containing the complete source code of the  
program and
another directory called test containing the source code for the  
unit tests.
In the top level directory is a CMakeLists.txt that points to the  
subdirectories containing each an own CMakeLists.txt for building  
the program or the unit tests.


Now I want to use the already build object files from the src  
directory one time for linking the program and one time for linking  
to the unit tests.


My current way is building a static library in the src directory  
and link the unit tests against this library. But the sources would  
be compiled twice: One time for the static library and one time for  
the program itself.


Link the program against the static library, too, while removing
the latter's source files from the program's ADD_EXECUTABLE().


Then I need either one big library which I can link against each unit  
test, resulting in a unit test of the size of the whole program plus  
the size of the unit test, or I create smaller static libraries but  
need to know each library in both CMakeLists.txt explicitly.
For later on there is a planning to build plugins which needs to be a  
library I must explicit know in the unit test project, too. If  
anything changes in the src tree, I have to modify the CMakeLists.txt  
of the test tree, too.


I'm wondering if there is no solution for making files one time known  
to the cmake process (the cpp files in my case) and use derived files  
(the objects) in other process parts. I'm looking aroung for a  
variable containing all objects, pass this to the linker and let the  
linker figure out, which objects are needed in the current unit test.  
The linking time increases, but at nightly test runs, this doesn't  
matter.


Is it possible to have all projects together in the top level  
directory CMakeLists.txt and include a separate file with the cpp- 
Variables? (Separate the long list of source files from the project  
admin commands)


Regards,
Christoph Ruediger
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking error with VS2005

2010-05-21 Thread John Drescher
On Fri, May 21, 2010 at 10:17 AM, Daanen Vincent daa...@koelis.com wrote:
 Hello,

 Can you post the exact error.
 I would say that these errors are the well-known linker errors about libcmt
 and msvcrt
 msvcrtd.lib(ti_inst.obj) : error LNK2005: private: __thiscall
 type_info::type_info(class type_info const ) (??0type_info@@a...@abv0@@Z)
 déjà défini(e) dans libcmtd.lib(typinfo.obj)
 msvcrtd.lib(ti_inst.obj) : error LNK2005: private: class type_info 
 __thiscall type_info::operator=(class type_info const )
 (??4type_info@@aaea...@abv0@@Z) déjà défini(e) dans libcmtd.lib(typinfo.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _sprintf déjà défini(e) dans
 libcmtd.lib(sprintf.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _tolower déjà défini(e) dans
 libcmtd.lib(tolower.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _printf déjà défini(e) dans
 libcmtd.lib(printf.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _malloc déjà défini(e) dans
 libcmtd.lib(dbgheap.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _realloc déjà défini(e) dans
 libcmtd.lib(dbgheap.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _free déjà défini(e) dans
 libcmtd.lib(dbgheap.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _fprintf déjà défini(e) dans
 libcmtd.lib(fprintf.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _fclose déjà défini(e) dans
 libcmtd.lib(fclose.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _floor déjà défini(e) dans
 libcmtd.lib(floor_pentium4.obj)
 msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _fopen déjà défini(e) dans
 libcmtd.lib(fopen.obj)

 Are all libraries in your project (including itk) compiled by the same
 compiler version?
 Yes, all my libs and application are built with VS2005 compiler

 V


 -Message d'origine-
 De : John Drescher [mailto:dresche...@gmail.com]
 Envoyé : vendredi 21 mai 2010 14:29
 À : Daanen Vincent
 Cc : cmake@cmake.org
 Objet : Re: [CMake] Linking error with VS2005

 On Fri, May 21, 2010 at 8:01 AM, Daanen Vincent
 daa...@koelis.com wrote:
  Dear Cmake users,
 
  I'm facing to a problem I can't resolve.
  I'm developping on a windows XP SP3 box with Visual Studio 2005.
 
  I have a project using itk which compile fine.
  For  some reason, I try to use cmake to generate the same
 project and I
  got linker error (conflict between msvcrtd.lib and libcmtd.lib)
 
  - I check that the librairies are declared in the same
 order in both project
  and it's ok
  - Try to ignore either msvcrtd.lib or libcmtd.lib but I
 does not work :
  other linker errors appear.
 
  I could not find what is specifically added by cmake so that the
  cmake-generated project fails to build the binray whereas the
  manually-generated project file succeeds...
 
  Is there someone who could help me ?
 

 Can you post the exact error. Are all libraries in your project
 (including itk) compiled by the same compiler version?

 John





-- 
John M. Drescher
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking error with VS2005

2010-05-21 Thread Chuck Atkins
Does the problem happen in both Debug and Release builds?

Visual C++ has a well known problem of mixing debug and release libraries
together.  My suspicion is that you have some dependant libraries that are
only built in Debug or only built in Release.  With Visual C++ it is
important that all libraries and dependencies as well as the project code
it's self be built in the same Build Configuration (Debug or Release).
Mixing the two will often give rise to problems such as these.

Chuck Atkins


-- Mathematicians are tools for turning coffee grounds into formulas.,
Paul Erdos


On Fri, May 21, 2010 at 8:01 AM, Daanen Vincent daa...@koelis.com wrote:

 Dear Cmake users,

 I'm facing to a problem I can't resolve.
 I'm developping on a windows XP SP3 box with Visual Studio 2005.

 I have a project using itk which compile fine.
 For  some reason, I try to use cmake to generate the same project and I
 got linker error (conflict between msvcrtd.lib and libcmtd.lib)

 - I check that the librairies are declared in the same order in both
 project
 and it's ok
 - Try to ignore either msvcrtd.lib or libcmtd.lib but I does not work :
 other linker errors appear.

 I could not find what is specifically added by cmake so that the
 cmake-generated project fails to build the binray whereas the
 manually-generated project file succeeds...

 Is there someone who could help me ?

 Thanks

  Vince

 ___
 Powered by www.kitware.com

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

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

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake

___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] Need cmake help for MacOsX

2010-05-21 Thread Jérôme VERNET

Hi,

I'm trying to update an existing cmake project to be used on MacOsX. After a 
lot of thinking, I can now build, using the right framworks/library/using the 
good SDK/on the right ARCHitecture... It was hard, because there is nearly no 
MacOsX cmake documentation (or not up to date).

The last thing I'm stucked on is:
- how can cmake copy some Frameworks in the Ressources folder of my bundled app 
? I need to copy SDL.Framework, for example.
- how can cmake can copy my localized resources (French.lproj and 
English.lproj) in my bundled app ?
I tried this:
# When building for OSX, define specific sources for gui and ressources
if(ENABLE_OSX_BUNDLE)
set(GUIOSX_SOURCES
gui-osx/AlertHooks.m gui-osx/PrefsController.m gui-osx/Shared.m
gui-osx/CreateFloppyController.m gui-osx/SDLMain.m)
set_source_files_properties(${GUIOSX_SOURCES} PROPERTIES LANGUAGE C)
set(GUIOSX_RSRCS
  gui-osx/Hatari.icns
  gui-osx/English.lproj gui-osx/French.lproj)
endif(ENABLE_OSX_BUNDLE)
But I have an error about Copying gui-osx/English.lproj at the end

For the second point, it was working when there is only one file, but now, 
there is folder to be copied.

What about fixBundle ? I wcannot find any documentation
Next thing i will need help:
- I will have a problem that I cannot yet resolve: building an i386 app for 
debbugging, and an Universal (x86;ppc) for Release... Tried without success... 
I read a previous thread in this mailing list, but cannot find a solution.
- Make a different build system when building on MacOsX 10.5 or 10.6. When 
using 10.5, I will need to use library that are not provided by MacOs 10.5 
(readline, libpng, etc) in the good version. So, make will have to find them 
elsewhere or display an error. May be there is a way to find a version number ?
- 
Thanks for help,

Jerome 

--___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Linking error with VS2005

2010-05-21 Thread Philip Lowman
It also may be caused by linking code compiled with /MT against code
compiled with /MD (or vice versa).

On Fri, May 21, 2010 at 10:48 AM, Chuck Atkins chuck.atk...@kitware.comwrote:

 Does the problem happen in both Debug and Release builds?

 Visual C++ has a well known problem of mixing debug and release libraries
 together.  My suspicion is that you have some dependant libraries that are
 only built in Debug or only built in Release.  With Visual C++ it is
 important that all libraries and dependencies as well as the project code
 it's self be built in the same Build Configuration (Debug or Release).
 Mixing the two will often give rise to problems such as these.

 Chuck Atkins


 -- Mathematicians are tools for turning coffee grounds into formulas.,
 Paul Erdos


 On Fri, May 21, 2010 at 8:01 AM, Daanen Vincent daa...@koelis.com wrote:

 Dear Cmake users,

 I'm facing to a problem I can't resolve.
 I'm developping on a windows XP SP3 box with Visual Studio 2005.

 I have a project using itk which compile fine.
 For  some reason, I try to use cmake to generate the same project and I
 got linker error (conflict between msvcrtd.lib and libcmtd.lib)

 - I check that the librairies are declared in the same order in both
 project
 and it's ok
 - Try to ignore either msvcrtd.lib or libcmtd.lib but I does not work :
 other linker errors appear.

 I could not find what is specifically added by cmake so that the
 cmake-generated project fails to build the binray whereas the
 manually-generated project file succeeds...

 Is there someone who could help me ?

 Thanks

  Vince

 ___
 Powered by www.kitware.com

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

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

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake



 ___
 Powered by www.kitware.com

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

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

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake




-- 
Philip Lowman
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Need cmake help for MacOsX

2010-05-21 Thread Michael Wild

On 21. May, 2010, at 16:42 , Jérôme VERNET wrote:

 
 Hi,
 
 I'm trying to update an existing cmake project to be used on MacOsX. After a 
 lot of thinking, I can now build, using the right framworks/library/using the 
 good SDK/on the right ARCHitecture... It was hard, because there is nearly no 
 MacOsX cmake documentation (or not up to date).
 
 The last thing I'm stucked on is:
 - how can cmake copy some Frameworks in the Ressources folder of my bundled 
 app ? I need to copy SDL.Framework, for example.

fixup_bundle in BundleUtilities.cmake will do this for you. Unfortunately the 
functions are not documented in the header-comment, so you have to look into 
the file to read it. however, I remember there being problems with SDL which 
doesn't require fixing up since the install_name is already set for use as a 
private framework in a app bundle. Search the list archives, I'm pretty sure 
there was a solution.

 - how can cmake can copy my localized resources (French.lproj and 
 English.lproj) in my bundled app ?
 I tried this:
 # When building for OSX, define specific sources for gui and ressources
 if(ENABLE_OSX_BUNDLE)
 set(GUIOSX_SOURCES
 gui-osx/AlertHooks.m gui-osx/PrefsController.m gui-osx/Shared.m
 gui-osx/CreateFloppyController.m gui-osx/SDLMain.m)
 set_source_files_properties(${GUIOSX_SOURCES} PROPERTIES LANGUAGE C)
 set(GUIOSX_RSRCS
   gui-osx/Hatari.icns
   gui-osx/English.lproj gui-osx/French.lproj)
 endif(ENABLE_OSX_BUNDLE)
 But I have an error about Copying gui-osx/English.lproj at the end

Well, the actual error message would have been of help here, wouldn't it? And 
while you're at it, run with make VERBOSE=1 in order to see the actual 
commands being run.

 
 For the second point, it was working when there is only one file, but now, 
 there is folder to be copied.

See my last remark.

 
 What about fixBundle ? I wcannot find any documentation

See above.

 Next thing i will need help:
 - I will have a problem that I cannot yet resolve: building an i386 app for 
 debbugging, and an Universal (x86;ppc) for Release... Tried without success...

WHAT did you try? Usually one has different build trees. One for release and 
the other for debug builds (or even more trees, depending on your needs). This 
also depends on whether you are using the Xcode generator or the Unix Makefiles 
generator (personally, I recommend the latter...). Besides, apart from size and 
build times, there's nothing that speaks against debugging a universal binary.

 I read a previous thread in this mailing list, but cannot find a solution.

WHAT thread? You know, nobody here can see inside your head...

 - Make a different build system when building on MacOsX 10.5 or 10.6. When 
 using 10.5, I will need to use library that are not provided by MacOs 10.5 
 (readline, libpng, etc) in the good version. So, make will have to find them 
 elsewhere or display an error. May be there is a way to find a version number 
 ?

Don't get too fancy here. At most parse the version information from the 
headers (e.g. look at FindGTK2.cmake on how to do this).

 - 


What is ... here? Are you expecting help for something you don't even know 
about? ;-)


Michael

___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Need cmake help for MacOsX

2010-05-21 Thread Jerome Vernet

Le 21/05/10 18:20, Michael Wild a écrit :


On 21. May, 2010, at 16:42 , Jérôme VERNET wrote:



Hi,

I'm trying to update an existing cmake project to be used on MacOsX. After a 
lot of thinking, I can now build, using the right framworks/library/using the 
good SDK/on the right ARCHitecture... It was hard, because there is nearly no 
MacOsX cmake documentation (or not up to date).

The last thing I'm stucked on is:
- how can cmake copy some Frameworks in the Ressources folder of my bundled app 
? I need to copy SDL.Framework, for example.


fixup_bundle in BundleUtilities.cmake will do this for you. Unfortunately the 
functions are not documented in the header-comment, so you have to look into 
the file to read it.

That's the point: MacOsX support of cmake is nearly undocumented...

however, I remember there being problems with SDL which doesn't require fixing 
up since the install_name is already set for use as a private framework in a 
app bundle. Search the list archives, I'm pretty sure there was a solution.



I will.



Well, the actual error message would have been of help here, wouldn't it? And while 
you're at it, run with make VERBOSE=1 in order to see the actual commands 
being run.



Here is what I get:



WHAT did you try? Usually one has different build trees. One for release and 
the other for debug builds (or even more trees, depending on your needs). This 
also depends on whether you are using the Xcode generator or the Unix Makefiles 
generator (personally, I recommend the latter...). Besides, apart from size and 
build times, there's nothing that speaks against debugging a universal binary.



I have to find what is a build tree ;).

I read a previous thread in this mailing list, but cannot find a solution.


WHAT thread? You know, nobody here can see inside your head...



This one:
http://www.cmake.org/pipermail/cmake/2010-May/036693.html



- 


What is ... here? Are you expecting help for something you don't even know 
about? ;-)



Yes ! I havve still a lot of question.
I really need from someone a working MacOsX CMakeFile from any project 
to understand how CMake work on MacOsX.


Thanks for help,

Jerome


___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Need cmake help for MacOsX

2010-05-21 Thread Jerome Vernet

oops...
Le 21/05/10 18:20, Michael Wild a écrit :




Well, the actual error message would have been of help here, wouldn't it? And while 
you're at it, run with make VERBOSE=1 in order to see the actual commands 
being run.



Here is what I get:

Copying OS X content src/hatari.app/Contents/Resources/French.lproj
/Applications/CMake 2.8-1.app/Contents/bin/cmake -E copy 
/Users/jeromevernet/Documents/dev/Hatari-hgrc/hatari/src/gui-osx/French.lproj 
src/hatari.app/Contents/Resources/French.lproj
Error copying file 
/Users/jeromevernet/Documents/dev/Hatari-hgrc/hatari/src/gui-osx/French.lproj 
to src/hatari.app/Contents/Resources/French.lproj.

make[2]: *** [src/hatari.app/Contents/Resources/French.lproj] Error 1
make[1]: *** [src/CMakeFiles/hatari.dir/all] Error 2
make: *** [all] Error 2


Thanks for help,

Jerome


___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Need cmake help for MacOsX

2010-05-21 Thread Michael Jackson
That is not a file, but really a folder and maybe that is messing up  
CMake?

___
Mike Jackson  www.bluequartz.net
Principal Software Engineer   mike.jack...@bluequartz.net
BlueQuartz Software   Dayton, Ohio


On May 21, 2010, at 3:22 PM, Jerome Vernet wrote:


French.lproj


___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Need cmake help for MacOsX

2010-05-21 Thread Michael Wild
Yes, you have to copy every file individually. AFAIK there is a source file 
property you can set to specify the location inside the bundle.


 That is not a file, but really a folder and maybe that is messing up  
 CMake?
 ___
 Mike Jackson  www.bluequartz.net
 Principal Software Engineer   mike.jack...@bluequartz.net
 BlueQuartz Software   Dayton, Ohio
 
 
 On May 21, 2010, at 3:22 PM, Jerome Vernet wrote:
 
  French.lproj
 
 ___
 Powered by www.kitware.com
 
 Visit other Kitware open-source projects at 
 http://www.kitware.com/opensource/opensource.html
 
 Please keep messages on-topic and check the CMake FAQ at: 
 http://www.cmake.org/Wiki/CMake_FAQ
 
 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake
 
--
Michael Wildthem...@gmail.com sent by ibisMail!
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Need cmake help for MacOsX

2010-05-21 Thread Jerome Vernet

Le 21/05/10 22:08, Michael Wild a écrit :

Yes, you have to copy every file individually. AFAIK there is a source file 
property you can set to specify the location inside the bundle.


   



That is not a file, but really a folder and maybe that is messing up
CMake?
 
Localized resources are not files, but directory (for example, 
French.lproj/SDLMain.nib

   /InfoPlist.strings)


That's why

set_source_files_properties(
${APP_RSRCS}
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)

doesn't work. It try to copy *a file*, not a directory. But, it's a resources.
I also want to understand what exactly does fixup_bundle... Seems that it's not 
exactly to do that, but it succeed to copy library and frameworks.

Thanks for your help and to Werner. Things are coming.

Jerome




___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[CMake] Fwd: Re: Need cmake help for MacOsX

2010-05-21 Thread Werner Smekal
[Didn't send to list, so I forward my reply to Jerome.]

 Original Message 
Subject: Re: [CMake] Need cmake help for MacOsX
Date: Fri, 21 May 2010 22:02:42 +0200
From: Werner Smekal sme...@iap.tuwien.ac.at
To: Jérôme VERNET vernet.jer...@wanadoo.fr

Hi Jerome,

On 5/21/10 4:42 PM, Jérôme VERNET wrote:
 
 Hi,
 
 I'm trying to update an existing cmake project to be used on MacOsX.
 After a lot of thinking, I can now build, using the right
 framworks/library/using the good SDK/on the right ARCHitecture... It was
 hard, because there is nearly no MacOsX cmake documentation (or not up
 to date).

There is no section in the cmake documentation especially for Mac OS X,
but all options, etc. also especially for Mac OS X are documented
(nearly all ;) and you can read through the mailing list and wiki to
find most of your questions answered.
 
 The last thing I'm stucked on is:
 - how can cmake copy some Frameworks in the Ressources folder of my
 bundled app ? I need to copy SDL.Framework, for example.

As Michael already wrote SDL is special, since the SDL framework doesn't
need to be fixed, only copied into the application bundle, this is
what I do:

# copy SDL frameworks into app bundle for Mac OS X
if(APPLE)
INSTALL(DIRECTORY /Users/smekal/Library/Frameworks/SDL.framework
DESTINATION 
xrick.app/Contents/Frameworks)
INSTALL(DIRECTORY /Users/smekal/Library/Frameworks/SDL_mixer.framework
DESTINATION 
xrick.app/Contents/Frameworks)
INSTALL(DIRECTORY /Users/smekal/Library/Frameworks/SDL_ttf.framework
DESTINATION 
xrick.app/Contents/Frameworks)
endif(APPLE)

It's not nice that the path to the SDL framework is hard coded, but it
works right now and will change later. Obviously, you need to run make
install to get the correct application bundle and I usually set the
prefix path to a temporary directory, e.g.

cmake -DCMAKE_INSTALL_PREFIX=path-to-temp ..

or similar.

 - how can cmake can copy my localized resources (French.lproj and
 English.lproj) in my bundled app ?
 I tried this:
 
 # When building for OSX, define specific sources for gui and ressources
 if(ENABLE_OSX_BUNDLE)
 set(GUIOSX_SOURCES
 
   gui-osx/AlertHooks.m gui-osx/PrefsController.m gui-osx/Shared.m
 
   gui-osx/CreateFloppyController.m gui-osx/SDLMain.m)
 
   set_source_files_properties(${GUIOSX_SOURCES} PROPERTIES LANGUAGE C)
 
   set(GUIOSX_RSRCS
 gui-osx/Hatari.icns
 gui-osx/English.lproj gui-osx/French.lproj)
 
 endif(ENABLE_OSX_BUNDLE)
 
 But I have an error about Copying gui-osx/English.lproj at the end

I don't know where the localized resource should go into (resource
directory?), but again e.g. I do:

if(APPLE)
add_executable(
xrick MACOSX_BUNDLE
${xrick_SRCS}
${xrick_data}
${xrick_RSRCS}
)

# Mac OS X bundle specific settings
set(MACOSX_BUNDLE true)
set(MACOSX_BUNDLE_BUNDLE_NAME xrick)
set(MACOSX_BUNDLE_INFO_STRING xrick ${xrick_VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${xrick_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${xrick_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${xrick_VERSION})
  set(MACOSX_BUNDLE_ICON_FILE xrick.icns)

  # paths for data files in bundle
  set_source_files_properties(
${xrick_RSRCS}
PROPERTIES
  MACOSX_PACKAGE_LOCATION Resources
  )
  set_source_files_properties(
${xrick_data}
PROPERTIES
  MACOSX_PACKAGE_LOCATION MacOS
  )
endif(APPLE)

Resources etc. get copied in to the app bundle automatically.



 
 For the second point, it was working when there is only one file, but
 now, there is folder to be copied.
 
 What about fixBundle ? I wcannot find any documentation

Read the BundleUtilities.cmake module in the cmake.app - there is a lot
of documentation. Short example

# fixup bundle, copy dynamic libraries into app bundle
set(APPS \${CMAKE_INSTALL_PREFIX}/${SESSA_BUNDLE_NAME}.app)  # paths
to executables
set(DIRS ${CMAKE_SOURCE_DIR}/local/Release/lib)   # directories to
search for prerequisites
INSTALL(CODE 
include(BundleUtilities)
fixup_bundle(\${APPS}\   \\   \${DIRS}\)
)

The bundle is fixed when running make install, just running make is
not enough. Again use CMAKE_INSTALL_PREFIX so that the bundle is
installed in a directory where you want it.


 Next thing i will need help:
 - I will have a problem that I cannot yet resolve: building an i386 app
 for debbugging, and an Universal (x86;ppc) for Release... Tried without
 success... I read a previous thread in this mailing list, but cannot
 find a solution.

make two build directories. in one run cmake with

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=i386 ..


Re: [CMake] Fwd: Re: Need cmake help for MacOsX

2010-05-21 Thread Jerome Vernet

Thanks for your help. Things are better, but far from perfect, see below

Le 21/05/10 22:34, Werner Smekal a écrit :


Hi Jerome,

On 5/21/10 4:42 PM, Jérôme VERNET wrote:
   
# copy SDL frameworks into app bundle for Mac OS X

if(APPLE)
INSTALL(DIRECTORY /Users/smekal/Library/Frameworks/SDL.framework
DESTINATION 
xrick.app/Contents/Frameworks)
INSTALL(DIRECTORY /Users/smekal/Library/Frameworks/SDL_mixer.framework
DESTINATION 
xrick.app/Contents/Frameworks)
INSTALL(DIRECTORY /Users/smekal/Library/Frameworks/SDL_ttf.framework
DESTINATION 
xrick.app/Contents/Frameworks)
endif(APPLE)

   

I tried that.
if(ENABLE_OSX_BUNDLE)
message(***Install for MacOsX***)
install(TARGETS hatari BUNDLE DESTINATION /Applications)
INSTALL(DIRECTORY /Library/Frameworks/SDL.framework
DESTINATION 
/Applications/hatari.app/Contents/Resources)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gui-osx/French.lproj 
DESTINATION /Applications/hatari.app/Contents/Resources/)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gui-osx/English.lproj 
DESTINATION /Applications/hatari.app/Contents/Resources/)

endif(ENABLE_OSX_BUNDLE)

It worked. Great.

But... it's awfull ! Hard coded links (may be the path to SDL Framework 
can be found, there is PATH variable somewhere)... Need to do make 
install As the project have also other library, docs, etc...


I though that cmake can handle, automatically, all these things, but 
cannot find how... May be not.

I don't know where the localized resource should go into (resource
directory?), but again e.g. I do:
   

Yes.

if(APPLE)
add_executable(
xrick MACOSX_BUNDLE
${xrick_SRCS}
${xrick_data}
${xrick_RSRCS}
)

# Mac OS X bundle specific settings
set(MACOSX_BUNDLE true)
set(MACOSX_BUNDLE_BUNDLE_NAME xrick)
set(MACOSX_BUNDLE_INFO_STRING xrick ${xrick_VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${xrick_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${xrick_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${xrick_VERSION})
   set(MACOSX_BUNDLE_ICON_FILE xrick.icns)

   # paths for data files in bundle
   set_source_files_properties(
 ${xrick_RSRCS}
 PROPERTIES
   MACOSX_PACKAGE_LOCATION Resources
   )
   set_source_files_properties(
 ${xrick_data}
 PROPERTIES
   MACOSX_PACKAGE_LOCATION MacOS
   )
endif(APPLE)

Resources etc. get copied in to the app bundle automatically.


   

That's not working with folder. Hélas


Read the BundleUtilities.cmake module in the cmake.app - there is a lot
of documentation. Short example

   
Cannot understand all what is supposed to do fix_bundle, but, sure, 
it's not finished. Yes, it does copy Library and Framework (i test it), 
but do not work with SDL. And do not handle Localized Resources


make two build directories. in one run cmake with

   
How do you do that ? I tried to change the Binaries path in CMake GUI, 
got 1234 errors

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=i386 ..

and in the other

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=i386;ppc ..
   


I'll be back to XCode project as fast as I try to fix Hatari cmake build 
system.




Jerome
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

[CMake] CMake 2.8.1 / Win: Neither if nor else?`

2010-05-21 Thread Torsten Rohlfing

Hi --

At the risk of asking a stupid question: I seem to have a situation 
where CMake (2.8.1 on Windows XP) completely ignore an IF .. ELSE .. 
ENDIF construct and basically does neither the IF nor the ELSE branch.


My CMakeLists.txt is as follows:

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
  MESSAGE( WARNING HAVE system zlib )
ELSEIF(ZLIB_FOUND)
  MESSAGE( WARNING NO system zlib )
ENDIF(ZLIB_FOUND)

Now I would think that I should see wither the HAVE or the NO 
message in the config stage output, on Windows more likely the NO 
message of course.


Instead, what I get is this:

Check for working C compiler using: Visual Studio 10
Check for working C compiler using: Visual Studio 10 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 10
Check for working CXX compiler using: Visual Studio 10 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Could NOT find ZLIB  (missing:  ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
Configuring done

Can someone explain to me what I am missing?

Thanks!
  Torsten

--
Torsten Rohlfing, PhD  SRI International, Neuroscience Program
 Senior Research Scientist  333 Ravenswood Ave, Menlo Park, CA 94025
  Phone: ++1 (650) 859-3379  Fax: ++1 (650) 859-2743
   tors...@synapse.sri.comhttp://www.stanford.edu/~rohlfing/

 Though this be madness, yet there is a method in't

___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] CMake 2.8.1 / Win: Neither if nor else?`

2010-05-21 Thread Tyler Roscoe
On Fri, May 21, 2010 at 02:04:38PM -0700, Torsten Rohlfing wrote:
 FIND_PACKAGE(ZLIB)
 IF(ZLIB_FOUND)
   MESSAGE( WARNING HAVE system zlib )
 ELSEIF(ZLIB_FOUND)
   MESSAGE( WARNING NO system zlib )
 ENDIF(ZLIB_FOUND)

I don't see an else clause here, just two ifs (that check the same
condition).

tyler
___
Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake