2011/9/30 gaurav chetal <[email protected]>:
Hi,
Please do not drop he mailing list address.

> My CMake version is 2.8..Its on linux yes!!!..But still if i dnt want to go
> into the complexity (because m nt understanding the concept of RPath dat
> easily) then what can i do so that my program gets executed!!!!

I thought it would be useful to understand why you program fail before going on.
But the short answer is use FULL RPATH:

i.e. copy paste this into your CMakeLists.txt:

>>>>>>>>>>>>
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
>>>>>>>>>>>>>>>>>>>

Now if you really don't want to understand how dynamic libraries works
(Even if it is nicely explained here:
http://www.cmake.org/Wiki/CMake_RPATH_handling)
you may build you programs with static libraries.

try
SET(BUILD_SHARED_LIBS OFF)

or use STATIC keyword in your add_library statements.

Now if I may add something more, my personal experience makes me think that

Not wanting to know how it works usually
drives you to not understanding how it fails as well.

Both situations may be ok but I think it worth noting that they
usually come together.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.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

Reply via email to