[CMake] How to generate a STATIC Library using ExternalProject_Add

Marshall, Rob robm at qti.qualcomm.com
Wed Oct 31 12:39:06 EDT 2012


I am not sure if the link worked correctly because the websocketpp symbols seem to be missing. When MyApp is linking in boost and websocketpp


Linking CXX executable MyApp
../../lib/MyServer/libMyServer.a(MyServerWebsocketServer.cpp.o): In function `boost::shared_ptr<websocketpp::message::control>::operator->() const':
/MyDev/My/MyAbc/ThirdParty/websocketpp/include/connection.hpp:306: undefined reference to `websocketpp::message::data::set_payload(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
../../lib/MyServer/libMyServer.a(MyServerWebsocketServer.cpp.o): In function `websocketpp::role::server<websocketpp::endpoint<websocketpp::role::server, websocketpp::socket::plain, websocketpp::log::logger> >::connection<websocketpp::connection<websocketpp::endpoint<websocketpp::role::server, websocketpp::socket::plain, websocketpp::log::logger>, websocketpp::role::server<websocketpp::endpoint<websocketpp::role::server, websocketpp::socket::plain, websocketpp::log::logger> >::connection, websocketpp::socket::plain<websocketpp::endpoint<websocketpp::role::server, websocketpp::socket::plain, websocketpp::log::logger> >::connection> >::handle_read_request(boost::system::error_code const&, unsigned long)':

________________________________________
From: David Cole [david.cole at kitware.com]
Sent: Wednesday, October 31, 2012 9:12 AM
To: Marshall, Rob
Cc: cmake at cmake.org
Subject: Re: [CMake] How to generate a STATIC Library using ExternalProject_Add

Use the full path to the file libwebsocketpp.a in your
target_link_libraries call instead of "websocketpp"

HTH,
David


On Wed, Oct 31, 2012 at 11:51 AM, Marshall, Rob <robm at qti.qualcomm.com> wrote:
> Hi,
>
>
>
> I am using ExternalProject_Add to build websocketpp.
>
> The build is successful and libwebsocketpp.a is generated.
>
> But it appears to be generated as a “UTILITY” rather than a “STATIC”.
>
>
>
> How can I configure ExternalProject_Add to build websocketapp as “STATIC”?
>
>
>
> When I try and link in websocketpp with MyApp an error occurs:
>
>
>
> CMake Error at CMake/CMakeMacros.cmake:434 (target_link_libraries):
>
>   Target "websocketpp" of type UTILITY may not be linked into another
> target.
>
>   One may link only to STATIC or SHARED libraries, or to executables with
> the
>
>   ENABLE_EXPORTS property set.
>
> Call Stack (most recent call first):
>
>   /app/MyApp/CMakeLists.txt:25 (my_link_libraries)
>
>
>
> Thanks,
>
> Rob
>
>
> --
>
> 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


More information about the CMake mailing list