forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clhep-2.1.1.0-fix-cmake.patch
60 lines (58 loc) · 3.26 KB
/
clhep-2.1.1.0-fix-cmake.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/CLHEP/cmake/Modules/ClhepCopyHeaders.cmake b/CLHEP/cmake/Modules/ClhepCopyHeaders.cmake
index 56b1770..707f3cc 100644
--- a/CLHEP/cmake/Modules/ClhepCopyHeaders.cmake
+++ b/CLHEP/cmake/Modules/ClhepCopyHeaders.cmake
@@ -22,7 +22,7 @@ macro (clhep_copy_headers )
${CLHEP_SOURCE_DIR}/${package}/${package}/*.icc )
FILE( GLOB defs ${CLHEP_SOURCE_DIR}/${package}/${package}/cmake-defs.h.in )
foreach( defhdr ${defs} )
- ##message(STATUS "process ${defhdr} to create ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h")
+ message(STATUS "process ${defhdr} to create ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h")
# this copies the file and creates directories if necessary
CONFIGURE_FILE( ${defhdr} ${CLHEP_BINARY_DIR}/CLHEP/${package}/defs.h @ONLY )
# install defs.h from here
@@ -31,8 +31,12 @@ macro (clhep_copy_headers )
endforeach( defhdr )
foreach( hdr ${headers} )
- STRING( REGEX REPLACE "^(${CMAKE_CURRENT_SOURCE_DIR})/${package}(.*)$" "${CLHEP_BINARY_DIR}/CLHEP\\2" output_file "${hdr}")
- ##message(STATUS "moving ${hdr} to ${output_file}")
+ string(LENGTH "${CMAKE_CURRENT_SOURCE_DIR}/" SOURCE_DIR_LEN)
+ string(LENGTH "${package}/" PACKAGE_LEN)
+ math(EXPR CUT_POS "${SOURCE_DIR_LEN} + ${PACKAGE_LEN}")
+ string(SUBSTRING "${hdr}" ${CUT_POS} -1 HEADER_FILE)
+ set(output_file "${CLHEP_BINARY_DIR}/CLHEP/${HEADER_FILE}")
+ message(STATUS "moving ${hdr} to ${output_file}")
# this copies the file and creates directories if necessary
CONFIGURE_FILE( ${hdr} ${output_file} COPYONLY)
endforeach( hdr )
diff --git a/CLHEP/cmake/Modules/ClhepOutOfSourceBuild.cmake b/CLHEP/cmake/Modules/ClhepOutOfSourceBuild.cmake
index 3054c32..9f5afa1 100644
--- a/CLHEP/cmake/Modules/ClhepOutOfSourceBuild.cmake
+++ b/CLHEP/cmake/Modules/ClhepOutOfSourceBuild.cmake
@@ -5,8 +5,8 @@
macro (clhep_ensure_out_of_source_build)
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" in_source)
- string( REGEX MATCH "${CMAKE_SOURCE_DIR}/" in_source_subdir "${CMAKE_BINARY_DIR}")
- if (in_source OR in_source_subdir)
+ string(FIND "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}" in_source_subdir)
+ if (in_source OR in_source_subdir GREATER -1)
message(FATAL_ERROR "
ERROR: In source builds of this project are not allowed.
A separate build directory is required.
diff --git a/CLHEP/cmake/Modules/ClhepVariables.cmake b/CLHEP/cmake/Modules/ClhepVariables.cmake
index f10262f..c5e2850 100644
--- a/CLHEP/cmake/Modules/ClhepVariables.cmake
+++ b/CLHEP/cmake/Modules/ClhepVariables.cmake
@@ -86,10 +86,10 @@ macro( clhep_set_compiler_flags )
endif()
message(STATUS "cmake build type is ${CMAKE_BUILD_TYPE}")
if( CMAKE_COMPILER_IS_GNUCC )
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O -ansi -pedantic -Wall -D_GNU_SOURCE")
+ set(CMAKE_C_FLAGS "-O -ansi -pedantic -Wall -D_GNU_SOURCE ${CMAKE_C_FLAGS}")
endif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -ansi -pedantic -Wall -D_GNU_SOURCE")
+ set(CMAKE_CXX_FLAGS "-O -ansi -pedantic -Wall -D_GNU_SOURCE ${CMAKE_CXX_FLAGS}")
endif(CMAKE_COMPILER_IS_GNUCXX)
if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
##message( STATUS "system is Windows" )