Re: [CMake] find_library and mac os x SDKs

2010-03-27 Thread Simmons, Aaron
>What I don't understand is this: Why do you want to force the SDK? Shouldn't 
>this be the worry of the person doing the build?
>
>If I download some open-source software and then build it for myself, 
>I don't want to be forced in using the 10.4 SDK, I wan't to build against the 
>greatest and latest!

If this were open-source, I'd agree with you.  But it's not-- it's the build 
script for my company's software that needs to run on 10.4.  I suppose I could 
have cmake try for the 10.4 sdk if it's available or use the default otherwise. 
 But since it's a requirement that it work on 10.4, I'd rather have it always 
build that way.


aaron
___
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 target_link_libraries

2010-03-27 Thread Colin Michael Diesh

No, I just renamed it in the posting wrong. Here's how it looks actually

CMakeLists.txt -- something like this
---
PROJECT(tiney)

FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT)
FIND_PACKAGE(GLEW)

...
IF(GLEW_FOUND)
  SET(tiney_LIBS ${tiney_LIBS} ${GLEW_LIBRARY} )
ENDIF(GLEW_FOUND)

IF(OPENGL_FOUND)
  SET(tiney_LIBS ${tiney_LIBS} ${OPENGL_LIBRARIES} )
ENDIF(OPENGL_FOUND)

IF(GLUT_FOUND)
  SET(tiney_LIBS ${tiney_LIBS} ${GLUT_LIBRARIES} )
ENDIF(GLUT_FOUND)
...

ADD_EXECUTABLE(tiney ${tiney_SRCS})
TARGET_LINK_LIBRARIES(tiney ${tiney_LIBS})
---

-Colin
___
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 target_link_libraries

2010-03-27 Thread John Drescher
> ADD_EXECUTABLE(tiney ${program_SRCS})
> TARGET_LINK_LIBRARIES(program ${program_LIBS})

Are these the exact 2 lines? I mean you have tiney in one and program
in the other?

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


[CMake] Using target_link_libraries

2010-03-27 Thread Colin Michael Diesh
Hey, I was trying to use the TARGET_LINK_LIBRARIES in a CMakeLists.txt file but 
the linking doesn't end up working. I am using cygwin and CMake 2.6.4

Currently, I am having trouble with the OpenGL libraries. It links GLUT but not 
the OpenGL libraries.


CMakeLists.txt

...
FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT)
...
SET(program_LIBS ${program_LIBS} ${GLUT_LIBRARIES} )
SET(program_LIBS ${program_LIBS} ${OPENGL_LIBRARIES} )
...
ADD_EXECUTABLE(tiney ${program_SRCS})
TARGET_LINK_LIBRARIES(program ${program_LIBS})
...
--



Doing MESSAGE(STATUS "${program_LIBS}") gives

-- 
/lib/libglut.dll.a;/usr/lib/w32api/libglu32.a;/usr/lib/w32api/libopengl32.a;/usr/X11R6/lib/libGLEW.a



CMakeFiles/program.dir/link.txt says this

/usr/bin/gcc.exe  -O3 -DNDEBUG   CMakeFiles/tiney.dir/main.c.o  -o tiney.exe 
-Wl,--out-implib,libtiney.dll.a 
-Wl,--major-image-version,0,--minor-image-version,0  -lglut 
/usr/lib/w32api/libglu32.a /usr/lib/w32api/libopengl32.a 
/usr/X11R6/lib/libGLEW.a 



So it links GLUT correctly, but the opengl libraries do not get linked, they do 
not have '-l'. Is there any way I can fix this?

Note: it also doesn't work for another library, libGLEW.a.

-Colin



___
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] rename of target on install

2010-03-27 Thread Hai Nguyen
Your first suggestion worked out fantastically.

Thanks,
Hai

On Fri, Mar 26, 2010 at 1:44 AM, Michael Wild  wrote:

>
> On 26. Mar, 2010, at 9:23 , Micha Renner wrote:
>
> > Am Freitag, den 26.03.2010, 08:33 +0100 schrieb Michael Wild:
> >> On 25. Mar, 2010, at 23:41 , Hai Nguyen wrote:
> >>
> >>> Hi all,
> >>>
> >>> Is there a way for me to rename the executable during the install? I'm
> using
> >>> the same CMakeList.txt to build several versions and I'd like to
> install
> >>> them to different directories but with the version number stripped off
> of
> >>> the executable.
> >>>
> >>> Thanks,
> >>> - Hai
> >>
> >> I don't think there is a way of doing that. But what you can do is
> setting the OUTPUT_NAME and RUNTIME_OUTPUT_DIRECTORY target properties using
> the SET_TARGET_PROPERTIES command. This way, you can already reproduce the
> executable names and directory structure in the build tree.
> >>
> > Maybe one can use "The PROGRAMS signature" of install
> >
> > install(PROGRAMS files... DESTINATION 
> >  [PERMISSIONS permissions...]
> >  [CONFIGURATIONS [Debug|Release|...]]
> >  [COMPONENT ]
> >  [RENAME ] [OPTIONAL])
> > See:
> > www.cmake.org/cmake/help/cmake-2-8-docs.html#command:install
> >
> > Micha
>
> This is possible using the LOCATION target property. But I think the other
> approach is cleaner and less confusing.
>
> 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
>
___
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] find_library and mac os x SDKs

2010-03-27 Thread Michael Wild

On 27. Mar, 2010, at 16:53 , Simmons, Aaron wrote:

>> It is a common misconception that one needs to use the 10.4 SDK to
>> create an executable that is compatible with 10.4.  This is not so.
> 
> In most cases, you're right.  However, we're linking to the iconv library.  
> If we don't specify the 10.4 SDK via isysroot, it will link to the wrong 
> version of libiconv.dylib and won't run on 10.4 with this error:
>dyld: Library not loaded: /usr/lib/libiconv.2.dylib
>  Referenced from: 
>  Reason: Incompatible library version:  requires version 7.0.0 or 
> later, but libiconv.2.dylib provides version 5.0.0
>Trace/BPT trap
> 
> The problem can be seen by inspecting the exe with otool:
>   /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 
> 7.0.0)
>   /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 
> 1.0.0)
>   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
> version 111.1.4)
> 
> But if we use the 10.4 sdk, otool shows that we get the right "compatibility 
> version" of libiconv:
>   /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 
> 5.0.0)
>   /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 
> 1.0.0)
>   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
> version 88.3.10)
> which will run fine on 10.4.
> 
> 
> Thanks,
> aaron

What I don't understand is this: Why do you want to force the SDK? Shouldn't 
this be the worry of the person doing the build?

If I download some open-source software and then build it for myself, I don't 
want to be forced in using the 10.4 SDK, I wan't to build against the greatest 
and latest! However, if I then want to distribute the software in binary form 
to as many people as possible, I'll just set the CMAKE_OSX_SYSROOT cache 
variable to /Developer/SDKs/MacOSX10.4u.sdk (and also specify 
-mmacosx-version-min=10.4 in all CMAKE__FLAGS variables).


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] find_library and mac os x SDKs

2010-03-27 Thread Simmons, Aaron
> It is a common misconception that one needs to use the 10.4 SDK to
> create an executable that is compatible with 10.4.  This is not so.

In most cases, you're right.  However, we're linking to the iconv library.  If 
we don't specify the 10.4 SDK via isysroot, it will link to the wrong version 
of libiconv.dylib and won't run on 10.4 with this error:
dyld: Library not loaded: /usr/lib/libiconv.2.dylib
  Referenced from: 
  Reason: Incompatible library version:  requires version 7.0.0 or 
later, but libiconv.2.dylib provides version 5.0.0
Trace/BPT trap

The problem can be seen by inspecting the exe with otool:
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 
7.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 
1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 111.1.4)

But if we use the 10.4 sdk, otool shows that we get the right "compatibility 
version" of libiconv:
/usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 
5.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 
1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 88.3.10)
which will run fine on 10.4.


Thanks,
aaron
___
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