Hi,
I have a cross-platform library project with multiple "test" programs
that test the library. Those tests come in separate directories, each
with it's own CMakeLists.txt file (although the files are all identical,
see below).
I'm adding the tests to the library project by
FILE(GLOB tests "../test/*")
FOREACH(test ${tests})
GET_FILENAME_COMPONENT(path "${test}" ABSOLUTE)
IF(IS_DIRECTORY ${path})
GET_FILENAME_COMPONENT(dir ${path} NAME)
IF(NOT ${dir} STREQUAL "CVS" AND NOT ${dir} STREQUAL ".svn")
ADD_SUBDIRECTORY(${path} ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(NOT ${dir} STREQUAL "CVS" AND NOT ${dir} STREQUAL ".svn")
ENDIF(IS_DIRECTORY ${path})
ENDFOREACH(test ${tests})
The CMakeLists.txt files in ${path} each look like
GET_FILENAME_COMPONENT(name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
SET(name test_${name})
PROJECT(${name})
INCLUDE_DIRECTORIES("../../include")
LINK_DIRECTORIES("../../lib")
SET(EXECUTABLE_OUTPUT_PATH "../../bin" CACHE INTERNAL "" FORCE)
FILE(GLOB_RECURSE sources "*.h" "*.cpp")
ADD_EXECUTABLE(${name} ${sources})
ADD_DEPENDENCIES(${name} gale)
All this works fine under Windows. Under Linux, however, only one test
(out of five) is added to the project (i.e. is available as a make
target). If I remove that test's directory and rerun cmake, another of
the four remaining tests is now available as a make target, so it seems
only the first or last test parsed gets added. I've verified ${path} is
correct. Any ideas why the other tests are missing as make targets?
--
Sebastian Schuberth
(Remove "NOSP" and "M" from my e-mail address)
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake