[CMake] works when I build using XCode, but not with CMake makefile
Cotton Candy
cottoncandycoder at gmail.com
Tue Sep 6 14:12:52 EDT 2016
Peter,
In XCode I have this list of "settings" that includes
"Other Linker Flags" that I have set to "-lmysqlclient -lpthread -lm -lz"
and
"Other C++ Flags" that I have set to "-L/Applications/MAMP/Library/lib
-lmysqlclient -lpthread -lz"
Maybe these explain why things work when I build with XCode, but not with
CMake.
In my CMakeLists.txt file I included:
set( CMAKE_CXX_FLAGS "-L/Applications/MAMP/Library/lib -lmysqlclient
-lpthread -lz" )
set( CMAKE_EXE_LINKER_FLAGS "-lmysqlclient -lpthread -lm -lz" )
but when I run the make it always says it is ignoring these (e.g. "warning:
argument unused during compilation: '-L/Applications/MAMP/Library/lib'").
Thanks again for you help.
Aaron
On Tue, Sep 6, 2016 at 2:20 PM, Peter Steinbach <steinbach at scionics.de>
wrote:
> Aaron,
>
> it's about the way that you compile your binary and link libmysqlclient
> into it. I guess (@all: please correct me if I am wrong) as I don't know
> how you use cmake to build your libraries/binaries, that you don't set the
> rpath of libmysqlclient inside your binary. Doing so will ensure that the
> absolute path of libmysqlclient is stored into your binary, so that the
> runtime environment can pick it up and use (keeping fingers crossed that
> the path is still valid). The alternative to doing so, is linking against
> the static version of libmysqlclient (which comes at a cost on another
> front as well).
>
> Best,
> P
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160906/bae44201/attachment.html>
More information about the CMake
mailing list