cmake: Don't build tests when not testing

This commit is contained in:
Roger Leigh 2014-04-15 10:44:03 +01:00 committed by Roger Leigh
parent e69271e766
commit cd65199935
2 changed files with 14 additions and 10 deletions

View File

@ -30,11 +30,13 @@ source_group("GTX Files" FILES ${GTX_HEADER})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
if(GLM_TEST_ENABLE)
add_executable(${NAME} ${ROOT_TEXT} add_executable(${NAME} ${ROOT_TEXT}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
endif(GLM_TEST_ENABLE)
#add_library(glm STATIC glm.cpp) #add_library(glm STATIC glm.cpp)
#add_library(glm_shared SHARED glm.cpp) #add_library(glm_shared SHARED glm.cpp)

View File

@ -1,10 +1,12 @@
function(glmCreateTestGTC NAME) function(glmCreateTestGTC NAME)
if(GLM_TEST_ENABLE)
set(SAMPLE_NAME test-${NAME}) set(SAMPLE_NAME test-${NAME})
add_executable(${SAMPLE_NAME} ${NAME}.cpp) add_executable(${SAMPLE_NAME} ${NAME}.cpp)
add_test( add_test(
NAME ${SAMPLE_NAME} NAME ${SAMPLE_NAME}
COMMAND $<TARGET_FILE:${SAMPLE_NAME}> ) COMMAND $<TARGET_FILE:${SAMPLE_NAME}> )
endif(GLM_TEST_ENABLE)
endfunction() endfunction()
add_subdirectory(bug) add_subdirectory(bug)