From 2b70238a50d507bc219ed96b01a8e337648a7a45 Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Fri, 15 Feb 2013 14:27:44 +0000 Subject: [PATCH] From Pere: patch that fixes the problem of building RooStats on Windows using CMake. Somehow it was generating a too long command to generate the .def file. At the same time I also have added sehmap.h in the distributions that fixes the problem reported by people not having it in their installation. git-svn-id: http://root.cern.ch/svn/root/trunk@48599 27541ba8-7e3a-0410-8455-c3a389f83636 --- build/win/sehmap.h | 22 ++++++++++++++++++++++ cmake/modules/RootNewMacros.cmake | 19 ++++++++++--------- cmake/modules/SetUpWindows.cmake | 1 + 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 build/win/sehmap.h diff --git a/build/win/sehmap.h b/build/win/sehmap.h new file mode 100644 index 00000000000..033ff95a3f4 --- /dev/null +++ b/build/win/sehmap.h @@ -0,0 +1,22 @@ +/* + + SEHMAP.H - Map old-style structured exception handling to correct names. + + The mapping of structured exception handling statements from {try, except, + finally, leave} to their proper names (prefaced by "__") has been removed + from win32.mak. This header is provided solely for compatibility with + source code that used the older convention. + +*/ + + +#ifndef __cplusplus +#undef try +#undef except +#undef finally +#undef leave +#define try __try +#define except __except +#define finally __finally +#define leave __leave +#endif diff --git a/cmake/modules/RootNewMacros.cmake b/cmake/modules/RootNewMacros.cmake index fb3f32b1ed1..f8022c3f4c4 100644 --- a/cmake/modules/RootNewMacros.cmake +++ b/cmake/modules/RootNewMacros.cmake @@ -265,15 +265,16 @@ function(ROOT_LINKER_LIBRARY library) if(WIN32 AND ARG_TYPE STREQUAL SHARED AND NOT ARG_DLLEXPORT) #---create a list of all the object files----------------------------- if(CMAKE_GENERATOR MATCHES "Visual Studio") - foreach(src1 ${lib_srcs}) - if(NOT src1 MATCHES "[.]h$|[.]icc$|[.]hxx$|[.]hpp$") - string (REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" src2 ${src1}) - string (REPLACE ${CMAKE_CURRENT_BINARY_DIR} "" src3 ${src2}) - string (REPLACE ".." "__" src ${src3}) - get_filename_component(name ${src} NAME_WE) - set(lib_objs ${lib_objs} ${library}.dir/${CMAKE_CFG_INTDIR}/${name}.obj) - endif() - endforeach() + #foreach(src1 ${lib_srcs}) + # if(NOT src1 MATCHES "[.]h$|[.]icc$|[.]hxx$|[.]hpp$") + # string (REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" src2 ${src1}) + # string (REPLACE ${CMAKE_CURRENT_BINARY_DIR} "" src3 ${src2}) + # string (REPLACE ".." "__" src ${src3}) + # get_filename_component(name ${src} NAME_WE) + # set(lib_objs ${lib_objs} ${library}.dir/${CMAKE_CFG_INTDIR}/${name}.obj) + # endif() + #endforeach() + set(lib_objs ${lib_objs} ${library}.dir/${CMAKE_CFG_INTDIR}/*.obj) else() foreach(src1 ${lib_srcs}) if(NOT src1 MATCHES "[.]h$|[.]icc$|[.]hxx$|[.]hpp$") diff --git a/cmake/modules/SetUpWindows.cmake b/cmake/modules/SetUpWindows.cmake index f1c7ac150c6..cbccae74a30 100644 --- a/cmake/modules/SetUpWindows.cmake +++ b/cmake/modules/SetUpWindows.cmake @@ -32,6 +32,7 @@ if(CMAKE_PROJECT_NAME STREQUAL ROOT) set(CMAKE_CXX_FLAGS "-nologo -I${CMAKE_SOURCE_DIR}/build/win -FIw32pragma.h -FIsehmap.h ${BLDCXXFLAGS} -EHsc- -W3 -wd4244 -D_WIN32") set(CMAKE_C_FLAGS "-nologo -I${CMAKE_SOURCE_DIR}/build/win -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32") install(FILES ${CMAKE_SOURCE_DIR}/build/win/w32pragma.h DESTINATION include COMPONENT headers) + install(FILES ${CMAKE_SOURCE_DIR}/build/win/sehmap.h DESTINATION include COMPONENT headers) else() set(CMAKE_CXX_FLAGS "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCXXFLAGS} -EHsc- -W3 -wd4244 -D_WIN32") set(CMAKE_C_FLAGS "-nologo -FIw32pragma.h -FIsehmap.h ${BLDCFLAGS} -EHsc- -W3 -D_WIN32") -- GitLab