Skip to content

Commit

Permalink
Replaced the :: to __ conversion with CMake string(MAKE_C_IDENTIFIER).
Browse files Browse the repository at this point in the history
  • Loading branch information
obsgolem committed May 30, 2023
1 parent 3dffac2 commit 9b7e280
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmake/Corrosion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function(_corrosion_copy_byproduct_legacy target_name cargo_build_dir file_names
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}")
endif()

string(REPLACE "::" "__" target_name_cmake_underscore ${target_name})
string(MAKE_C_IDENTIFIER ${target_name} target_name_cmake_underscore)

list(TRANSFORM file_names PREPEND "${cargo_build_dir}/" OUTPUT_VARIABLE src_file_names)
list(TRANSFORM file_names PREPEND "${output_dir}/" OUTPUT_VARIABLE dst_file_names)
Expand All @@ -258,7 +258,7 @@ function(_corrosion_copy_byproduct_deferred target_name output_dir_prop_name car
endif()
get_target_property(output_dir ${target_name} "${output_dir_prop_name}")

string(REPLACE "::" "__" target_name_cmake_underscore ${target_name})
string(MAKE_C_IDENTIFIER ${target_name} target_name_cmake_underscore)

# A Genex expanding to the output directory depending on the configuration.
set(multiconfig_out_dir_genex "")
Expand Down Expand Up @@ -445,7 +445,7 @@ function(_corrosion_add_library_target)

add_library(${target_name_cmake} INTERFACE IMPORTED GLOBAL)

string(REPLACE "::" "__" target_name_cmake_underscore ${target_name_cmake})
string(MAKE_C_IDENTIFIER ${target_name_cmake} target_name_cmake_underscore)

if(has_staticlib)
add_library(${target_name_cmake_underscore}-static STATIC IMPORTED GLOBAL)
Expand Down Expand Up @@ -529,7 +529,7 @@ function(_corrosion_add_bin_target workspace_manifest_path bin_name target_name_
endif()
set(${out_bin_byproduct} "${bin_filename}" PARENT_SCOPE)

string(REPLACE "::" "__" target_name_cmake_underscore ${target_name_cmake})
string(MAKE_C_IDENTIFIER ${target_name_cmake} target_name_cmake_underscore)

# Todo: This is compatible with the way corrosion previously exposed the bin name,
# but maybe we want to prefix the exposed name with the package name?
Expand Down Expand Up @@ -682,7 +682,7 @@ function(_add_cargo_build out_cargo_build_out_dir)
set(package_name "${ACB_PACKAGE}")
set(target_name "${ACB_TARGET}")
set(target_name_cmake "${ACB_TARGET_NAME_CMAKE}")
string(REPLACE "::" "__" target_name_cmake_underscore ${target_name_cmake})
string(MAKE_C_IDENTIFIER ${target_name_cmake} target_name_cmake_underscore)
set(path_to_toml "${ACB_MANIFEST_PATH}")
set(target_kinds "${ACB_TARGET_KINDS}")
set(workspace_manifest_path "${ACB_WORKSPACE_MANIFEST_PATH}")
Expand Down

0 comments on commit 9b7e280

Please sign in to comment.