You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would certainly appreciate some better (or simpler) guidance on how to use CMake to link an external library (on an arbitrary path) with a min project.
I don't understand CMake, and trying to link my project to an arbitrary .lib file already compiled from a solution is doing my head in. I have managed the include file, but getting the subsequent project to link has proved impossible.
For now, how I'd do it something like this in your external's CMakeLists.txt. I haven't tested this exact set up, but I've done it similarly to this in the past.
cmake_minimum_required(VERSION 3.0)
set(C74_MIN_API_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../min-api)
include(${C74_MIN_API_DIR}/script/min-pretarget.cmake)
include_directories(
"${C74_INCLUDES}"
)
set( SOURCE_FILES
${PROJECT_NAME}.cpp
)
add_library(
${PROJECT_NAME}
MODULE
${SOURCE_FILES}
)
# ====== see this section
# /
# v
if (MSVC)
# include any headers needed by your library that's kept at <repository root>/libs/include,
# and you can change for your situation
include_directories("${CMAKE_SOURCE_DIR}/libs/include")
# this links to a library that's kept at <repository root>/libs/foo.lib, and you can change for your situation
target_link_libraries(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/libs/foo.lib")
endif()
include(${C74_MIN_API_DIR}/script/min-posttarget.cmake)
Originally posted by @scblakely in #204 (comment)
The text was updated successfully, but these errors were encountered: