From 34bd28e8c6e9ce5e7bfa703be3635d39a4e726f9 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 15 Apr 2014 10:44:03 +0100 Subject: [PATCH] cmake: Don't build tests when not testing --- glm/CMakeLists.txt | 12 +++++++----- test/CMakeLists.txt | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt index 79a46074..9dbe11ca 100644 --- a/glm/CMakeLists.txt +++ b/glm/CMakeLists.txt @@ -30,11 +30,13 @@ source_group("GTX Files" FILES ${GTX_HEADER}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) -add_executable(${NAME} ${ROOT_TEXT} - ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} - ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} - ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} - ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +if(GLM_TEST_ENABLE) + add_executable(${NAME} ${ROOT_TEXT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_TEST_ENABLE) #add_library(glm STATIC glm.cpp) #add_library(glm_shared SHARED glm.cpp) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0d4acb92..ef6c2877 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,10 +1,12 @@ function(glmCreateTestGTC NAME) - set(SAMPLE_NAME test-${NAME}) - add_executable(${SAMPLE_NAME} ${NAME}.cpp) + if(GLM_TEST_ENABLE) + set(SAMPLE_NAME test-${NAME}) + add_executable(${SAMPLE_NAME} ${NAME}.cpp) - add_test( - NAME ${SAMPLE_NAME} - COMMAND $ ) + add_test( + NAME ${SAMPLE_NAME} + COMMAND $ ) + endif(GLM_TEST_ENABLE) endfunction() add_subdirectory(bug)