Commit b3647fe6 authored by Sebastien Barre's avatar Sebastien Barre

ENH: fix tests

parent 2d5ddb07
......@@ -25,14 +25,6 @@ LOAD_CACHE(${Complex_SOURCE_DIR}/Cache
INCLUDE_INTERNALS
CACHE_TEST_VAR_INTERNAL)
#
# Configure file
# (plug vars to #define so that they can be tested)
#
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
${Complex_BINARY_DIR}/cmTestConfigure.h)
#
# Specify include and lib dirs
# (BEFORE is for coverage)
......@@ -63,17 +55,11 @@ SET (EXECUTABLE_OUTPUT_PATH
${Complex_BINARY_DIR}/bin/ CACHE PATH
"Single output directory for building all executables.")
#
# Create the libs and the main exe
#
SUBDIRS(Library Executable)
SUBDIR_DEPENDS(Executable Library)
#
# Exec program (TODO: test a result)
# Increase coverage.
#
MESSAGE("Trying to increase coverage...")
MESSAGE("\nIgnore this message")
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
IF (NOT NO_EXEC_PROGRAM)
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
......@@ -90,3 +76,46 @@ MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
# sadly it won't be able to remove it.
#
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
#
# Test FIND_LIBARY
# Create a dummy empty lib
#
FOREACH (ext "${CMAKE_SHLIB_SUFFIX};.lib;.so")
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/dummy
${Complex_BINARY_DIR}/Library/dummylib${ext}
COPYONLY IMMEDIATE)
ENDFOREACH (ext)
FIND_LIBRARY(FIND_DUMMY_LIB
dummylib
PATHS
${Complex_BINARY_DIR}/Library)
#
# Test SET_SOURCE_FILES_PROPERTIES
#
SET_SOURCE_FILES_PROPERTIES(nonexisting_file2
GENERATED
ABSTRACT
WRAP_EXCLUDE
COMPILE_FLAGS "-foo -bar")
GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT)
GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE)
GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS)
#
# Configure file
# (plug vars to #define so that they can be tested)
#
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
${Complex_BINARY_DIR}/cmTestConfigure.h)
#
# Create the libs and the main exe
#
SUBDIRS(Library Executable)
SUBDIR_DEPENDS(Executable Library)
#
# Create exe.
#
SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DSET_SOURCE_FILES_PROPERTIES")
SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS")
ADD_EXECUTABLE(complex complex)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared)
TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS})
......
......@@ -37,7 +37,7 @@ void ForceStringUse()
void cmFailed(const char* Message, const char* m2= "")
{
std::cerr << "Failed: " << Message << m2 << "\n";
std::cerr << "FAILED: " << Message << m2 << "\n";
cm_failed++;
}
......@@ -95,11 +95,6 @@ void TestDir(const char* filename)
int main()
{
#ifdef SET_SOURCE_FILES_PROPERTIES
cmPassed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source");
#else
cmFailed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source");
#endif
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
......@@ -126,14 +121,6 @@ int main()
{
cmPassed("Call to file2 function returned 1.");
}
if(PropertyTest() != 1)
{
cmFailed("Call to PropertyTest function from library failed.");
}
else
{
cmPassed("Call to PropertyTest function returned 1.");
}
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS
......@@ -572,6 +559,59 @@ int main()
TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
// ----------------------------------------------------------------------
// Test FIND_LIBRARY
#ifndef FIND_DUMMY_LIB
cmFailed("the CONFIGURE_FILE command is broken, "
"FIND_DUMMY_LIB is not defined.");
#else
if(strstr(FIND_DUMMY_LIB, "dummylib") == NULL)
{
cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, "
"FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
}
else
{
cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
}
#endif
// ----------------------------------------------------------------------
// Test SET_SOURCE_FILES_PROPERTIES
#ifndef FILE_HAS_EXTRA_COMPILE_FLAGS
cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_HAS_EXTRA_COMPILE_FLAGS flag");
#else
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_HAS_EXTRA_COMPILE_FLAGS flag");
#endif
#ifndef FILE_HAS_ABSTRACT
cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting ABSTRACT flag");
#else
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting ABSTRACT flag");
#endif
#ifndef FILE_HAS_WRAP_EXCLUDE
cmFailed("FILE_HAS_WRAP_EXCLUDE failed at setting WRAP_EXCLUDE flag");
#else
cmPassed("FILE_HAS_WRAP_EXCLUDE succeeded in setting WRAP_EXCLUDE flag");
#endif
#ifndef FILE_COMPILE_FLAGS
cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not defined.");
#else
if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0)
{
cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ",
FILE_COMPILE_FLAGS);
}
else
{
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ", FILE_COMPILE_FLAGS);
}
#endif
// ----------------------------------------------------------------------
// Summary
......
......@@ -23,27 +23,7 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources)
#
# Create shared library
#
# test SET_SOURCE_FILES_PROPERTIES
SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar")
GET_SOURCE_FILE_PROPERTY(ISABS nonexisting_file2 ABSTRACT)
GET_SOURCE_FILE_PROPERTY(WRAPEX nonexisting_file2 WRAP_EXCLUDE)
GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 COMPILE_FLAGS)
MESSAGE("ISABS = ${ISABS} WRAPEX = ${WRAPEX} FLAGS = ${FLAGS}")
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/cmTestLibraryConfigure.h.in
${Complex_BINARY_DIR}/Library/cmTestLibraryConfigure.h)
SOURCE_FILES(SharedLibrarySources nonexisting_file2)
SOURCE_FILES_REMOVE(SharedLibrarySources GENERATED nonexisting_file2)
SET_SOURCE_FILES_PROPERTIES(fileFlags COMPILE_FLAGS "-DEXTRA_FLAG" )
SOURCE_FILES(SharedLibrarySources sharedFile fileFlags)
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
#
......@@ -60,7 +40,6 @@ ADD_CUSTOM_COMMAND(SOURCE CMakeTestLibraryShared
#
# Add a custom target.
# It runs ${CREATE_FILE_EXE} which will create the file
# It runs ${CREATE_FILE_EXE} which will create a file.
# The 'complex' executable will then test if this file exists and remove it.
#
......
#cmakedefine ISABS
#cmakedefine WRAPEX
#define FLAGS "${FLAGS}"
#include <Library/cmTestLibraryConfigure.h>
#include <string.h>
int file2()
{
return 1;
}
int PropertyTest()
{
int ret = 1;
#ifndef ISABS
ret = 0;
#endif
#ifndef WRAPEX
ret = 0;
#endif
if(strcmp(FLAGS,"-foo -bar") != 0)
{
ret =0;
}
return ret;
}
#ifndef EXTRA_FLAG
syntax error EXTRA_FLAG should be defined on the command line for this file
#endif
int ALLOK;
......@@ -38,3 +38,13 @@
// Needed to check for files
#define BINARY_DIR "${Complex_BINARY_DIR}"
// Test FIND_LIBRARY
#define FIND_DUMMY_LIB "${FIND_DUMMY_LIB}"
// Test SET_SOURCE_FILES_PROPERTIES
#cmakedefine FILE_HAS_ABSTRACT
#cmakedefine FILE_HAS_WRAP_EXCLUDE
#define FILE_COMPILE_FLAGS "${FILE_COMPILE_FLAGS}"
......@@ -25,14 +25,6 @@ LOAD_CACHE(${Complex_SOURCE_DIR}/Cache
INCLUDE_INTERNALS
CACHE_TEST_VAR_INTERNAL)
#
# Configure file
# (plug vars to #define so that they can be tested)
#
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
${Complex_BINARY_DIR}/cmTestConfigure.h)
#
# Specify include and lib dirs
# (BEFORE is for coverage)
......@@ -63,17 +55,11 @@ SET (EXECUTABLE_OUTPUT_PATH
${Complex_BINARY_DIR}/bin/ CACHE PATH
"Single output directory for building all executables.")
#
# Create the libs and the main exe
#
SUBDIRS(Library Executable)
SUBDIR_DEPENDS(Executable Library)
#
# Exec program (TODO: test a result)
# Increase coverage.
#
MESSAGE("Trying to increase coverage...")
MESSAGE("\nIgnore this message")
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
IF (NOT NO_EXEC_PROGRAM)
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
......@@ -90,3 +76,46 @@ MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
# sadly it won't be able to remove it.
#
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
#
# Test FIND_LIBARY
# Create a dummy empty lib
#
FOREACH (ext "${CMAKE_SHLIB_SUFFIX};.lib;.so")
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/dummy
${Complex_BINARY_DIR}/Library/dummylib${ext}
COPYONLY IMMEDIATE)
ENDFOREACH (ext)
FIND_LIBRARY(FIND_DUMMY_LIB
dummylib
PATHS
${Complex_BINARY_DIR}/Library)
#
# Test SET_SOURCE_FILES_PROPERTIES
#
SET_SOURCE_FILES_PROPERTIES(nonexisting_file2
GENERATED
ABSTRACT
WRAP_EXCLUDE
COMPILE_FLAGS "-foo -bar")
GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT)
GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE)
GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS)
#
# Configure file
# (plug vars to #define so that they can be tested)
#
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
${Complex_BINARY_DIR}/cmTestConfigure.h)
#
# Create the libs and the main exe
#
SUBDIRS(Library Executable)
SUBDIR_DEPENDS(Executable Library)
#
# Create exe.
#
SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DSET_SOURCE_FILES_PROPERTIES")
SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS")
ADD_EXECUTABLE(complex complex)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared)
TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS})
......
......@@ -37,7 +37,7 @@ void ForceStringUse()
void cmFailed(const char* Message, const char* m2= "")
{
std::cerr << "Failed: " << Message << m2 << "\n";
std::cerr << "FAILED: " << Message << m2 << "\n";
cm_failed++;
}
......@@ -95,11 +95,6 @@ void TestDir(const char* filename)
int main()
{
#ifdef SET_SOURCE_FILES_PROPERTIES
cmPassed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source");
#else
cmFailed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source");
#endif
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
......@@ -126,14 +121,6 @@ int main()
{
cmPassed("Call to file2 function returned 1.");
}
if(PropertyTest() != 1)
{
cmFailed("Call to PropertyTest function from library failed.");
}
else
{
cmPassed("Call to PropertyTest function returned 1.");
}
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS
......@@ -572,6 +559,59 @@ int main()
TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
// ----------------------------------------------------------------------
// Test FIND_LIBRARY
#ifndef FIND_DUMMY_LIB
cmFailed("the CONFIGURE_FILE command is broken, "
"FIND_DUMMY_LIB is not defined.");
#else
if(strstr(FIND_DUMMY_LIB, "dummylib") == NULL)
{
cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, "
"FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
}
else
{
cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
}
#endif
// ----------------------------------------------------------------------
// Test SET_SOURCE_FILES_PROPERTIES
#ifndef FILE_HAS_EXTRA_COMPILE_FLAGS
cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_HAS_EXTRA_COMPILE_FLAGS flag");
#else
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_HAS_EXTRA_COMPILE_FLAGS flag");
#endif
#ifndef FILE_HAS_ABSTRACT
cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting ABSTRACT flag");
#else
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting ABSTRACT flag");
#endif
#ifndef FILE_HAS_WRAP_EXCLUDE
cmFailed("FILE_HAS_WRAP_EXCLUDE failed at setting WRAP_EXCLUDE flag");
#else
cmPassed("FILE_HAS_WRAP_EXCLUDE succeeded in setting WRAP_EXCLUDE flag");
#endif
#ifndef FILE_COMPILE_FLAGS
cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not defined.");
#else
if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0)
{
cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ",
FILE_COMPILE_FLAGS);
}
else
{
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting extra flags == ", FILE_COMPILE_FLAGS);
}
#endif
// ----------------------------------------------------------------------
// Summary
......
......@@ -23,27 +23,7 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources)
#
# Create shared library
#
# test SET_SOURCE_FILES_PROPERTIES
SET_SOURCE_FILES_PROPERTIES(nonexisting_file2 GENERATED ABSTRACT WRAP_EXCLUDE COMPILE_FLAGS "-foo -bar")
GET_SOURCE_FILE_PROPERTY(ISABS nonexisting_file2 ABSTRACT)
GET_SOURCE_FILE_PROPERTY(WRAPEX nonexisting_file2 WRAP_EXCLUDE)
GET_SOURCE_FILE_PROPERTY(FLAGS nonexisting_file2 COMPILE_FLAGS)
MESSAGE("ISABS = ${ISABS} WRAPEX = ${WRAPEX} FLAGS = ${FLAGS}")
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/cmTestLibraryConfigure.h.in
${Complex_BINARY_DIR}/Library/cmTestLibraryConfigure.h)
SOURCE_FILES(SharedLibrarySources nonexisting_file2)
SOURCE_FILES_REMOVE(SharedLibrarySources GENERATED nonexisting_file2)
SET_SOURCE_FILES_PROPERTIES(fileFlags COMPILE_FLAGS "-DEXTRA_FLAG" )
SOURCE_FILES(SharedLibrarySources sharedFile fileFlags)
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
#
......@@ -60,7 +40,6 @@ ADD_CUSTOM_COMMAND(SOURCE CMakeTestLibraryShared
#
# Add a custom target.
# It runs ${CREATE_FILE_EXE} which will create the file
# It runs ${CREATE_FILE_EXE} which will create a file.
# The 'complex' executable will then test if this file exists and remove it.
#
......
#cmakedefine ISABS
#cmakedefine WRAPEX
#define FLAGS "${FLAGS}"
#include <Library/cmTestLibraryConfigure.h>
#include <string.h>
int file2()
{
return 1;
}
int PropertyTest()
{
int ret = 1;
#ifndef ISABS
ret = 0;
#endif
#ifndef WRAPEX
ret = 0;
#endif
if(strcmp(FLAGS,"-foo -bar") != 0)
{
ret =0;
}
return ret;
}
#ifndef EXTRA_FLAG
syntax error EXTRA_FLAG should be defined on the command line for this file
#endif
int ALLOK;
......@@ -38,3 +38,13 @@
// Needed to check for files
#define BINARY_DIR "${Complex_BINARY_DIR}"
// Test FIND_LIBRARY
#define FIND_DUMMY_LIB "${FIND_DUMMY_LIB}"
// Test SET_SOURCE_FILES_PROPERTIES
#cmakedefine FILE_HAS_ABSTRACT
#cmakedefine FILE_HAS_WRAP_EXCLUDE
#define FILE_COMPILE_FLAGS "${FILE_COMPILE_FLAGS}"
......@@ -25,14 +25,6 @@ LOAD_CACHE(${Complex_SOURCE_DIR}/Cache
INCLUDE_INTERNALS
CACHE_TEST_VAR_INTERNAL)
#
# Configure file
# (plug vars to #define so that they can be tested)
#
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
${Complex_BINARY_DIR}/cmTestConfigure.h)
#
# Specify include and lib dirs
# (BEFORE is for coverage)
......@@ -63,17 +55,11 @@ SET (EXECUTABLE_OUTPUT_PATH
${Complex_BINARY_DIR}/bin/ CACHE PATH
"Single output directory for building all executables.")
#
# Create the libs and the main exe
#
SUBDIRS(Library Executable)
SUBDIR_DEPENDS(Executable Library)
#
# Exec program (TODO: test a result)
# Increase coverage.
#
MESSAGE("Trying to increase coverage...")
MESSAGE("\nIgnore this message")
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
IF (NOT NO_EXEC_PROGRAM)
EXEC_PROGRAM("echo NO_EXEC_PROGRAM" "${Complex_BINARY_DIR}")
......@@ -90,3 +76,46 @@ MARK_AS_ADVANCED(CLEAR NO_EXEC_PROGRAM)
# sadly it won't be able to remove it.
#
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
#
# Test FIND_LIBARY
# Create a dummy empty lib
#
FOREACH (ext "${CMAKE_SHLIB_SUFFIX};.lib;.so")
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/Library/dummy
${Complex_BINARY_DIR}/Library/dummylib${ext}
COPYONLY IMMEDIATE)
ENDFOREACH (ext)
FIND_LIBRARY(FIND_DUMMY_LIB
dummylib
PATHS
${Complex_BINARY_DIR}/Library)
#
# Test SET_SOURCE_FILES_PROPERTIES
#
SET_SOURCE_FILES_PROPERTIES(nonexisting_file2
GENERATED
ABSTRACT
WRAP_EXCLUDE
COMPILE_FLAGS "-foo -bar")
GET_SOURCE_FILE_PROPERTY(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT)
GET_SOURCE_FILE_PROPERTY(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE)
GET_SOURCE_FILE_PROPERTY(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS)
#
# Configure file
# (plug vars to #define so that they can be tested)
#
CONFIGURE_FILE(
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
${Complex_BINARY_DIR}/cmTestConfigure.h)
#
# Create the libs and the main exe
#
SUBDIRS(Library Executable)
SUBDIR_DEPENDS(Executable Library)
#
# Create exe.
#
SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DSET_SOURCE_FILES_PROPERTIES")
SET_SOURCE_FILES_PROPERTIES(complex
COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS")
ADD_EXECUTABLE(complex complex)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared)
TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS})
......
......@@ -37,7 +37,7 @@ void ForceStringUse()
void cmFailed(const char* Message, const char* m2= "")
{
std::cerr << "Failed: " << Message << m2 << "\n";
std::cerr << "FAILED: " << Message << m2 << "\n";
cm_failed++;
}
......@@ -95,11 +95,6 @@ void TestDir(const char* filename)
int main()
{
#ifdef SET_SOURCE_FILES_PROPERTIES
cmPassed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source");
#else
cmFailed("SET_SOURCE_FILES_PROPERTIES set FLAGS passed on an ADD_EXECUTABLE source");
#endif
if(sharedFunction() != 1)
{
cmFailed("Call to sharedFunction from shared library failed.");
......@@ -126,14 +121,6 @@ int main()
{
cmPassed("Call to file2 function returned 1.");
}
if(PropertyTest() != 1)
{
cmFailed("Call to PropertyTest function from library failed.");
}
else
{
cmPassed("Call to PropertyTest function returned 1.");
}
// ----------------------------------------------------------------------
// Test ADD_DEFINITIONS
......@@ -572,6 +559,59 @@ int main()
TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
// ----------------------------------------------------------------------
// Test FIND_LIBRARY
#ifndef FIND_DUMMY_LIB
cmFailed("the CONFIGURE_FILE command is broken, "
"FIND_DUMMY_LIB is not defined.");
#else
if(strstr(FIND_DUMMY_LIB, "dummylib") == NULL)
{
cmFailed("the FIND_LIBRARY or CONFIGURE_FILE command is broken, "
"FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
}
else
{
cmPassed("FIND_DUMMY_LIB == ", FIND_DUMMY_LIB);
}
#endif
// ----------------------------------------------------------------------
// Test SET_SOURCE_FILES_PROPERTIES
#ifndef FILE_HAS_EXTRA_COMPILE_FLAGS
cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting FILE_HAS_EXTRA_COMPILE_FLAGS flag");
#else
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting FILE_HAS_EXTRA_COMPILE_FLAGS flag");
#endif
#ifndef FILE_HAS_ABSTRACT
cmFailed("SET_SOURCE_FILES_PROPERTIES failed at setting ABSTRACT flag");
#else
cmPassed("SET_SOURCE_FILES_PROPERTIES succeeded in setting ABSTRACT flag");
#endif
#ifndef FILE_HAS_WRAP_EXCLUDE
cmFailed("FILE_HAS_WRAP_EXCLUDE failed at setting WRAP_EXCLUDE flag");
#else
cmPassed("FILE_HAS_WRAP_EXCLUDE succeeded in setting WRAP_EXCLUDE flag");
#endif
#ifndef FILE_COMPILE_FLAGS
cmFailed("the CONFIGURE_FILE command is broken, FILE_COMPILE_FLAGS is not defined.");
#else
if(strcmp(FILE_COMPILE_FLAGS, "-foo -bar") != 0)
{
cmFailed("the SET_SOURCE_FILES_PROPERTIES or CONFIGURE_FILE command is broken. FILE_COMPILE_FLAGS == ",
FILE_COMPILE_FLAGS);
}
else