Skip to content

Commit 2db8697

Browse files
committed
Merge branch 'develop' into hotfix/3.7.2
2 parents 4c53503 + df6b65f commit 2db8697

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

‎bamboo/env.sh‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

3-
[[ $(uname) == "Darwin" ]] && return # no module environment on the Mac
3+
#[[ $(uname) == "Darwin" ]] && return # no module environment on the Mac
44

55
# initialise module environment if it is not
6-
if [[ ! $(command -v module > /dev/null 2>&1) ]]; then
7-
. /usr/local/apps/module/init/bash
8-
fi
6+
#if [[ ! $(command -v module > /dev/null 2>&1) ]]; then
7+
# . /usr/local/apps/module/init/bash
8+
#fi
99

10-
module load cmake/new
10+
#module load cmake/new

‎cmake/VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.1
1+
3.7.2

‎cmake/ecbuild_add_executable.cmake‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# [ OBJECTS <obj1> [<obj2> ...] ]
2222
# [ TEMPLATES <template1> [<template2> ...] ]
2323
# [ LIBS <library1> [<library2> ...] ]
24+
# [ NO_AS_NEEDED ]
2425
# [ INCLUDES <path1> [<path2> ...] ]
2526
# [ DEFINITIONS <definition1> [<definition2> ...] ]
2627
# [ PERSISTENT <file1> [<file2> ...] ]
@@ -62,6 +63,9 @@
6263
# LIBS : optional
6364
# list of libraries to link against (CMake targets or external libraries)
6465
#
66+
# NO_AS_NEEDED: optional
67+
# add --no-as-needed linker flag, to prevent stripping libraries that looks like are not used
68+
#
6569
# INCLUDES : optional
6670
# list of paths to add to include directories
6771
#
@@ -137,7 +141,7 @@
137141

138142
function( ecbuild_add_executable )
139143

140-
set( options NOINSTALL AUTO_VERSION )
144+
set( options NOINSTALL AUTO_VERSION NO_AS_NEEDED )
141145
set( single_value_args TARGET COMPONENT LINKER_LANGUAGE VERSION OUTPUT_NAME )
142146
set( multi_value_args SOURCES SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS
143147
TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS
@@ -238,7 +242,11 @@ function( ecbuild_add_executable )
238242
list(REMOVE_ITEM _PAR_LIBS debug)
239243
list(REMOVE_ITEM _PAR_LIBS optimized)
240244
ecbuild_filter_list(LIBS LIST ${_PAR_LIBS} LIST_INCLUDE lib LIST_EXCLUDE skipped_lib)
241-
target_link_libraries( ${_PAR_TARGET} ${lib} )
245+
if ( _PAR_NO_AS_NEEDED AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
246+
target_link_libraries( ${_PAR_TARGET} -Wl,--no-as-needed ${lib} )
247+
else()
248+
target_link_libraries( ${_PAR_TARGET} ${lib} )
249+
endif()
242250
ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): linking with [${lib}]")
243251
ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): [${skipped_lib}] not found - not linking")
244252
endif()

‎cmake/ecbuild_add_test.cmake‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# [ OMP <number-of-threads-per-mpi-task> ]
2828
# [ ENABLED ON|OFF ]
2929
# [ LIBS <library1> [<library2> ...] ]
30+
# [ NO_AS_NEEDED ]
3031
# [ INCLUDES <path1> [<path2> ...] ]
3132
# [ DEFINITIONS <definition1> [<definition2> ...] ]
3233
# [ PERSISTENT <file1> [<file2> ...] ]
@@ -105,6 +106,9 @@
105106
# LIBS : optional
106107
# list of libraries to link against (CMake targets or external libraries)
107108
#
109+
# NO_AS_NEEDED: optional
110+
# add --no-as-needed linker flag, to prevent stripping libraries that looks like are not used
111+
#
108112
# INCLUDES : optional
109113
# list of paths to add to include directories
110114
#
@@ -177,7 +181,7 @@
177181

178182
function( ecbuild_add_test )
179183

180-
set( options )
184+
set( options NO_AS_NEEDED )
181185
set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI OMP WORKING_DIRECTORY )
182186
set( multi_value_args SOURCES OBJECTS LIBS INCLUDES TEST_DEPENDS DEPENDS LABELS ARGS
183187
PERSISTENT DEFINITIONS RESOURCES TEST_DATA CFLAGS
@@ -336,7 +340,11 @@ function( ecbuild_add_test )
336340
list(REMOVE_ITEM _PAR_LIBS optimized)
337341
ecbuild_filter_list(LIBS LIST ${_PAR_LIBS} LIST_INCLUDE lib LIST_EXCLUDE skipped_lib)
338342
ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): linking with [${lib}]")
339-
target_link_libraries( ${_PAR_TARGET} ${lib} )
343+
if ( _PAR_NO_AS_NEEDED AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
344+
target_link_libraries( ${_PAR_TARGET} -Wl,--no-as-needed ${lib} )
345+
else()
346+
target_link_libraries( ${_PAR_TARGET} ${lib} )
347+
endif()
340348
ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): [${skipped_lib}] not found - not linking")
341349
endif()
342350

0 commit comments

Comments
 (0)