mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-04-23 14:19:53 +08:00
Silence unknown link language warnings.
Fixes https://github.com/google/draco/issues/162
This commit is contained in:
parent
10af829784
commit
d0f313d292
@ -6,6 +6,7 @@ set(draco_src_root "${draco_root}/src/draco")
|
||||
set(draco_build_dir "${CMAKE_BINARY_DIR}")
|
||||
|
||||
include("${draco_root}/cmake/compiler_flags.cmake")
|
||||
include("${draco_root}/cmake/util.cmake")
|
||||
|
||||
# Draco requires C++11 support.
|
||||
require_cxx_flag_nomsvc("-std=c++11" YES)
|
||||
@ -760,6 +761,11 @@ else ()
|
||||
$<TARGET_OBJECTS:draco_points_dec>
|
||||
$<TARGET_OBJECTS:draco_points_enc>)
|
||||
|
||||
set(draco_header_only_targets
|
||||
draco_compression_attributes_pred_schemes_dec
|
||||
draco_dec_config
|
||||
draco_enc_config)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set_target_properties(dracodec PROPERTIES SOVERSION 1)
|
||||
set_target_properties(dracoenc PROPERTIES SOVERSION 1)
|
||||
@ -832,4 +838,10 @@ else ()
|
||||
"${CMAKE_INSTALL_PREFIX}/bin")
|
||||
install(FILES "${draco_root}/cmake/FindDraco.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/draco/cmake")
|
||||
|
||||
# Some generators complain about unknown link language for header only
|
||||
# targets. Silence the harmless warnings/errors with some dummy source files.
|
||||
foreach (target ${draco_header_only_targets})
|
||||
add_dummy_source_file_to_target("${target}" "cc")
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
20
cmake/util.cmake
Normal file
20
cmake/util.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
if (NOT DRACO_CMAKE_UTIL_CMAKE_)
|
||||
set(DRACO_CMAKE_UTIL_CMAKE_ 1)
|
||||
|
||||
function (create_dummy_source_file basename extension out_file_path)
|
||||
set(dummy_source_file "${draco_build_dir}/${basename}.${extension}")
|
||||
file(WRITE "${dummy_source_file}"
|
||||
"// Generated file. DO NOT EDIT!\n"
|
||||
"// ${target_name} needs a ${extension} file to force link language, \n"
|
||||
"// or to silence a harmless CMake warning: Ignore me.\n"
|
||||
"void ${target_name}_dummy_function(void) {}\n")
|
||||
set(${out_file_path} ${dummy_source_file} PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
function (add_dummy_source_file_to_target target_name extension)
|
||||
create_dummy_source_file("${target_name}" "${extension}" "dummy_source_file")
|
||||
target_sources(${target_name} PRIVATE ${dummy_source_file})
|
||||
endfunction ()
|
||||
|
||||
endif() # DRACO_CMAKE_UTIL_CMAKE_
|
||||
|
Loading…
x
Reference in New Issue
Block a user