diff options
Diffstat (limited to 'Tests/ComplexRelativePaths')
-rw-r--r-- | Tests/ComplexRelativePaths/Executable/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Executable/complex.cxx | 11 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Library/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Library/testConly.c | 6 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Library/testConly.h | 12 |
5 files changed, 32 insertions, 1 deletions
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index a3ad8fd..7468926 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -4,7 +4,7 @@ SET_SOURCE_FILES_PROPERTIES(complex COMPILE_FLAGS "-DFILE_HAS_EXTRA_COMPILE_FLAGS") ADD_EXECUTABLE(complex complex) -SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared) +SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) TARGET_LINK_LIBRARIES(complex ${COMPLEX_LIBS}) # diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 61ffd8f..6607d7d 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -2,6 +2,9 @@ #include "ExtraSources/file1.h" #include "file2.h" #include "sharedFile.h" +extern "C" { +#include "testConly.h" +} #include "cmStandardIncludes.h" #include "cmSystemTools.h" @@ -103,6 +106,14 @@ int main() { cmPassed("Call to sharedFunction from shared library worked."); } + if(CsharedFunction() != 1) + { + cmFailed("Call to C sharedFunction from shared library failed."); + } + else + { + cmPassed("Call to C sharedFunction from shared library worked."); + } if(file1() != 1) { diff --git a/Tests/ComplexRelativePaths/Library/CMakeLists.txt b/Tests/ComplexRelativePaths/Library/CMakeLists.txt index c01f501..19cb6cd 100644 --- a/Tests/ComplexRelativePaths/Library/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Library/CMakeLists.txt @@ -26,6 +26,8 @@ ADD_LIBRARY(CMakeTestLibrary LibrarySources) SOURCE_FILES(SharedLibrarySources sharedFile) ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources) +ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c) + # # Attach a post-build custom-command to the lib. # It runs ${CREATE_FILE_EXE} which will create a file. diff --git a/Tests/ComplexRelativePaths/Library/testConly.c b/Tests/ComplexRelativePaths/Library/testConly.c new file mode 100644 index 0000000..d2d5294 --- /dev/null +++ b/Tests/ComplexRelativePaths/Library/testConly.c @@ -0,0 +1,6 @@ +#include "sharedFile.h" + +int CsharedFunction() +{ + return 1; +} diff --git a/Tests/ComplexRelativePaths/Library/testConly.h b/Tests/ComplexRelativePaths/Library/testConly.h new file mode 100644 index 0000000..8553a6b --- /dev/null +++ b/Tests/ComplexRelativePaths/Library/testConly.h @@ -0,0 +1,12 @@ +#if defined(_WIN32) || defined(WIN32) /* Win32 version */ +#ifdef CMakeTestLibraryShared_EXPORTS +# define CMakeTest_EXPORT __declspec(dllexport) +#else +# define CMakeTest_EXPORT __declspec(dllimport) +#endif +#else +// unix needs nothing +#define CMakeTest_EXPORT +#endif + +CMakeTest_EXPORT int CsharedFunction(); |