[CMake] xmlsec1 with cmake problem

Dmitrii Golub dmitrii.golub at gmail.com
Tue Nov 24 04:50:00 EST 2015


I found answer to this question, just forgot to
target_link_libraries(libcft -L/usr/local/lib)

2015-11-24 2:38 GMT+03:00 Dmitrii Golub <dmitrii.golub at gmail.com>:

> Hello,
>
> 2 folders:
> src/bin/cft.c  <- cft target
> src/cft/signature.c and src/cft/ssl.c <- libcft target
>
> So libcft target:
>
> pkg_search_module(XMLSEC REQUIRED xmlsec1)
> include_directories(${XMLSEC_INCLUDE_DIRS})
>
> add_library(libcft signature.c ssl.c)
> target_link_libraries(libcft ${XMLSEC_LIBRARIES})
> target_compile_definitions(libcft PUBLIC ${XMLSEC_CFLAGS_OTHER})
>
> Not cft target version 1:
> add_executable(cft cft.c)
> target_link_libraries(cft libcft)
>
>
> I have to say, that XMLSEC_CFLAGS_OTHER is bunch of definitions:
> -DXMLSEC_CRYPTO=\"openssl\" -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1
> -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1
> -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1
>
> With cft target version 1 cmake doesnt use this definitions, So I got
> error:
>
> Linking C executable ../../bin/cft
> cd /mili/cp-proxy/src/bin && /usr/bin/cmake -E cmake_link_script
> CMakeFiles/cft.dir/link.txt --verbose=1
> /usr/bin/cc     CMakeFiles/cft.dir/cft.c.o  -o ../../bin/cft -rdynamic
> ../cft/liblibcft.a -lcurl -lxmlsec1 -lltdl -lxslt -lxml2 -lssl -lcrypto
> /usr/local/lib/libxmlsec1.so ../lib/libBASE64.a -Wl,-rpath,/usr/local/lib
> ../cft/liblibcft.a(signature.c.o): In function `cft_utils_init':
> signature.c:(.text+0xac1): undefined reference to
> `xmlSecCryptoDLLoadLibrary'
>
> So here come cft target version 2:
>
> pkg_search_module(XMLSEC REQUIRED xmlsec1)
> add_executable(cft cft.c)
> target_compile_definitions(cft PUBLIC ${XMLSEC_CFLAGS_OTHER}) <-- main
> line here
> target_link_libraries(cft libcft)
>
> Again:
>
> Linking C executable ../../bin/cft
> cd /mili/cp-proxy/src/bin && /usr/bin/cmake -E cmake_link_script
> CMakeFiles/cft.dir/link.txt --verbose=1
> /usr/bin/cc     CMakeFiles/cft.dir/cft.c.o  -o ../../bin/cft -rdynamic
> ../cft/liblibcft.a -lcurl -lxmlsec1 -lltdl -lxslt -lxml2 -lssl -lcrypto
> /usr/local/lib/libxmlsec1.so ../lib/libBASE64.a -Wl,-rpath,/usr/local/lib
> ../cft/liblibcft.a(signature.c.o): In function `cft_utils_init':
> signature.c:(.text+0xac1): undefined reference to
> `xmlSecCryptoDLLoadLibrary'
>
> cft version 3
> I tried to add add_definition by hand, but no succes, cmake doesn't use
> these definitions for cft target.
>
> Any ideas how to compile that with xmlsec definitions?
>
> Thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151124/7821334e/attachment.html>


More information about the CMake mailing list