Move new behaviour into macro to reduce code duplication

pull/287/head^2
AnyOldName3 7 years ago
parent 3c0ec0d6d0
commit 5ce34f1cbf

@ -4,7 +4,7 @@ set(BSATOOL
source_group(apps\\bsatool FILES ${BSATOOL})
# Main executable
add_executable(bsatool
openmw_add_executable(bsatool
${BSATOOL}
)
@ -17,10 +17,4 @@ target_link_libraries(bsatool
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(bsatool gcov)
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)
endif()

@ -8,7 +8,7 @@ set(ESMTOOL
source_group(apps\\esmtool FILES ${ESMTOOL})
# Main executable
add_executable(esmtool
openmw_add_executable(esmtool
${ESMTOOL}
)
@ -20,10 +20,4 @@ target_link_libraries(esmtool
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(esmtool gcov)
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)
endif()

@ -28,7 +28,7 @@ set(ESSIMPORTER_FILES
convertplayer.cpp
)
add_executable(openmw-essimporter
openmw_add_executable(openmw-essimporter
${ESSIMPORTER_FILES}
)
@ -45,10 +45,4 @@ endif()
if (WIN32)
INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".")
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)
endif(WIN32)

@ -78,7 +78,7 @@ if(NOT WIN32)
endif(NOT WIN32)
# Main executable
add_executable(openmw-launcher
openmw_add_executable(openmw-launcher
${GUI_TYPE}
${LAUNCHER}
${LAUNCHER_HEADER}
@ -108,10 +108,4 @@ endif()
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(openmw-launcher gcov)
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)
endif()

@ -9,7 +9,7 @@ set(MWINIIMPORT_HEADER
source_group(launcher FILES ${MWINIIMPORT} ${MWINIIMPORT_HEADER})
add_executable(openmw-iniimporter
openmw_add_executable(openmw-iniimporter
${MWINIIMPORT}
)
@ -32,10 +32,4 @@ endif()
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(openmw-iniimporter gcov)
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)
endif()

@ -4,7 +4,7 @@ set(NIFTEST
source_group(components\\nif\\tests FILES ${NIFTEST})
# Main executable
add_executable(niftest
openmw_add_executable(niftest
${NIFTEST}
)
@ -16,10 +16,4 @@ target_link_libraries(niftest
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(niftest gcov)
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)
endif()

@ -174,7 +174,7 @@ else()
set (OPENCS_OPENMW_CFG "")
endif(APPLE)
add_executable(openmw-cs
openmw_add_executable(openmw-cs
MACOSX_BUNDLE
${OPENCS_SRC}
${OPENCS_UI_HDR}
@ -260,10 +260,6 @@ if (MSVC)
if (CMAKE_CL_64)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
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)

@ -99,7 +99,7 @@ add_openmw_dir (mwbase
# Main executable
if (NOT ANDROID)
add_executable(openmw
openmw_add_executable(openmw
${OPENMW_FILES}
${GAME} ${GAME_HEADER}
${APPLE_BUNDLE_RESOURCES}
@ -215,10 +215,6 @@ if (MSVC)
if (CMAKE_CL_64)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
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)
if (WIN32)

@ -17,19 +17,13 @@ if (GTEST_FOUND)
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)
# Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE)
target_link_libraries(openmw_test_suite ${CMAKE_THREAD_LIBS_INIT})
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()

@ -96,7 +96,7 @@ if (OPENMW_USE_UNSHIELD)
include_directories(${LIBUNSHIELD_INCLUDE_DIRS})
endif()
add_executable(openmw-wizard
openmw_add_executable(openmw-wizard
${GUI_TYPE}
${WIZARD}
${WIZARD_HEADER}
@ -143,9 +143,3 @@ endif()
if (WIN32)
INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION ".")
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})
endforeach (u)
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