diff --git a/apps/bsatool/CMakeLists.txt b/apps/bsatool/CMakeLists.txt index 19c9558cf..167ab9d2c 100644 --- a/apps/bsatool/CMakeLists.txt +++ b/apps/bsatool/CMakeLists.txt @@ -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) \ No newline at end of file +endif() \ No newline at end of file diff --git a/apps/esmtool/CMakeLists.txt b/apps/esmtool/CMakeLists.txt index b0c67d8fa..90964f2d7 100644 --- a/apps/esmtool/CMakeLists.txt +++ b/apps/esmtool/CMakeLists.txt @@ -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) \ No newline at end of file +endif() \ No newline at end of file diff --git a/apps/essimporter/CMakeLists.txt b/apps/essimporter/CMakeLists.txt index a7c25ca2e..69200583e 100644 --- a/apps/essimporter/CMakeLists.txt +++ b/apps/essimporter/CMakeLists.txt @@ -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) \ No newline at end of file +endif(WIN32) \ No newline at end of file diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 5d70aa917..70a6708a8 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -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) \ No newline at end of file +endif() \ No newline at end of file diff --git a/apps/mwiniimporter/CMakeLists.txt b/apps/mwiniimporter/CMakeLists.txt index 071137556..f1717a4c3 100644 --- a/apps/mwiniimporter/CMakeLists.txt +++ b/apps/mwiniimporter/CMakeLists.txt @@ -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) \ No newline at end of file +endif() \ No newline at end of file diff --git a/apps/niftest/CMakeLists.txt b/apps/niftest/CMakeLists.txt index efe440ae7..10119d7d7 100644 --- a/apps/niftest/CMakeLists.txt +++ b/apps/niftest/CMakeLists.txt @@ -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) \ No newline at end of file +endif() \ No newline at end of file diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 65c1d8ed8..281921c81 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -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) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 3ef62dfa3..134953f3d 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -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) diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt index 7d6898367..9b09bc41f 100644 --- a/apps/openmw_test_suite/CMakeLists.txt +++ b/apps/openmw_test_suite/CMakeLists.txt @@ -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() diff --git a/apps/wizard/CMakeLists.txt b/apps/wizard/CMakeLists.txt index 2d9a11c51..5f7338e52 100644 --- a/apps/wizard/CMakeLists.txt +++ b/apps/wizard/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index c5669fa70..9a1722dab 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -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)