Re: [CMake] CMake toolchain and FIND_PACKAGE(OpenSSL)

2012-11-20 Thread Boards Killer
Hi Vyacheslav,
Salut Eric,

Many thanks for your answers.

 I thought that adding a LINK_DIRECTORIES to the toolchain would do the
 trick, but no avail.

 I'm pretty sure LINK_DIRECTORIES should not be used in toolchain
 if not use at all.

 The purpose of find_package is precisely to find the full path to libraries
 thus not to need to use LINK_DIRECTORIES.

You are right. It seems that removing LINK_DIRECTORIES does the trick!


 What is the best way to tell CMake where to find the libraries? Should I set
 the path manually in the toolchain, for instance.

 Nope. you shoud throw away
 INCLUDE_DIRECTORIES
 and
 LINK_DIRECTORIES
 from your toolchain

If I throw the INCLUDE_DIRECTORIES directives way, CMake runs fine but the
project fails to compile. If I leave the (1st) INCLUDE_DIRECTORIES directive,
then every works as expected.

The only difference between both versions, is in the latter the flag -isystem
is passed to the compiler. That seems to make a huge difference at the end.

Of course, if there is a more sensible way do achieve the same result, I'd glad
to ear it.


 By the way, which version of CMake are you using?

Sorry, I forgot to mention the obvious. I am using CMake 2.8.3.
--

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 toolchain and FIND_PACKAGE(OpenSSL)

2012-11-20 Thread Boards Killer
 I'm pretty sure LINK_DIRECTORIES should not be used in toolchain
 if not use at all.

 The purpose of find_package is precisely to find the full path to libraries
 thus not to need to use LINK_DIRECTORIES.

 You are right. It seems that removing LINK_DIRECTORIES does the trick!

Oops... My bad. Nope, CMake still does not find the OpenSSL library, even if I
throw all INCLUDE and LINK directories directives away...

Is there a way to trace what CMake is doing when looking up for OpenSSL?

TIA,
/ld
--

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 toolchain and FIND_PACKAGE(OpenSSL)

2012-11-20 Thread Boards Killer
 I'm pretty sure LINK_DIRECTORIES should not be used in toolchain
 if not use at all.

 The purpose of find_package is precisely to find the full path to libraries
 thus not to need to use LINK_DIRECTORIES.

 You are right. It seems that removing LINK_DIRECTORIES does the trick!

 Oops... My bad. Nope, CMake still does not find the OpenSSL library, even if I
 throw all INCLUDE and LINK directories directives away...

 Is there a way to trace what CMake is doing when looking up for OpenSSL?

man page told me about --trace...

After some intensive digging, I think I have found the problem. My rootfs has
broken links, in particular for libssl.so and libcrypto.so ... So no wonder that
CMake got troubled..

I'll correct those and let you know.

Thanks a lot for you help,
Loïc
--

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 toolchain and FIND_PACKAGE(OpenSSL)

2012-11-19 Thread Vyacheslav Karamov

Hi, try setting

packagename_DIR before FIND_PACKAGE()

19.11.2012 14:41, Boards Killer ?:

Hi CMake Community !

I am writing a CMake toolchain to cross compile our CMake project with 
the Ubuntu ARM Linux toolchain. The CMake toolchain is given below.


I am facing the following problem. When using:
FIND_PACKAGE(OpenSSL)

The libraries (lssl, lcrypto) are *not* found. There are actually 
located at

$ENV{SDK_TARGET}/lib

I thought that adding a LINK_DIRECTORIES to the toolchain would do the 
trick, but no avail.


What is the best way to tell CMake where to find the libraries? Should 
I set the path manually

in the toolchain, for instance.

TIA,
/ld
--
# Cmake toolchain for cross compiling

# target system type
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR armv7l)

INCLUDE_DIRECTORIES(SYSTEM $ENV{SDK_TARGET}/usr/include)
INCLUDE_DIRECTORIES(SYSTEM 
$ENV{SDK_TARGET}/usr/include/arm-linux-gnueabi)

LINK_DIRECTORIES($ENV{SDK_TARGET}/lib)

# specify the cross compiler
SET(CMAKE_C_COMPILER   arm-linux-gnueabi-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++)

# location of target environment
SET(CMAKE_FIND_ROOT_PATH $ENV{SDK_TARGET})

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)



--

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] CMake toolchain and FIND_PACKAGE(OpenSSL)

2012-11-19 Thread Eric Noulard
2012/11/19 Boards Killer boards.kil...@gmail.com:
 Hi CMake Community !

 I am writing a CMake toolchain to cross compile our CMake project with the
 Ubuntu ARM Linux toolchain. The CMake toolchain is given below.

 I am facing the following problem. When using:
 FIND_PACKAGE(OpenSSL)

 The libraries (lssl, lcrypto) are *not* found. There are actually located at
 $ENV{SDK_TARGET}/lib

 I thought that adding a LINK_DIRECTORIES to the toolchain would do the
 trick, but no avail.

I'm pretty sure LINK_DIRECTORIES should not be used in toolchain
if not use at all.

The purpose of find_package is precisely to find the full path to libraries
thus not to need to use LINK_DIRECTORIES.

 What is the best way to tell CMake where to find the libraries? Should I set
 the path manually in the toolchain, for instance.

Nope. you shoud throw away
INCLUDE_DIRECTORIES
and
LINK_DIRECTORIES
from your toolchain

and then retry in order to see what happen with find_package(OpenSSL)
proper setting of

CMAKE_FIND_ROOT_PATH* should makes it possible for FindOpenSSL to find
the lib.

By the way, which version of CMake are you using?
-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

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