wdas / ptex

Per-Face Texture Mapping for Production Rendering https://wdas.github.io/ptex

Home Page:https://www.disneyanimation.com/open-source/ptex/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Override of CMAKE_BUILD_TYPE based on $FLAVOR is problematic

mmp opened this issue · comments

The top-level CMakeLists.txt file has:

if ("$ENV{FLAVOR}" MATCHES "debug")
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "type of build" FORCE)
else ()
    set(CMAKE_BUILD_TYPE "Release" CACHE STRING "type of build" FORCE)
endif ()

The problem with this is that if one is building a larger project that has ptex as a submodule, then if one runs cmake -DCMAKE_BUILD_TYPE=Debug ... at the top level, then the debug setting for the entire project is overridden by the explicit override of CMAKE_BUILD_TYPE in ptex's CMakeLists.txt.

In general, I'd suggest not overriding CMAKE_BUILD_TYPE at all. As an alternative, what about changing that else() to something like:

elseif ("$ENV{FLAVOR}" MATCHES "release")

so that if FLAVOR isn't set at all, then no override of CMAKE_BUILD_TYPE is done?