Re: [CMake] How to set own linker?

2011-09-23 Thread Martin Kupke

If I am using  a cross linker, mine is the dld.exe..
How do I incorporate it into the CMake process?
As I could figure out CMake assumes that the compiler itself will do the 
linking.


On 22.09.11 18:09, Martin Kupke wrote:

Hi,

I created a toolchain file for cross compiling in my Windows XP
environment.
To provide cross compiling functionality I set the CMAKE_SYSTEM_NAME to
Generic.
The toolchain file contains the variables:
CMAKE_C_COMPILER set to my own wanted compiler, which is dcc.exe
CMAKE_ASM_OCU_COMPILER set to my own wanted assembler, which is das.exe
For both, assembler and compiler I created configuration files in the
Platform folder.
Up to this point everything goes fine and as wanted, the assembler
source files with the .s extension are compiled with das.exe and the C
source files with the extension .c are compiled with the dcc.exe.

In the root top level CMakeLists.txt the instruction
project( EmbeddedProject C ASM_OCU)
ensures that only C compiler and ASM_OCU assembler are called (no CXX).

Even in the root top level CMakeLists.txt I set
add_executable( ${PROJECT_NAME} ${SourceFiles} )
where SourceFiles is a string containing all source files (assembler and C).

I even tried to set the CMAKE_LINKER variable to my own linker, but it
isn't used.
Where is my fault?

Thanks,
Martin...


--

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


--



*martin kupke*

can diagnostics engineer | senior software developer

*m*:+49.151.5511.3632| *e*:martin.ku...@novero.com 



skype:martin.kupke_novero | w:www.novero.com 

novero GmbH
meesmannstr.103 | 44807 Bochum | germany


novero gmbh | parsevalstr. 7 a | 40468 düsseldorf | germany | 
amtsgericht düsseldorf | hrb 58283 | umsatzsteueridentifikationsnummer: 
de 814973142 | geschäftsführender gesellschafter: razvan olosu


--

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] How to set own linker?

2011-09-23 Thread Martin Kupke
In my cross compiling environment I have an own Platform folder which 
contains a Generic-dcc file, in this file I added the statement: 
set(CMAKE_C_LINK_EXECUTABLE "${COMPILER_PATH}/dld.exe") and now it seems 
that the dld.exe is used as linker.


My next problem is, that my linker flags are not used.
I tried to set CMAKE_EXE_LINKER_FLAGS, but this doesn't work.

On 23.09.11 11:08, Martin Kupke wrote:

If I am using  a cross linker, mine is the dld.exe..
How do I incorporate it into the CMake process?
As I could figure out CMake assumes that the compiler itself will do the 
linking.


On 22.09.11 18:09, Martin Kupke wrote:

Hi,

I created a toolchain file for cross compiling in my Windows XP
environment.
To provide cross compiling functionality I set the CMAKE_SYSTEM_NAME to
Generic.
The toolchain file contains the variables:
CMAKE_C_COMPILER set to my own wanted compiler, which is dcc.exe
CMAKE_ASM_OCU_COMPILER set to my own wanted assembler, which is das.exe
For both, assembler and compiler I created configuration files in the
Platform folder.
Up to this point everything goes fine and as wanted, the assembler
source files with the .s extension are compiled with das.exe and the C
source files with the extension .c are compiled with the dcc.exe.

In the root top level CMakeLists.txt the instruction
project( EmbeddedProject C ASM_OCU)
ensures that only C compiler and ASM_OCU assembler are called (no CXX).

Even in the root top level CMakeLists.txt I set
add_executable( ${PROJECT_NAME} ${SourceFiles} )
where SourceFiles is a string containing all source files (assembler and C).

I even tried to set the CMAKE_LINKER variable to my own linker, but it
isn't used.
Where is my fault?

Thanks,
Martin...


--

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] How to set own linker?

2011-09-23 Thread Florian Reinhard
here some points that should help you find a solution (just as a hint
where or what to search)

ENABLE_LANGUAGE(ASM_OCU)
PROJECT (foo)
SET(CMAKE_EXE_LINKER_FLAGS "-abcdfg" ) <-- does work for me!
add_executable(foo_target ${FOO_SRC})
SET_TARGET_PROPERTIES(foo_target PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(foo_target PROPERTIES LINK_FLAGS "-abcdfg")
--

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 matlab mex compiler with cmake on windows

2011-09-23 Thread Jaka Katrašnik
But which one?

I'm trying to follow the steps of this tutorial (
http://www.vtk.org/Wiki/CMake:MatlabMex). However I don't know how to apply
the patch that is referenced in it. The patch is for Linux machines and I'm
using Windows.



On Fri, Sep 23, 2011 at 4:44 AM, David Cole  wrote:

> You can't set CC and CXX and use them with the Visual Studio generators.
> Try using a makefile generator instead...
>
> HTH,
> David
>
>
>
> On Thursday, September 22, 2011, Jaka Katrašnik 
> wrote:
> > Hi,
> >
> > I'm having trouble using cmake to compile a matlab mex file. When I try
> to to use cmake with the CC CXX environment variables set to mex I get the
> following error
> >
> > E:\Jaka_docs\cmake tutorial\step1>cmake .
> > -- Building for: Visual Studio 10
> > CMake Error at C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CMakeDet
> > ermineCCompiler.cmake:44 (MESSAGE):
> >   Could not find compiler set in environment variable CC:
> >
> >   mex.
> > Call Stack (most recent call first):
> >   CMakeLists.txt:2 (project)
> >
> >
> > CMake Error: Could not find cmake module file:E:/Jaka_docs/cmake
> tutorial/step1/
> > CMakeFiles/CMakeCCompiler.cmake
> > CMake Error: Could not find cmake module file:E:/Jaka_docs/cmake
> tutorial/step1/
> > CMakeFiles/CMakeCXXCompiler.cmake
> > -- Configuring incomplete, errors occurred!
> >
> >
> > Has anyone had a similar problem? Do you know of a solution to this?
> >
> > Thank you
> > Jaka Katrasnik
> >
> >
>
--

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] How to set own linker?

2011-09-23 Thread Martin Kupke

  
  
After setting the variable CMAKE_C_LINK_EXECUTABLE to my own linker
in my Platform/Generic-dcc file it was used. Formerly I set the
variable in my toolchain file and that doesn't work. If setting the
CMAKE_C_LINK_EXECUTABLE variable you need to set the complete string
as in the CMake\share\cmake-2.8\Modules\CMakeCInformation.cmake.

This means I copied the line where the standard C compiler was
declared also as the linker and set the string in my
Platform/Generic-dcc variable CMAKE_C_LINK_EXECUTABLE and that
works.
Now my cross linker is used, the compiled objects are passed as
parameter and my linker flags are set.

Your hint with the two lines is useful in any case:
SET_TARGET_PROPERTIES(foo_target PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(foo_target PROPERTIES LINK_FLAGS "-abcdfg")

Many thanks for that!

On 23.09.11 14:37, Florian Reinhard wrote:

  here some points that should help you find a solution (just as a hint
where or what to search)

ENABLE_LANGUAGE(ASM_OCU)
PROJECT (foo)
SET(CMAKE_EXE_LINKER_FLAGS "-abcdfg" ) <-- does work for me!
add_executable(foo_target ${FOO_SRC})
SET_TARGET_PROPERTIES(foo_target PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(foo_target PROPERTIES LINK_FLAGS "-abcdfg")



-- 
  
  
  


  
  martin
kupke
   can diagnostics
  engineer | senior software developer
  
  m: +49.151.5511.3632 | e: martin.ku...@novero.com
  skype: 
martin.kupke_novero 
| w: www.novero.com
  



meesmannstr.103 | 44807 Bochum | germany

   
  novero gmbh | parsevalstr.  7 a | 40468 düsseldorf | germany |
  amtsgericht düsseldorf | hrb 58283 |
  umsatzsteueridentifikationsnummer: de 814973142 |
  geschäftsführender gesellschafter: razvan olosu 
  
   

  

  

--

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, iOS and .xib compilation

2011-09-23 Thread Daniel Dekkers
Hi David,

I'm looking at your iOSNavApp test for iOS.

A few comments as of now:

- universal -

NavApp3 is an iPhone build, if you run it on an iPad (or iPad simulator) it 
"emulates" an iPhone on screen. 
I've made my version of your test "universal" (as in.. iPad and iPhone) by just 
adding an extra target property: XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY '1,2'

- .xib compilation -

I finally understand why your .xib files are compiled correctly, while 
apparently just adding them to add_excutable(). 
It's the RESOURCE "${RESOURCES}" target property. That makes Xcode "resource 
aware".

- architectures -

You explicitly set the CMAKE_OSX_ARCHITECTURE to "armv6;armv7;i386", which 
makes sense. Older devices, newer devices and simulator.
And you set CMAKE_XCODE_EFFECTIVE_PLATFORMS to "-iphoneos;-iphonesimulator"

Which results in:

Architectures: armv6 armv7 i386
Build Active Architecture Only: No
Supported Platforms: iphonesimulator iphoneos
Valid Architectures: armv6 armv7

In my projects until now i've been using $(ARCHS_UNIVERSAL_IPHONE_OS) for 
CMAKE_OSX_ARCHITECTURES, ignoring the CMAKE_XCODE_EFFECTIVE_PLATFORMS resulting 
in:

Architectures: Optimized (armv7) 
Build Active Architecture Only: No
Supported Platforms: iphonesimulator iphoneos
Valid Architectures: armv6 armv7

And it still runs on both devices and simulators. Bit strange.

- artwork (icons/splashscreens/) -

Maybe the next step would be to add an icon.png? 

What are your plans with the iOSNavApp test?

Kind Regards, 
Daniel Dekkers

On Sep 21, 2011, at 7:30 PM, David Cole wrote:

> On Wed, Sep 21, 2011 at 12:41 PM, Daniel Dekkers  
> wrote:
>> Hi David,
>> 
>>> I have tested it manually using the Xcode generator. The point of this
>>> recent work was focused on getting "simulator" and "device" builds
>>> both working within the same Xcode project at the same time, and
>>> allowing the developer to switch back and forth between them in the
>>> Xcode UI.
>>> 
>>> There are *.xib files in this project, and they are included simply by
>>> adding them as source files to add_executable.
>> 
>> Ok, i've tried that and it works. But it seems I have to "label" the .xib 
>> files first...
>> 
>>SET_SOURCE_FILES_PROPERTIES(
>>${RSRC_IOS_XIB_FILES}
>>PROPERTIES
>>MACOSX_PACKAGE_LOCATION Resources
>>)
>> 
>> ... otherwise Xcode just seems to ignore the file (although it makes it 
>> visible in the IDE).
>> If i do "label" it, Xcode recognizes the file, compiles it and adds it to 
>> the bundle in the first steps of the build process.
>> So i deleted my own Cmake .xib compilation script.
>> 
> 
> Excellent -- good to know this was helpful.
> 
> 
>> About the simulator and device builds... much to my surprise my toolchain 
>> file for device works for the simulator as well (both iPad and iPhone).
>> 
>> It looks like this:
>> 
>>MESSAGE(STATUS "Parsing iphone-device toolchain file")
>>SET (CMAKE_SYSTEM_NAME Generic)
>>SET (CMAKE_SYSTEM_VERSION 1)
>>SET (CMAKE_SYSTEM_PROCESSOR arm)
>> 
>>SET (SDKVER "4.3")
>>SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
>>SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
>>SET (CMAKE_OSX_SYSROOT "${SDKROOT}")
>>SET (CMAKE_OSX_ARCHITECTURES "$(ARCHS_UNIVERSAL_IPHONE_OS)") # Either 
>> "$(ARCHS_UNIVERSAL_IPHONE_OS)" or "arm6" "arm7"
>> 
>>SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc-4.2")
>>SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++-4.2")
>> 
>>SET (CMAKE_FIND_ROOT_PATH "${IPHONE_SDKROOT}" 
>> "/opt/iphone-${SDK_VER}/" "/usr/local/iphone-${SDK_VER}/")
>>SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
>>SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>>SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>> 
>> I just include it at the moment. So i'm thinking to remove the 
>> simulator/device distinction altogether and just add these settings to the 
>> main CMakeLists.txt
>> Although i do like the concept of cross-compiling and toolchain files very 
>> much. With future android builds and all.
>> 
> 
> This is also good to know. I'd definitely recommend keeping that stuff
> in the toolchain file rather than putting it directly in the
> CMakeLists.txt file. One of these days I'm going to try out this
> cross-compiling toolchain thing for my own personal edification... :-)
> 
> Let us know if you run into any problems.
> 
> 
> Thanks,
> David

--

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] ExternalProject: avoiding rebuilds

2011-09-23 Thread Ben Medina
Hello all,

I'm trying to adopt greater usage of ExternalProject in my project.
One problem I'd like to resolve is spurious rebuilds of external
projects.

For example, I'd like to build CLAPACK as an external project, so I do
something like this:

ExternalProject_Add (clapack
URL ${tarball_location}
URL_MD5 4fd18eb33f3ff8c5d65a7d43913d661b
UPDATE_COMMAND ""
CMAKE_CACHE_ARGS "${clapack_cmake_args}"
INSTALL_COMMAND ""
)

add_executable (test main.cpp)

add_dependencies(test clapack)

This works great: building "test" first untars the CLAPACK source and
builds it, as expected. However, if I rebuild test (i.e. in Visual
Studio, right-click on test and rebuild), then the CLAPACK tarball get
extracted *again*, and a full rebuild of CLAPACK happens. I'd expect
that, unless the tarball is changed, a rebuild of the external project
is a no-op.

Is there a way to achieve my desired behavior?

I have another external project where the source is checked into my
source tree. A rebuild on that external project is a no-op unless the
source files have changed. However, I'd rather avoid checking in
3rdparty source code into my source tree.

Thanks,
Ben
--

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] Fwd: Save stripped debugging information

2011-09-23 Thread Michael Hertling
On 09/22/2011 01:24 PM, Rolf Eike Beer wrote:
>> Il 22/09/2011 10.13, Rolf Eike Beer ha scritto:
 Yeah, that's exactly what I had in mind. Any chance that we will see
 this in a future release?
>>> This is usually "find someone who does it and writes tests for it".
>>> Which
>>> then boils down to find someone who has enough knowledge and spare time
>>> to
>>> do or someone that needs it and is willing to pay Kitware for doing it.
> 
>> Why don't you invoke ${CMAKE_OBJCOPY} as a post build command?
> 
> That would be a way to _get_ these debug symbol files, but not a clean way
> to _install_ them. And the other reason is that this variable doesn't show
> up in any CMake documentation.
> 
> Eike

In order to take up Andrea's suggestion for Lukas' concern:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(DEBUGINFO C)
SET(CMAKE_VERBOSE_MAKEFILE ON)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
ADD_EXECUTABLE(main main.c)
FIND_PROGRAM(OBJCOPY objcopy)
ADD_CUSTOM_COMMAND(TARGET main POST_BUILD
COMMAND ${OBJCOPY} --only-keep-debug
$ ${CMAKE_BINARY_DIR}/main.dbg
COMMAND ${OBJCOPY} --strip-debug
$
COMMAND ${OBJCOPY} --add-gnu-debuglink=main.dbg
$
)
INSTALL(TARGETS main RUNTIME DESTINATION bin)
INSTALL(FILES ${CMAKE_BINARY_DIR}/main.dbg DESTINATION bin)

This exemplary project simply follows objcopy's manpage
w.r.t. the --only-keep-debug switch and works on *nix.
Does it not work for you, or is it not clean enough?

Regards,

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] return value of find_library

2011-09-23 Thread Yifei Li


On Sep 22, 2011, at 2:39 PM, David Cole wrote:

> It should always be a full path for a valid found library. Under what
> circumstances are you getting exactly "mylib" … ?
Here is a real example:

find_package(OpenMesh)
message("${OPENMESH_LIBRARY}")

find_package(ARPACK)
message("${ARPACK_LIBRARY}")

find_package(SUPERLU)
message("${SUPERLU_LIBRARY}")


only the last one, ${SUPERLU_LIBRARY}, is the full path.

P.S.,  I have cmak 2.8-5 installed on my Macbook Pro running Lion


> 
> On Thu, Sep 22, 2011 at 11:26 AM, Yifei Li  wrote:
>> Hi all,
>> 
>> Say I have find_library(MYLIB mylib  PATHS …) ,   I don't understand why 
>> MYLIB sometimes is a full path to mylib and sometimes only contains 'mylib'.
>> 
>> Thanks
>> 
>> Yifei
>> 
>> --
>> 
>> 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