[CMake] MSVC7.1 static link question
Micha Renner
Micha.Renner at t-online.de
Thu Feb 12 03:15:06 EST 2009
> I do not plan to allow target_link_libraries for this. One must use
> IMPORTED_LINK_INTERFACE_LIBRARIES. However, it is easier than your
> example makes it because the property can name other imported targets:
>
> add_library(baz STATIC IMPORTED)
> set_target_properties(baz PROPERTIES
> IMPORTED_LOCATION_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/libbaz.a
> IMPORTED_LOCATION_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/libbazd.a)
>
> add_library(bar STATIC IMPORTED)
> set_target_properties(bar PROPERTIES
> IMPORTED_LOCATION_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/libbar.a
> IMPORTED_LOCATION_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/libbard.a
> IMPORTED_LINK_INTERFACE_LIBRARIES baz) # <-- dependency is here
>
> Note if the outside project is also created by CMake, the install(EXPORT)
> feature can generate the proper import code for it.
>
> -Brad
So, the dependency of libraries is now clear, even for me.
But what about the dependency library - program.
In the following example, I think, there is something missing.
FIND_PACKAGE(LOCAL_TIFF REQUIRED)
ADD_LIBRARY(_tiff SHARED IMPORTED)
SET_PROPERTY(TARGET _tiff PROPERTY IMPORTED_LOCATION ${TIFF_LIBRARY})
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
# Source files
SET(_src ascii_tag.c)
ADD_EXECUTABLE(ascii_tag ${_src})
TARGET_LINK_LIBRARIES(ascii_tag _tiff)
- Michael
# --------------------
More information about the CMake
mailing list