fixed building in directories other than the package root

This commit is contained in:
Nicholas O'Connor 2017-03-23 18:22:09 -07:00
parent 5278b5d98b
commit 8b2cb4ceba

View File

@ -29,20 +29,21 @@ http://tclap.sourceforge.net and put the headers in ./include
endif(NOT TCLAP_FOUND)
include_directories(include)
set(src "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(src "${CMAKE_SOURCE_DIR}/src")
set(coggedfiles)
file(GLOB_RECURSE cogfiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cog")
file(GLOB_RECURSE cogfiles RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/*.cog")
foreach(cogfile ${cogfiles})
string(REGEX REPLACE ".cog\$" "" outfile "${cogfile}")
set(thisfile "${CMAKE_CURRENT_SOURCE_DIR}/${outfile}")
set(thisfile "${CMAKE_SOURCE_DIR}/${outfile}")
add_custom_command(OUTPUT "${thisfile}" PRE_BUILD
COMMAND ${PYTHON_EXECUTABLE} -m cogapp -d -o "${outfile}" "${cogfile}"
DEPENDS ${cogfile}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Greasing the cog for ${thisfile}")
set(coggedfiles ${coggedfiles} "${thisfile}")