Move new behaviour into macro to reduce code duplication

pull/1435/head
AnyOldName3 7 years ago
parent 3c0ec0d6d0
commit 5ce34f1cbf

@ -4,7 +4,7 @@ set(BSATOOL
source_group(apps\\bsatool FILES ${BSATOOL}) source_group(apps\\bsatool FILES ${BSATOOL})
# Main executable # Main executable
add_executable(bsatool openmw_add_executable(bsatool
${BSATOOL} ${BSATOOL}
) )
@ -17,10 +17,4 @@ target_link_libraries(bsatool
if (BUILD_WITH_CODE_COVERAGE) if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage) add_definitions (--coverage)
target_link_libraries(bsatool gcov) target_link_libraries(bsatool gcov)
endif() endif()
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(bsatool PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -8,7 +8,7 @@ set(ESMTOOL
source_group(apps\\esmtool FILES ${ESMTOOL}) source_group(apps\\esmtool FILES ${ESMTOOL})
# Main executable # Main executable
add_executable(esmtool openmw_add_executable(esmtool
${ESMTOOL} ${ESMTOOL}
) )
@ -20,10 +20,4 @@ target_link_libraries(esmtool
if (BUILD_WITH_CODE_COVERAGE) if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage) add_definitions (--coverage)
target_link_libraries(esmtool gcov) target_link_libraries(esmtool gcov)
endif() endif()
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(esmtool PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -28,7 +28,7 @@ set(ESSIMPORTER_FILES
convertplayer.cpp convertplayer.cpp
) )
add_executable(openmw-essimporter openmw_add_executable(openmw-essimporter
${ESSIMPORTER_FILES} ${ESSIMPORTER_FILES}
) )
@ -45,10 +45,4 @@ endif()
if (WIN32) if (WIN32)
INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".") INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".")
endif(WIN32) endif(WIN32)
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw-essimporter PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -78,7 +78,7 @@ if(NOT WIN32)
endif(NOT WIN32) endif(NOT WIN32)
# Main executable # Main executable
add_executable(openmw-launcher openmw_add_executable(openmw-launcher
${GUI_TYPE} ${GUI_TYPE}
${LAUNCHER} ${LAUNCHER}
${LAUNCHER_HEADER} ${LAUNCHER_HEADER}
@ -108,10 +108,4 @@ endif()
if (BUILD_WITH_CODE_COVERAGE) if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage) add_definitions (--coverage)
target_link_libraries(openmw-launcher gcov) target_link_libraries(openmw-launcher gcov)
endif() endif()
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw-launcher PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -9,7 +9,7 @@ set(MWINIIMPORT_HEADER
source_group(launcher FILES ${MWINIIMPORT} ${MWINIIMPORT_HEADER}) source_group(launcher FILES ${MWINIIMPORT} ${MWINIIMPORT_HEADER})
add_executable(openmw-iniimporter openmw_add_executable(openmw-iniimporter
${MWINIIMPORT} ${MWINIIMPORT}
) )
@ -32,10 +32,4 @@ endif()
if (BUILD_WITH_CODE_COVERAGE) if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage) add_definitions (--coverage)
target_link_libraries(openmw-iniimporter gcov) target_link_libraries(openmw-iniimporter gcov)
endif() endif()
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw-iniimporter PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -4,7 +4,7 @@ set(NIFTEST
source_group(components\\nif\\tests FILES ${NIFTEST}) source_group(components\\nif\\tests FILES ${NIFTEST})
# Main executable # Main executable
add_executable(niftest openmw_add_executable(niftest
${NIFTEST} ${NIFTEST}
) )
@ -16,10 +16,4 @@ target_link_libraries(niftest
if (BUILD_WITH_CODE_COVERAGE) if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage) add_definitions (--coverage)
target_link_libraries(niftest gcov) target_link_libraries(niftest gcov)
endif() endif()
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(niftest PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -174,7 +174,7 @@ else()
set (OPENCS_OPENMW_CFG "") set (OPENCS_OPENMW_CFG "")
endif(APPLE) endif(APPLE)
add_executable(openmw-cs openmw_add_executable(openmw-cs
MACOSX_BUNDLE MACOSX_BUNDLE
${OPENCS_SRC} ${OPENCS_SRC}
${OPENCS_UI_HDR} ${OPENCS_UI_HDR}
@ -260,10 +260,6 @@ if (MSVC)
if (CMAKE_CL_64) if (CMAKE_CL_64)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
endif (CMAKE_CL_64) endif (CMAKE_CL_64)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw-cs PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC) endif (MSVC)

@ -99,7 +99,7 @@ add_openmw_dir (mwbase
# Main executable # Main executable
if (NOT ANDROID) if (NOT ANDROID)
add_executable(openmw openmw_add_executable(openmw
${OPENMW_FILES} ${OPENMW_FILES}
${GAME} ${GAME_HEADER} ${GAME} ${GAME_HEADER}
${APPLE_BUNDLE_RESOURCES} ${APPLE_BUNDLE_RESOURCES}
@ -215,10 +215,6 @@ if (MSVC)
if (CMAKE_CL_64) if (CMAKE_CL_64)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
endif (CMAKE_CL_64) endif (CMAKE_CL_64)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC) endif (MSVC)
if (WIN32) if (WIN32)

@ -17,19 +17,13 @@ if (GTEST_FOUND)
source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES}) source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
add_executable(openmw_test_suite openmw_test_suite.cpp ${UNITTEST_SRC_FILES}) openmw_add_executable(openmw_test_suite openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
target_link_libraries(openmw_test_suite ${GTEST_BOTH_LIBRARIES} components) target_link_libraries(openmw_test_suite ${GTEST_BOTH_LIBRARIES} components)
# Fix for not visible pthreads functions for linker with glibc 2.15 # Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
target_link_libraries(openmw_test_suite ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(openmw_test_suite ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw_test_suite PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)
endif() endif()

@ -96,7 +96,7 @@ if (OPENMW_USE_UNSHIELD)
include_directories(${LIBUNSHIELD_INCLUDE_DIRS}) include_directories(${LIBUNSHIELD_INCLUDE_DIRS})
endif() endif()
add_executable(openmw-wizard openmw_add_executable(openmw-wizard
${GUI_TYPE} ${GUI_TYPE}
${WIZARD} ${WIZARD}
${WIZARD_HEADER} ${WIZARD_HEADER}
@ -143,9 +143,3 @@ endif()
if (WIN32) if (WIN32)
INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION ".") INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION ".")
endif(WIN32) endif(WIN32)
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(openmw-wizard PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)

@ -142,3 +142,12 @@ foreach (u ${ARGN})
add_hdr (OPENCS ${dir} ${u}) add_hdr (OPENCS ${dir} ${u})
endforeach (u) endforeach (u)
endmacro (opencs_hdrs_noqt) endmacro (opencs_hdrs_noqt)
macro (openmw_add_executable target)
add_executable(${target} ${ARGN})
if (MSVC)
if (CMAKE_VERSION VERSION_GREATER 3.8)
set_target_properties(${target} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
endif (CMAKE_VERSION VERSION_GREATER 3.8)
endif (MSVC)
endmacro (openmw_add_executable)

Loading…
Cancel
Save