[CMake] Toolchain.cmake causing find_library problems

Dixon, Shane Shane.Dixon at atmel.com
Thu Oct 29 13:09:13 EDT 2009


I opened a bug report for this because it seems odd that FIND_PATH and FIND_LIBRARY both have their mode set to "ONLY" and one works and the other doesn't.

--
Shane Dixon
Linux Engineer

-----Original Message-----
From: cmake-bounces at cmake.org on behalf of Dixon, Shane
Sent: Thu 10/29/2009 10:46 AM
To: a.neundorf-work at gmx.net; cmake at cmake.org
Subject: Re: [CMake] Toolchain.cmake causing find_library problems
 
So "gcc-fm.exe main.c -rdynamic"  fails ?  
Yes, it fails.

Does "gcc-fm.exe main.c -shared"  work ?  
Yes, -shared seems to work.

I'm still having success with FIND_PATH, but FIND_LIBRARY fails:

In toolchain.cmake:
INCLUDE( CMakeForceCompiler )
SET( CMAKE_SYSTEM_NAME Linux )
CMAKE_FORCE_C_COMPILER( gcc-fm GNU )
CMAKE_FORCE_CXX_COMPILER( g++-fm GNU )
SET( CMAKE_FIND_ROOT_PATH 
  "C:/gcc-fm"
  "C:/Program Files/Eracom/ProtectProcessing Orange SDK"
  "C:/Program Files/Eracom/ProtectToolkit C SDK" )
SET( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
SET( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

In CMakeLists.txt
FIND_PATH( ERACOM_PPO_INCLUDE_DIR fmerr.h )
FIND_PATH(ERACOM_PTKC_INCLUDE_DIR cryptoki.h )
FIND_LIBRARY( ERACOM_XXX_LIBFMCRT_LIBRARY libfmcrt
		  PATH_SUFFIXES armfm )
FIND_LIBRARY( ERACOM_XXX_CRYPTOKI2_LIBRARY cryptoki2 )

Both the FIND_PATH's pass and both FIND_LIBRARY's fail again.  I thought maybe it's because the paths have a space so I moved them to a folder that has no spaces and still the same issue.

Here are all the paths:
C:\Program Files\Eracom\ProtectToolkit C SDK\include\cryptoki.h
C:\Program Files\Eracom\ProtectProcessing Orange SDK\include\fmerr.h
C:\Program Files\Eracom\ProtectToolkit C SDK\lib\cryptoki2.lib
C:\Program Files\Eracom\ProtectProcessing Orange SDK\lib\armfm\libfmcrt.a


-----Original Message-----
From: cmake-bounces at cmake.org on behalf of Alexander Neundorf
Sent: Wed 10/28/2009 5:09 PM
To: cmake at cmake.org
Subject: Re: [CMake] Toolchain.cmake causing find_library problems
 
On Wednesday 28 October 2009, Dixon, Shane wrote:
> The error message I get if I don't force the compiler is this:
>
> http://pastebin.com/m185e1316

So "gcc-fm.exe main.c -rdynamic"  fails ?
Does "gcc-fm.exe main.c -shared"  work ?


> The paths are:
> C:\Program Files\Eracom\ProtectProcessing Orange SDK\lib\armfm\libfmcrt.a
> C:\Program Files\Eracom\ProtectToolkit C SDK\include\cryptoki.h

Ok.
SET( CMAKE_FIND_ROOT_PATH 
     "C:/Program Files/Eracom/ProtectProcessing Orange SDK"
      "C:/Program Files/Eracom/ProtectToolkit C SDK")

and then in the CMakeLists.txt:

FIND_LIBRARY( ERACOM_XXX_LIBFMCRT_LIBRARY fmcrt
              PATH_SUFFIXES armfm )

FIND_PATH( ERACOM_PTKC_INCLUDE_DIR cryptoki.h )

should work.
If the library is not found, there is probably still an issue with using the 
correct prefixes/suffixes due to using Windows as a host (I don't think too 
many people have done this yet with cmake).

> Ah, just in pasting that I see part of the problem.  Since I'm
> cross-compiling, I need to point to libfmcrt.a instead of libfmcrt.lib.

Just using "fmcrt" in find_library() should be enough, cmake will add the 
necessary prefixes/suffixes itself.

Alex
_______________________________________________
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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091029/da07d29f/attachment.htm>


More information about the CMake mailing list