Q:

Statically Linking Lua in Cmake

I have a project that uses GLFW, GLEW, GLM, and Lua.  Previously I was using a Makefile on my Linux environment which linked the libraries, some static, some dynamic. 
Based on this boilerplate project I can compile and link GLFW, GLEW, and GLM to my project with Cmake.  However I am having trouble with linking lua which previously just required "-llua" on Linux.  
I can build lua just fine with Cmake and when building my project it does print out that liblua was built however soon after it complains about missing luaconf.h.  Probably because it doesn't exist, luaconf.h.in exists and the following line from the lua CMakeLists.txt seems to generate luaconf.h:
configure_file ( src/luaconf.h.in ${CMAKE_CURRENT_BINARY_DIR}/luaconf.h )

What's the cleanest way to deal with this?  I can think of some hacky ways but I'm wondering if there's something within CMake that can handle it or if someone else has experience linking lua in this way with CMake. 
This is my CMakeLists.txt, I would post the lua one too but I don't have enough rep. 

A:

I finally got it to work (some other errors were getting in the way). 
The aforementioned line copies the generated luaconf.h file to the binary directory, now instead I just copy it to the source directory:
configure_file ( src/luaconf.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/luaconf.h )

