Skip to content

Commit

Permalink
Resolve dependency issue building eLut.h/toFloat.h with CMake/Ninja.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Potter committed Nov 5, 2014
1 parent f4a6d3b commit 8eed701
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions IlmBase/Half/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# yue.nicholas@gmail.com

ADD_EXECUTABLE ( eLut eLut.cpp )

ADD_CUSTOM_COMMAND (
TARGET eLut POST_BUILD
COMMAND eLut > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/eLut.h
COMMAND eLut ARGS > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h
DEPENDS eLut
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
)
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_CURRENT_BINARY_DIR}/eLut.h
PROPERTIES HEADER_FILE_ONLY TRUE
)

ADD_EXECUTABLE ( toFloat toFloat.cpp )
ADD_CUSTOM_COMMAND (
TARGET toFloat POST_BUILD
COMMAND toFloat > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
COMMAND toFloat ARGS > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
DEPENDS toFloat
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
)
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
PROPERTIES HEADER_FILE_ONLY TRUE
Expand All @@ -27,9 +28,7 @@ SET_SOURCE_FILES_PROPERTIES(
half.cpp
PROPERTIES
OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/eLut.h
OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/toFloat.h
"${CMAKE_CURRENT_BINARY_DIR}/eLut.h;${CMAKE_CURRENT_BINARY_DIR}/toFloat.h"
)

IF(BUILD_SHARED_LIBS)
Expand Down

0 comments on commit 8eed701

Please sign in to comment.