[CMake] cmake as pkg-config replacement has problems?
Hendrik Sattler
post at hendrik-sattler.de
Sat Jun 16 13:25:02 EDT 2012
Hi,
I try the following commands with my projects config file. It is not installed
but the build tree is registered with export(TARGET).
$ cmake -DNAME=OpenObex -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE --find-package
-I/home/hendrik/projects/obex/openobex/repository/include
$ cmake -DNAME=OpenObex -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK --find-package
-rdynamic lib/libopenobex.so.1.6 -Wl,-rpath,/home/hendrik/projects/obex/openobex/repository/build/lib
I think the latter is missing the complete path to the library or alternatively
a -L entry.
Am I doing something wrong or is this a cmake bug.
The used cmake version is 2.8.8 from Debian testing.
The files look like this:
openobex-config.cmake:
get_filename_component(OpenObex_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if (EXISTS "${OpenObex_CMAKE_DIR}/lib/openobex-build.cmake")
#in build tree
include(${OpenObex_CMAKE_DIR}/lib/openobex-build.cmake)
include(${OpenObex_CMAKE_DIR}/lib/openobex-build-settings.cmake)
set(OpenObex_INCLUDE_DIRS ${OpenObex_SOURCE_DIR}/include)
else ()
#in installed tree
include(${OpenObex_CMAKE_DIR}/openobex-target.cmake)
set(OpenObex_CMAKE_REL_INCLUDE_DIR "../../../include")
get_filename_component(OpenObex_ABS_INCLUDE_DIR
"${OpenObex_CMAKE_DIR}/${OpenObex_CMAKE_REL_INCLUDE_DIR}" ABSOLUTE)
set(OpenObex_INCLUDE_DIRS "${OpenObex_ABS_INCLUDE_DIR}")
endif()
set(OpenObex_LIBRARIES openobex)
lib/openobex-build.cmake:
# Generated by CMake 2.8.8
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
MESSAGE(FATAL_ERROR "CMake >= 2.6.0 required")
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
CMAKE_POLICY(PUSH)
CMAKE_POLICY(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
SET(CMAKE_IMPORT_FILE_VERSION 1)
# Create imported target openobex
ADD_LIBRARY(openobex SHARED IMPORTED)
# Import target "openobex" for configuration "Debug"
SET_PROPERTY(TARGET openobex APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
SET_TARGET_PROPERTIES(openobex PROPERTIES
IMPORTED_LOCATION_DEBUG "/home/hendrik/projects/obex/openobex/repository/build/lib/libopenobex.so.1.6"
IMPORTED_SONAME_DEBUG "libopenobex.so.2"
)
# Commands beyond this point should not need to know the version.
SET(CMAKE_IMPORT_FILE_VERSION)
CMAKE_POLICY(POP)
lib/openobex-build-settings.cmake:
set(OpenObex_SOURCE_DIR "/home/hendrik/projects/obex/openobex/repository")
HS
More information about the CMake
mailing list