summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVictor Brunini <vebruni@sandia.gov>2023-10-11 14:30:44 -0700
committerGitHub <noreply@github.com>2023-10-11 23:30:44 +0200
commit7a4b479724baaca474403b8be11ced5918ef3f86 (patch)
treee836553301e0b2fafd3b9d20944c9f8b60d53aae /lib
parent89e34d56a1424966bac7fc0585dd70552138886a (diff)
downloadspack-7a4b479724baaca474403b8be11ced5918ef3f86.tar.gz
spack-7a4b479724baaca474403b8be11ced5918ef3f86.tar.bz2
spack-7a4b479724baaca474403b8be11ced5918ef3f86.tar.xz
spack-7a4b479724baaca474403b8be11ced5918ef3f86.zip
cmake: drop CMAKE_STATIC_LINKER_FLAGS (#40423)
Because those end up being passed to ar which does not understand linker arguments. This was making ldflags largely unusuable for statically linked cmake packages.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/cmake.py6
-rw-r--r--lib/spack/spack/test/flag_handlers.py1
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py
index e51dbf9220..1859e40fe5 100644
--- a/lib/spack/spack/build_systems/cmake.py
+++ b/lib/spack/spack/build_systems/cmake.py
@@ -142,10 +142,10 @@ class CMakePackage(spack.package_base.PackageBase):
# We specify for each of them.
if flags["ldflags"]:
ldflags = " ".join(flags["ldflags"])
- ld_string = "-DCMAKE_{0}_LINKER_FLAGS={1}"
# cmake has separate linker arguments for types of builds.
- for type in ["EXE", "MODULE", "SHARED", "STATIC"]:
- self.cmake_flag_args.append(ld_string.format(type, ldflags))
+ self.cmake_flag_args.append(f"-DCMAKE_EXE_LINKER_FLAGS={ldflags}")
+ self.cmake_flag_args.append(f"-DCMAKE_MODULE_LINKER_FLAGS={ldflags}")
+ self.cmake_flag_args.append(f"-DCMAKE_SHARED_LINKER_FLAGS={ldflags}")
# CMake has libs options separated by language. Apply ours to each.
if flags["ldlibs"]:
diff --git a/lib/spack/spack/test/flag_handlers.py b/lib/spack/spack/test/flag_handlers.py
index ae83b05885..3e680c1ab7 100644
--- a/lib/spack/spack/test/flag_handlers.py
+++ b/lib/spack/spack/test/flag_handlers.py
@@ -121,7 +121,6 @@ class TestFlagHandlers:
"-DCMAKE_EXE_LINKER_FLAGS=-mthreads",
"-DCMAKE_MODULE_LINKER_FLAGS=-mthreads",
"-DCMAKE_SHARED_LINKER_FLAGS=-mthreads",
- "-DCMAKE_STATIC_LINKER_FLAGS=-mthreads",
}
def test_ld_libs_cmake(self, temp_env):