diff cmake/function/MalikaniaDefineExecutable.cmake @ 200:0a285d62ace7

windows: initial VS2017 support While here, do some cleanup in CMake files for a better hierarchy.
author David Demelier <markand@malikania.fr>
date Wed, 28 Nov 2018 22:01:55 +0100
parents 387f6b0a5420
children c973501abe36
line wrap: on
line diff
--- a/cmake/function/MalikaniaDefineExecutable.cmake	Tue Oct 30 13:21:55 2018 +0100
+++ b/cmake/function/MalikaniaDefineExecutable.cmake	Wed Nov 28 22:01:55 2018 +0100
@@ -22,22 +22,18 @@
 #
 # malikania_define_executable(
 #       TARGET          The target name
+#       FOLDER          Specify alternate folder
 #       SOURCES         The list of sources
 #       FLAGS           (Optional) List of flags
 #       INCLUDES        (Optional) List of include directories
 #       LIBRARIES       (Optional) List of libraries
 # )
 #
-# Create an executable. Be sure to quote SOURCES, if not only the first file will be passed.
-# If you need flags, just pass them without -D or /D, this is automatically done for you.
-#
-
-include(CMakeParseArguments)
 
 include(${CMAKE_CURRENT_LIST_DIR}/MalikaniaBuildAssets.cmake)
 
 function(malikania_define_executable)
-	set(singleArgs TARGET)
+	set(singleArgs FOLDER TARGET)
 	set(multiArgs ASSETS SOURCES FLAGS INCLUDES LIBRARIES)
 
 	cmake_parse_arguments(EXE "" "${singleArgs}" "${multiArgs}" ${ARGN})
@@ -60,17 +56,8 @@
 			${EXE_INCLUDES}
 	)
 	target_compile_definitions(${EXE_TARGET} PRIVATE ${EXE_FLAGS})
-	set_target_properties(
-		${EXE_TARGET}
-		PROPERTIES
-			RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-	)
-	foreach (c ${CMAKE_CONFIGURATION_TYPES})
-		string(TOUPPER ${c} cu)
-		set_target_properties(
-			${EXE_TARGET}
-			PROPERTIES
-				RUNTIME_OUTPUT_DIRECTORY_${cu} ${CMAKE_BINARY_DIR}/bin/${c}
-		)
-	endforeach()
+
+	if (EXE_FOLDER)
+		set_target_properties(${EXE_TARGET} PROPERTIES FOLDER ${EXE_FOLDER})
+	endif ()
 endfunction()