Skip to content

Commit

Permalink
Better cmake integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
atomgalaxy committed Nov 5, 2012
1 parent 50f9f4a commit 35b0953
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build_tools/cmake/CxxTest.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include(FindCxxTest.cmake)

include("${CMAKE_CURRENT_LIST_DIR}/FindCxxTest.cmake")

function(cxx_test target source)
string(REGEX REPLACE "hpp$" "cpp" CPP_FILE_NAME ${source})
Expand Down
28 changes: 27 additions & 1 deletion build_tools/cmake/FindCxxTest.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
IF (DEFINED FIND_CXXTEST_CMAKE_INCLUDED)
RETURN()
ENDIF (DEFINED FIND_CXXTEST_CMAKE_INCLUDED)
SET(FIND_CXXTEST_CMAKE_INCLUDED true)

FIND_PROGRAM(CXXTESTGEN
NAMES cxxtestgen
PATHS ./cxxtest/bin/
PATHS "${CXXTEST_PATH}/bin"
"${PROJECT_SOURCE_DIR}/cxxtest/bin"
"${PROJECT_SOURCE_DIR}/lib/cxxtest/bin"
"${PROJECT_BINARY_DIR}/cxxtest/bin"
"${PROJECT_BINARY_DIR}/lib/cxxtest/bin"
/usr/bin
/bin
)

FIND_PATH(CXXTEST_INCLUDES
NAMES "cxxtest/TestSuite.h"
PATHS "${CXXTEST_PATH}"
"${PROJECT_SOURCE_DIR}/cxxtest/"
"${PROJECT_SOURCE_DIR}/lib/cxxtest/"
)

IF(NOT CXXTESTGEN)
MESSAGE(FATAL_ERROR "Unable to find 'cxxtestgen'")
SET(CXXTEST_FOUND false)
ELSEIF(NOT CXXTEST_INCLUDES)
SET(CXXTEST_FOUND false)
ELSE(NOT CXXTESTGEN)
SET(CXXTEST_FOUND true)
SET(CXXTEST_ROOT ${CXXTEST_INCLUDES})
ENDIF(NOT CXXTESTGEN)

SET(CXXTEST_CMAKE_MODULES_PATH "${CMAKE_CURRENT_LIST_DIR}")
INCLUDE("${CXXTEST_CMAKE_MODULES_PATH}/CxxTest.cmake")

0 comments on commit 35b0953

Please sign in to comment.