From 8b2cb4cebabfc44ca513c405d3079bef7ae59a61 Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Thu, 23 Mar 2017 18:22:09 -0700 Subject: [PATCH] fixed building in directories other than the package root --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ab8901..05c830c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}")