[Piglit] [PATCH] cmake: Create option to build GL targets in top build root

Chad Versace chad at chad-versace.us
Mon Jul 18 11:48:48 PDT 2011

The build root for GL (that is, non-GLES2) targets was moved from
$piglit_BINARY_DIR/tests to $piglit_BINARY_DIR/target_api/gl/tests by
    commit fc493b486b8f9b85af05eb854f04bb581b94250f
    cmake: Prepare CMake for GL and GLES2 builds

This commit defines a CMake cache variable,
piglit_GL_BUILD_ROOT_IS_TOP_BUILD_ROOT, that restores the GL build root to
its original location. The variable's default value is false.

To set the variable, delete the CMake cache re-invoke CMake as below:
    rm CMakeCache.txt
    cmake -Dpiglit_GL_BUILD_ROOT_IS_TOP_BUILD_ROOT=1 ...

CC: Eric Anholt <eric at anholt.net>
Signed-off-by: Chad Versace <chad at chad-versace.us>
 CMakeLists.txt                     |    4 ++++
 cmake/target_api/gl/CMakeLists.txt |   11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1015165..481d5be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${piglit_BINARY_DIR}/bin)
+    CACHE bool "Build GL (that is, non-GLES2) targets in top build root instead of target_api/gl"
+   )
 check_function_exists(strchrnul HAVE_STRCHRNUL)
 check_function_exists(fopen_s   HAVE_FOPEN_S)
diff --git a/cmake/target_api/gl/CMakeLists.txt b/cmake/target_api/gl/CMakeLists.txt
index 506bb93..767ab42 100644
--- a/cmake/target_api/gl/CMakeLists.txt
+++ b/cmake/target_api/gl/CMakeLists.txt
@@ -3,6 +3,15 @@ add_definitions(
+	set(piglit_GL_BUILD_ROOT ${piglit_BINARY_DIR}/tests)
+	set(piglit_GL_BUILD_ROOT ${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests)
+message(STATUS "GL targets will be built in ${piglit_GL_BUILD_ROOT}")
-	${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests
+	${piglit_GL_BUILD_ROOT}

More information about the Piglit mailing list