I ended up writing a macro to find libsqlite3 with this: 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() After I execute my macro: FindSQLite3() if(SQLITE3_FOUND) target_link_libraries(${Target} ${SQLITE3_LIBRARIES}) endif() 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. From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of Frankie Chan Sent: May-31-13 10:44 AM To: cmake@cmake.org Subject: [CMake] Help including dylib into cmake build for xcode Hi, I am trying to build an xcode project using cmake, but I am having some problems including dylib (libsqlite3.dylib). Was using: target_link_libraries(${Target} libsqlite3.dylib) but i think i am going about it the wrong way. Any help would be appreciated
-- 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