[CMake] Adding to rpath through cmake

2010-04-25 Thread Michael Darling
Hi,

I've been trying to figure out how to append another directory to the -rpath
sent to the linker through cmake.

I have a yum-installed version of stdlibs in /usr/lib64, and a svn source
built one in /usr/local/lib64.  I need the newer version for software that
I'm developing, but would like to have everything else on the system run the
version in /usr/lib64 because it's the version everything's expecting, and
it's an actual release version rather than an svn build.

The /usr/lib64 and /usr/local/lib64 versions are both .so.6, so ldconfig
shouldn't be able to help me out.

I'm using export ld_library_path=/usr/local/lib64 as a workaround when
running my applications at the moment, but don't want that to be
automatically set because it will impact other programs.


I've looked at add_library_path, cmake_skip_build_rpath,
cmake_build_with_install_rpath, cmake_install_rpath,
cmake_install_rpath_use_link_path, and cmake_system_library_path, none of
which seem to work or be what I need.


So, whether adding to -rpath is what I need to do or not, is there a way
with cmake that I can specify which stdlibs my applications are being
statically linked against?

Thanks!

Mike
___
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] Package found - passing _INCLUDE_DIRS to include_directories() and _LIBRARIES to target_link_libraries()

2014-07-18 Thread Michael Darling
http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries#How_package_finding_works

seems to indicate if _FOUND is found, the
_INCLUDE_DIRS is passed to the include_directories() command,
and _LIBRARIES is passed to target_link_libraries()

Why is the reduced-case code below calling g++ without including
"-I~/codeTestPackages/lib", causing a "app/app.cpp:1:17: fatal error:
lib.h: No such file or directory" ?

I'm on CMake v3.0.0.  Also tried CMake v3.0.20140718-g36a81 (git source.)

All the source is below, and attached as a .tar.gz.


*### CMakeLists.txt ###*

cmake_minimum_required(VERSION 3.0)
project(codeTestPackages)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ~/codeTestPackages/findModules)
add_subdirectory(lib)
add_subdirectory(app)

*### findModules/Findlib.cmake ###*

IF(NOT lib_FOUND)
   set(lib_FOUND "yes")
   message("lib_FOUND is ${lib_FOUND}")
   set(lib_INCLUDE_DIRS ~/codeTestPackages/lib)
   set(lib_LIBRARIES lib)
ENDIF(NOT lib_FOUND)

*### lib/CMakeListst.txt ###*

include_directories(~/codeTestPackages/lib)
add_library(lib lib.cpp)

*### lib/lib.h ###*

#ifndef __LIB__
#define __LIB__
namespace LIB {
unsigned long libFunc(unsigned long inValue);
}
#endif

*### lib/lib.cpp ###*

#include 
namespace LIB {
unsigned long libFunc(unsigned long inValue) {
   return inValue+1;
}
}

*### app/CMakeLists.txt ###*

find_package(lib REQUIRED)
add_executable(app app.cpp)

*### app/app.cpp ###*

#include 
using namespace LIB;

int main() {
   unsigned long x = 1;
   unsigned long y = libFunc(x);
}


codeTestPackages.tar.gz
Description: GNU Zip compressed data
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Package found - passing _INCLUDE_DIRS to include_directories() and _LIBRARIES to target_link_libraries()

2014-07-19 Thread Michael Darling
I definitely want the automatic include directory adding, and also
automatic target_link_library adding.

I'm totally confused when I'd want to use an import target, and when I'd
want to use an interface target, and what a good definition is for each.  I
see interface libraries state: "A primary use-case for interface libraries
is header-only libraries", and "an interface target has no location and is
mutable, but is otherwise similar to an imported target."  My libraries
have separate implementation and are not header-only libraries.  But, it
says "primary use-case" not "only for header-only libraries".

And, what's a clear definition for the difference between an import or
interface target, vs a standard statically linked library?

If it isn't too much trouble or many changes, would anyone be willing to
change the attached example to the appropriate new type of target, so the
include directories and target_link_libraries automatically propegate?  I'm
just looking to get to the point where they compile in place - not worried
about the install parts.  I think I'm getting lost without being able to
find a reduced case whole example of both the library and the applications
using it.

On Fri, Jul 18, 2014 at 11:19 PM, Walter Gray  wrote:

>  Unless I'm mistaken, it says that the *CONVENTION* is to call
> include_directories(${_INCLUDE_DIRS}) manually, not that it
> is done automatically.  To get that kind of automatic include directory
> adding you need to have an import or interface target with
> INTERFACE_INCLUDE_DIRECTORIES defined by the find module, then link with
> that.  Take a look at topics related to Interface Libraries [1] and writing
> modern find modules [2]
>
> [1]
> http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#interface-libraries
> [2]
> http://www.cmake.org/cmake/help/v3.0/manual/cmake-developer.7.html#find-modules
>
>
> On 7/18/2014 7:31 PM, Michael Darling wrote:
>
>
> http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries#How_package_finding_works
>
>  seems to indicate if _FOUND is found, the
> _INCLUDE_DIRS is passed to the include_directories() command,
> and _LIBRARIES is passed to target_link_libraries()
>
>  Why is the reduced-case code below calling g++ without including
> "-I~/codeTestPackages/lib", causing a "app/app.cpp:1:17: fatal error:
> lib.h: No such file or directory" ?
>
>  I'm on CMake v3.0.0.  Also tried CMake v3.0.20140718-g36a81 (git source.)
>
>  All the source is below, and attached as a .tar.gz.
>
>
>  *### CMakeLists.txt ###*
>
>  cmake_minimum_required(VERSION 3.0)
> project(codeTestPackages)
> set(CMAKE_VERBOSE_MAKEFILE on)
>  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
> ~/codeTestPackages/findModules)
>  add_subdirectory(lib)
>  add_subdirectory(app)
>
>  *### findModules/Findlib.cmake ###*
>
>  IF(NOT lib_FOUND)
>set(lib_FOUND "yes")
>message("lib_FOUND is ${lib_FOUND}")
>set(lib_INCLUDE_DIRS ~/codeTestPackages/lib)
>set(lib_LIBRARIES lib)
> ENDIF(NOT lib_FOUND)
>
>  *### lib/CMakeListst.txt ###*
>
>  include_directories(~/codeTestPackages/lib)
> add_library(lib lib.cpp)
>
>  *### lib/lib.h ###*
>
>  #ifndef __LIB__
> #define __LIB__
> namespace LIB {
>  unsigned long libFunc(unsigned long inValue);
>  }
>  #endif
>
>  *### lib/lib.cpp ###*
>
>  #include 
> namespace LIB {
>  unsigned long libFunc(unsigned long inValue) {
> return inValue+1;
> }
> }
>
>  *### app/CMakeLists.txt ###*
>
>  find_package(lib REQUIRED)
> add_executable(app app.cpp)
>
>  *### app/app.cpp ###*
>
>  #include 
> using namespace LIB;
>
>  int main() {
>unsigned long x = 1;
>unsigned long y = libFunc(x);
> }
>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake