Reputation: 506
I am trying to compile my application using CMake, and I need to compile Lua with it for various reasons. My current setup is as follows:
project/
CMakeLists.txt
...
libs/
CMakeLists.txt
...
lua/
CMakeLists.txt
...
I am using LuaDist as it already provides a CMake build system for lua. The problem comes when I try to include lua.h
from my project, as it requires luaconfig.h
which is generated by the Lua subproject and output to its binary directory, not source directory.
In my main project I do something like this:
include_directories(libs/lua/src/ etc...)
How can I also include generated files from subprojects in my main project?
Upvotes: 1
Views: 512
Reputation: 14250
If you're including lua directly via an add_subdirectory
call, you can also use include_directories(${lua_BINARY_DIR})
(assuming there's a project(lua)
command in lua's CMakeLists.txt file). The name of the variable may be something else if the project command is different, or you may need multiple additional include_directories, depending on where the header files you need are ... but this should get you started.
Upvotes: 3