[CMake] Compile CMakeCache.txt into shared library

2012-02-08 Thread Hänel Nikolaus Valentin
Dear Cmake List,

we would like to include a CmakeCache.txt file into our shared
library. The reason is, that we would like to know what CMake options
were used when compiling the library in case we have only the binary.

Has anyone done something like this before and can give me some
pointers?

Thanks for any advice

Valentin

Note: I am not subscribed to this list, so pleae cc me in your response.

-- 
Valentin Hänel
Scientific Software Developer
Blue Brain Project http://bluebrain.epfl.ch/
--

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] Compile CMakeCache.txt into shared library

2012-02-08 Thread Hänel Nikolaus Valentin
Dear Cmake List,

we would like to include a CmakeCache.txt file into our shared
library. The reason is, that we would like to know what CMake options
were used when compiling the library in case we have only the binary.

Has anyone done something like this before and can give me some
pointers?

Thanks for any advice

Valentin

--
Valentin Hänel
Scientific Software Developer
Blue Brain Project http://bluebrain.epfl.ch/
--

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] Compile CMakeCache.txt into shared library

2012-02-08 Thread Johannes Zarl
Hi,

I'm not sure if I understand you correctly, but I would guess that in most 
cases you don't need to know _all_ cmake cache variables at runtime.

If you really just need to know some specific variables, you would be much 
better off using a generated header file. See the documentation for 
configure_file 
for details on this.

In short, you'd make a headerfile config.h.in with lines like this:
#cmakedefine @my_magic_variable@

And in cmakeLists:
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
   ${CMAKE_CURRENT_BINARY_DIR}/config.h )

Afterwards, you can include config.h in your shared library and you can use the 
value there...

HTH,
  Johannes


On Wednesday 08 February 2012, 14:34:00, Hänel Nikolaus Valentin wrote:
 Dear Cmake List,
 
 we would like to include a CmakeCache.txt file into our shared
 library. The reason is, that we would like to know what CMake options
 were used when compiling the library in case we have only the binary.
 
 Has anyone done something like this before and can give me some
 pointers?
 
 Thanks for any advice
 
 Valentin
 
--

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] Compile CMakeCache.txt into shared library

2012-02-08 Thread Hänel Nikolaus Valentin
* Johannes Zarl johannes.z...@jku.at [120208]:
 Hi,
 
 I'm not sure if I understand you correctly, but I would guess that in most 
 cases you don't need to know _all_ cmake cache variables at runtime.
 
 If you really just need to know some specific variables, you would be much 
 better off using a generated header file. See the documentation for 
 configure_file 
 for details on this.
 
 In short, you'd make a headerfile config.h.in with lines like this:
 #cmakedefine @my_magic_variable@
 
 And in cmakeLists:
 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h )
 
 Afterwards, you can include config.h in your shared library and you can use 
 the 
 value there...

Ah, yes. Thats great! Thanks!

V-
--

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