[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.1 1.2 example_exe.c 1.1 1.2 example_mod_1.c 1.1 1.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Oct 5 14:39:25 EDT 2009
Update of /cvsroot/CMake/CMake/Tests/ModuleDefinition
In directory public:/mounts/ram/cvs-serv21347/Tests/ModuleDefinition
Modified Files:
CMakeLists.txt example_exe.c example_mod_1.c
Log Message:
Fix ModuleDefinition test for Intel on Windows
CMake defines MSVC only for a VS compiler, but the Intel compiler adds
the preprocessor definition _MSC_VER. Instead of relying on separate
tests to decide whether to use example_dll_2, we do one test in CMake
and then add our own preprocessor definition.
Index: example_mod_1.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ModuleDefinition/example_mod_1.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** example_mod_1.c 29 Sep 2009 20:39:43 -0000 1.1
--- example_mod_1.c 5 Oct 2009 18:39:23 -0000 1.2
***************
*** 7,11 ****
int __declspec(dllimport) example_exe_function(void);
int __declspec(dllimport) example_dll_function(void);
! #ifdef _MSC_VER
int __declspec(dllimport) example_dll_2_function(void);
#endif
--- 7,11 ----
int __declspec(dllimport) example_exe_function(void);
int __declspec(dllimport) example_dll_function(void);
! #ifdef EXAMPLE_DLL_2
int __declspec(dllimport) example_dll_2_function(void);
#endif
***************
*** 15,19 ****
return
example_dll_function() +
! #ifdef _MSC_VER
example_dll_2_function() +
#endif
--- 15,19 ----
return
example_dll_function() +
! #ifdef EXAMPLE_DLL_2
example_dll_2_function() +
#endif
Index: example_exe.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ModuleDefinition/example_exe.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** example_exe.c 29 Sep 2009 20:39:43 -0000 1.1
--- example_exe.c 5 Oct 2009 18:39:23 -0000 1.2
***************
*** 1,4 ****
extern int __declspec(dllimport) example_dll_function(void);
! #ifdef _MSC_VER
extern int __declspec(dllimport) example_dll_2_function(void);
#endif
--- 1,4 ----
extern int __declspec(dllimport) example_dll_function(void);
! #ifdef EXAMPLE_DLL_2
extern int __declspec(dllimport) example_dll_2_function(void);
#endif
***************
*** 8,12 ****
return
example_dll_function() +
! #ifdef _MSC_VER
example_dll_2_function() +
#endif
--- 8,12 ----
return
example_dll_function() +
! #ifdef EXAMPLE_DLL_2
example_dll_2_function() +
#endif
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ModuleDefinition/CMakeLists.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** CMakeLists.txt 29 Sep 2009 20:39:42 -0000 1.1
--- CMakeLists.txt 5 Oct 2009 18:39:23 -0000 1.2
***************
*** 6,13 ****
# Test /DEF:<file> flag recognition for VS.
! if(MSVC)
add_library(example_dll_2 SHARED example_dll_2.c)
set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS
/DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def")
set(example_dll_2 example_dll_2)
endif()
--- 6,14 ----
# Test /DEF:<file> flag recognition for VS.
! if(MSVC OR "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
add_library(example_dll_2 SHARED example_dll_2.c)
set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS
/DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def")
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXAMPLE_DLL_2)
set(example_dll_2 example_dll_2)
endif()
More information about the Cmake-commits
mailing list