0

I'm preparing windows build for my qt5 application and I have problem with loading static library .lib. My application is using 3d engine and originally was build on linux (gcc+cmake), now on windows I'm trying to use msvc+cmake. 3d engine static lib is called engined.lib. To load library I do something like that:

SET(CMAKE_FIND_LIBRARY_PREFIXES "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
find_library(engine NAMES engined PATHS path_to_lib)
target_link_libraries(${PROJECT_NAME}
    Qt5::Widgets
    Qt5::OpenGL
    Qt5::Xml
    engine)

But during process compilation there are erros for example in my cpp file I'm loading headers:

#include "engine/Engine.h"

but, msvc do not see .h file and I have error. I'm doing something wrong?

1 Answer 1

1

You are linking against the library, but you still need to configure CMake so that the engine's headers are found. One way to do this is to set the location of the headers through a cache variable:

# CMakeLists.txt
set(ENGINE_INCLUDE_DIR "" CACHE PATH "Include directory")
target_include_directories(engine PRIVATE ${ENGINE_INCLUDE_DIR})

And set the variable when configuring your build directory:

cmake -DENGINE_INCLUDE_DIR=/path/to/include/dir /path/to/project
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.