[CMake] CMake and include only libraries
Theodore Papadopoulo
Theodore.Papadopoulo at inria.fr
Mon Apr 4 13:30:21 EDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm trying to use cmake to install a include only library.
I'd like to use the export feature as described in
http://www.itk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
and I found the idea of using
set_target_properties(foo PROPERTIES PUBLIC_HEADER
"foo.h;${CMAKE_CURRENT_BINARY_DIR}/config.h")
nice. But in my case, I do not have any library to build...
All my attempts to create custom targets or library targets with only
headers fail.... So I'm left with using install(FILES ...) and forget
this export idea unless someone knows a trick...
Here is a sketch of my CMakelists.txt
SET(Utils_HEADERS ...)
INCLUDE(TestBigEndian)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/Utils/config.h.in config.h
@ONLY)
SET(HEADERS)
FOREACH(file ${Utils_HEADERS})
SET(HEADERS "${HEADERS};${CMAKE_CURRENT_SOURCE_DIR}/Utils/${file}")
ENDFOREACH()
# Those do not work
#ADD_LIBRARY(UtilsIncludes SHARED ${HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/Utils/config.h)
#ADD_CUSTOM_TARGET(UtilsIncludes All DEPENDS ${HEADERS}
#${CMAKE_CURRENT_SOURCE_DIR}/Utils/config.h.in)
SET_TARGET_PROPERTIES(UtilsIncludes PROPERTIES
PUBLIC_HEADER
"${HEADERS};${CMAKE_CURRENT_BINARY_DIR}/config.h")
INSTALL(TARGETS UtilsIncludes EXPORT UtilsLibraryDepends
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/Odyssee++ COMPONENT dev)
Thank's in advance for any hint.
All the best.
Theo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk2aACwACgkQEr8WrU8nPV26oACffQ/s60ci9cEZVaZdlADqiPv5
4ssAnRHQuRUunyyAKFaiNYw5DN7WPIZv
=wxuj
-----END PGP SIGNATURE-----
More information about the CMake
mailing list