[CMake] Help including dylib into cmake build for xcode
Frankie Chan
frankie.chan at ubisoft.com
Mon Jun 3 10:49:25 EDT 2013
It looks like i got it to work, you were right on the target being empty. Thx!
-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Frankie Chan
Sent: June-03-13 10:23 AM
To: Andreas Mohr; cmake at cmake.org
Subject: Re: [CMake] Help including dylib into cmake build for xcode
Maybe this will clear up what i was trying to do and how i got to that error.
Basically i was trying to use this macro to search for sqlite3:
macro (FindSQLite3)
# Look for the library.
# find_path(SQLITE3_INCLUDE_DIR NAMES libsqlite3)
find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h)
find_library(SQLITE3_LIBRARY NAMES libsqlite3)
# Handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
# Copy the results to the output variables.
if (SQLITE3_FOUND)
set (SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
set (SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
message(SQLite3 Found ${SQLITE3_INCLUDE_DIRS} ${SQLITE3_LIBRARY})
else (SQLITE3_FOUND)
set (SQLITE3_LIBRARIES)
set (SQLITE3_INCLUDE_DIRS)
message(SQLite3 not Found)
endif (SQLITE3_FOUND)
mark_as_advanced (SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)
endmacro()
But like you mention before perhaps my target is empty..
-----Original Message-----
From: Andreas Mohr [mailto:andi at lisas.de]
Sent: June-01-13 2:35 PM
To: cmake at cmake.org
Cc: Frankie Chan
Subject: Re: Help including dylib into cmake build for xcode
Hi,
On Sat, Jun 01, 2013 at 12:00:04PM -0400, cmake-request at cmake.org wrote:
> Date: Fri, 31 May 2013 15:12:10 -0400
> From: Frankie Chan <frankie.chan at ubisoft.com>
Ah, I just realized that I failed to reply to the most current mail ;)
> I get the following error, i am kinda stumped right now since I am not exactly sure if this is the right approach in linking my project.
>
> Cannot specify link libraries for target "/usr/lib/libsqlite3.dylib" which
> is not built by this project.
>
> CMake does not support this but it used to work accidentally and is being
> allowed for compatibility.
>
> Policy CMP0016 is not set: target_link_libraries() reports error if only
> argument is not a target. Run "cmake --help-policy CMP0016" for policy
> details. Use the cmake_policy command to set the policy and suppress this
> warning.
> This warning is for project developers. Use -Wno-dev to suppress it.
This can mean (with deadly precision) nothing other than ${Target} having ended up as an empty expression, thus the sqlite3 argument
(/usr/lib/libsqlite3.dylib) ends up being the *first* argument of the call which is supposed to be the candidate target instead.
IOW, FUBAR.
Perhaps ${Target} variable has a case sensitivity issue? Scope issue? (perhaps some outer scope defined it yet now we're in a foreign unrelated scope?
Different directory, different function, ...).
Anyway, always use
message(FATAL_ERROR "exact_same_cmake_line_content_as_executed")
(or, IOW,
message(FATAL_ERROR "target_link_libraries(${Target} ${SQLITE3_LIBRARIES})")
)
whenever needing to analyze why things fail.
Andreas Mohr
--
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