From f9fcb25d521d11b425e1071a95ed342d9ddbef97 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Sep 2020 16:00:15 +0200 Subject: CMake: clean up setting of platform specific linker flags Set flags directly on the target, and use common function for all cases. This refactoring helps with the next commit for test executables. Ref D8714 --- source/blender/blenlib/tests/performance/CMakeLists.txt | 3 --- source/blender/blentranslation/msgfmt/CMakeLists.txt | 5 +---- source/blender/datatoc/CMakeLists.txt | 2 +- source/blender/makesdna/intern/CMakeLists.txt | 2 +- source/blender/makesrna/intern/CMakeLists.txt | 2 +- source/creator/CMakeLists.txt | 15 +++++---------- 6 files changed, 9 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/tests/performance/CMakeLists.txt b/source/blender/blenlib/tests/performance/CMakeLists.txt index 88fbed0a49b..5342dbe286c 100644 --- a/source/blender/blenlib/tests/performance/CMakeLists.txt +++ b/source/blender/blenlib/tests/performance/CMakeLists.txt @@ -26,8 +26,5 @@ set(INC setup_libdirs() include_directories(${INC}) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}") -set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}") - BLENDER_TEST_PERFORMANCE(BLI_ghash_performance "bf_blenlib") BLENDER_TEST_PERFORMANCE(BLI_task_performance "bf_blenlib") diff --git a/source/blender/blentranslation/msgfmt/CMakeLists.txt b/source/blender/blentranslation/msgfmt/CMakeLists.txt index 350473fa195..20f5053bd29 100644 --- a/source/blender/blentranslation/msgfmt/CMakeLists.txt +++ b/source/blender/blentranslation/msgfmt/CMakeLists.txt @@ -33,15 +33,12 @@ set(SRC setup_libdirs() add_cc_flags_custom_test(msgfmt) -if(APPLE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}") -endif() - if(WIN32) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /nodefaultlib:MSVCRT.lib") endif() add_executable(msgfmt ${SRC}) +setup_platform_linker_flags(msgfmt) target_link_libraries(msgfmt bf_blenlib) target_link_libraries(msgfmt bf_intern_guardedalloc) diff --git a/source/blender/datatoc/CMakeLists.txt b/source/blender/datatoc/CMakeLists.txt index b750edd044e..3253db2314d 100644 --- a/source/blender/datatoc/CMakeLists.txt +++ b/source/blender/datatoc/CMakeLists.txt @@ -34,7 +34,7 @@ if(NOT WITH_HEADLESS) set(SRC datatoc_icon.c ) - setup_platform_linker_flags() + setup_platform_linker_flags(datatoc) if(WIN32) include_directories( ../blenlib diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 9808740e030..e902474deb1 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -56,9 +56,9 @@ endif() # SRC_DNA_INC is defined in the parent dir add_cc_flags_custom_test(makesdna) -setup_platform_linker_flags() add_executable(makesdna ${SRC} ${SRC_DNA_INC}) +setup_platform_linker_flags(makesdna) if(WIN32 AND NOT UNIX) target_link_libraries(makesdna ${PTHREADS_LIBRARIES}) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 976035b9886..386777db739 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -386,9 +386,9 @@ blender_include_dirs( ) add_cc_flags_custom_test(makesrna) -setup_platform_linker_flags() add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC}) +setup_platform_linker_flags(makesrna) target_link_libraries(makesrna bf_dna) target_link_libraries(makesrna bf_dna_blenlib) diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 43f77556ba1..ae672aa3b5c 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -256,13 +256,7 @@ if(WITH_PYTHON_MODULE) ) if(APPLE) - set_target_properties( - blender - PROPERTIES - MACOSX_BUNDLE TRUE - LINK_FLAGS_RELEASE "${PLATFORM_LINKFLAGS}" - LINK_FLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG}" - ) + set_target_properties(blender PROPERTIES MACOSX_BUNDLE TRUE) endif() if(WIN32) @@ -1127,7 +1121,8 @@ add_dependencies(blender makesdna) target_link_libraries(blender ${LIB}) unset(LIB) -setup_liblinks(blender) +setup_platform_linker_flags(blender) +setup_platform_linker_libs(blender) if(APPLE) set_target_properties(blender PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/osx_locals.map) @@ -1162,9 +1157,9 @@ if(WIN32) # CMAKE_BUILD_TYPE. This can be simplified by target_link_options and the $ # generator expression in newer cmake (2.13+) but until that time this fill have suffice. if(CMAKE_BUILD_TYPE) - set_property(TARGET blender APPEND PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/blender_public.pdb") + set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/blender_public.pdb") else() - set_property(TARGET blender APPEND PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/blender_public.pdb") + set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/blender_public.pdb") endif() endif() endif() -- cgit v1.2.3