Skip to content

Commit efc4ea6

Browse files
committed
Merge commit 'bd219baa90573303400126d80b42608dc0fe394c' into corrosion
2 parents ac08b42 + bd219ba commit efc4ea6

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

corrosion/cmake/Corrosion.cmake

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ endif()
130130

131131
function(_add_cargo_build)
132132
set(options "")
133-
set(one_value_args PACKAGE TARGET MANIFEST_PATH PROFILE LINKER_LANGUAGE)
133+
set(one_value_args PACKAGE TARGET MANIFEST_PATH PROFILE LINK_AS)
134134
set(multi_value_args BYPRODUCTS)
135135
cmake_parse_arguments(
136136
ACB
@@ -160,8 +160,8 @@ function(_add_cargo_build)
160160
# For MSVC targets, don't mess with linker preferences.
161161
# TODO: We still should probably make sure that rustc is using the correct cl.exe to link programs.
162162
if (NOT MSVC)
163-
if (ACB_LINKER_LANGUAGE)
164-
set(languages ${ACB_LINKER_LANGUAGE})
163+
if (ACB_LINK_AS)
164+
set(languages ${ACB_LINK_AS})
165165
else()
166166
set(languages C CXX Fortran)
167167
endif()
@@ -395,7 +395,7 @@ endfunction(_add_cargo_build)
395395

396396
function(corrosion_import_crate)
397397
set(OPTIONS ALL_FEATURES NO_DEFAULT_FEATURES NO_STD)
398-
set(ONE_VALUE_KEYWORDS MANIFEST_PATH PROFILE LINKER_LANGUAGE)
398+
set(ONE_VALUE_KEYWORDS MANIFEST_PATH PROFILE LINK_AS)
399399
set(MULTI_VALUE_KEYWORDS CRATES FEATURES)
400400
cmake_parse_arguments(COR "${OPTIONS}" "${ONE_VALUE_KEYWORDS}" "${MULTI_VALUE_KEYWORDS}" ${ARGN})
401401

@@ -404,8 +404,8 @@ function(corrosion_import_crate)
404404
endif()
405405

406406
set(valid_languages C CXX Fortran)
407-
if ((DEFINED COR_LINKER_LANGUAGE) AND (NOT COR_LINKER_LANGUAGE IN_LIST valid_languages))
408-
message(FATAL_ERROR "LINKER_LANGUAGE may only be set to one of ${valid_languages}.")
407+
if ((DEFINED COR_LINK_AS) AND (NOT COR_LINK_AS IN_LIST valid_languages))
408+
message(FATAL_ERROR "LINK_AS may only be set to one of ${valid_languages}.")
409409
endif()
410410

411411
if(COR_PROFILE)
@@ -474,8 +474,8 @@ function(corrosion_import_crate)
474474
list(APPEND crates_args --crates ${crate})
475475
endforeach()
476476

477-
if (COR_LINKER_LANGUAGE)
478-
set(linker_language "--linker-language=${COR_LINKER_LANGUAGE}")
477+
if (COR_LINK_AS)
478+
set(link_as "--linker-language=${COR_LINK_AS}")
479479
endif()
480480

481481
execute_process(
@@ -488,7 +488,7 @@ function(corrosion_import_crate)
488488
${_CORROSION_CONFIGURATION_TYPES}
489489
${crates_args}
490490
${cargo_profile}
491-
${linker_language}
491+
${link_as}
492492
${no_default_libs_arg}
493493
--cargo-version ${_CORROSION_CARGO_VERSION}
494494
-o ${generated_cmake}
@@ -518,8 +518,8 @@ function(corrosion_import_crate)
518518
"${COR_CRATES}"
519519
PROFILE
520520
"${COR_PROFILE}"
521-
LINKER_LANGUAGE
522-
"${COR_LINKER_LANGUAGE}"
521+
LINK_AS
522+
"${COR_LINK_AS}"
523523
)
524524
endif()
525525
endfunction(corrosion_import_crate)

corrosion/cmake/CorrosionGenerator.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function(_generator_parse_target manifest package target)
198198
)
199199
endfunction()
200200

201-
function(_generator_add_target manifest ix cargo_version profile linker_language)
201+
function(_generator_add_target manifest ix cargo_version profile link_as)
202202
get_source_file_property(package_name ${manifest} CORROSION_TARGET${ix}_PACKAGE_NAME)
203203
get_source_file_property(manifest_path ${manifest} CORROSION_TARGET${ix}_MANIFEST_PATH)
204204
get_source_file_property(target_name ${manifest} CORROSION_TARGET${ix}_TARGET_NAME)
@@ -332,7 +332,7 @@ function(_generator_add_target manifest ix cargo_version profile linker_language
332332
MANIFEST_PATH "${manifest_path}"
333333
BYPRODUCTS ${byproducts}
334334
PROFILE "${profile}"
335-
LINKER_LANGUAGE ${linker_language}
335+
LINK_AS ${link_as}
336336
)
337337
endfunction()
338338

@@ -399,7 +399,7 @@ endfunction()
399399

400400
function(_generator_add_cargo_targets)
401401
set(options "")
402-
set(one_value_args MANIFEST_PATH CONFIGURATION_ROOT CONFIGURATION_TYPE TARGET CARGO_VERSION PROFILE LINKER_LANGUAGE)
402+
set(one_value_args MANIFEST_PATH CONFIGURATION_ROOT CONFIGURATION_TYPE TARGET CARGO_VERSION PROFILE LINK_AS)
403403
set(multi_value_args CONFIGURATION_TYPES CRATES)
404404
cmake_parse_arguments(
405405
GGC
@@ -482,7 +482,7 @@ function(_generator_add_cargo_targets)
482482
${ix}
483483
${GGC_CARGO_VERSION}
484484
"${GGC_PROFILE}"
485-
"${GGC_LINKER_LANGUAGE}"
485+
"${GGC_LINK_AS}"
486486
)
487487
endforeach()
488488

corrosion/generator/src/subcommands/gen_cmake.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const CONFIGURATION_ROOT: &str = "configuration-root";
2323
const TARGET: &str = "target";
2424
const CARGO_VERSION: &str = "cargo-version";
2525
const PROFILE: &str = "profile";
26-
const LINKER_LANGUAGE: &str = "linker-language";
26+
const LINK_AS: &str = "linker-language";
2727
const CRATES: &str = "crates";
2828
const NO_DEFAULT_LIBRARIES: &str = "no-default-libraries";
2929

@@ -94,9 +94,9 @@ pub fn subcommand() -> App<'static, 'static> {
9494
.help("Custom cargo profile to select."),
9595
)
9696
.arg(
97-
Arg::with_name(LINKER_LANGUAGE)
98-
.long(LINKER_LANGUAGE)
99-
.value_name("LINKER_LANGUAGE")
97+
Arg::with_name(LINK_AS)
98+
.long(LINK_AS)
99+
.value_name("LINK_AS")
100100
.required(false)
101101
.possible_values(&["C", "CXX", "Fortran"])
102102
.help("Language to select a linker by: C, CXX or Fortran.")
@@ -201,7 +201,7 @@ cmake_minimum_required(VERSION 3.15)
201201
.collect();
202202

203203
let cargo_profile = matches.value_of(PROFILE);
204-
let linker_language = matches.value_of(LINKER_LANGUAGE);
204+
let link_as = matches.value_of(LINK_AS);
205205

206206
for target in &targets {
207207
target
@@ -210,7 +210,7 @@ cmake_minimum_required(VERSION 3.15)
210210
&cargo_platform,
211211
&cargo_version,
212212
cargo_profile,
213-
linker_language,
213+
link_as,
214214
!matches.is_present(NO_DEFAULT_LIBRARIES),
215215
)
216216
.unwrap();

corrosion/generator/src/subcommands/gen_cmake/target.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl CargoTarget {
104104
platform: &super::platform::Platform,
105105
cargo_version: &semver::Version,
106106
cargo_profile: Option<&str>,
107-
linker_language: Option<&str>,
107+
link_as: Option<&str>,
108108
include_platform_libs: bool,
109109
) -> Result<(), Box<dyn Error>> {
110110
// This bit aggregates the byproducts of "cargo build", which is needed for generators like Ninja.
@@ -161,8 +161,8 @@ impl CargoTarget {
161161
String::default()
162162
};
163163

164-
let linker_language_option = if let Some(linker_language) = linker_language {
165-
format!("LINKER_LANGUAGE {}", linker_language)
164+
let link_as_option = if let Some(link_as) = link_as {
165+
format!("LINK_AS {}", link_as)
166166
}
167167
else {
168168
String::default()
@@ -286,7 +286,7 @@ _add_cargo_build(
286286
self.cargo_package.manifest_path.as_str().replace("\\", "/"),
287287
byproducts.join(" "),
288288
cargo_build_profile_option,
289-
linker_language_option
289+
link_as_option
290290
)?;
291291

292292
writeln!(out_file)?;

0 commit comments

Comments
 (0)