changeset 138:ff26bd33a45d

CMake: improve VS2015 support, #425
author David Demelier <markand@malikania.fr>
date Thu, 19 May 2016 13:00:00 +0200
parents bc291b131f6a
children f94e42e8bf1c
files CMakeLists.txt cmake/IrccdPackage.cmake cmake/IrccdSystem.cmake cmake/function/IrccdDefineHtml.cmake cmake/function/IrccdDefineTest.cmake doc/CMakeLists.txt doc/examples/CMakeLists.txt doc/html/api/CMakeLists.txt doc/html/guide/CMakeLists.txt doc/html/resources/CMakeLists.txt extern/cppformat/CMakeLists.txt extern/duktape/CMakeLists.txt extern/gtest/CMakeLists.txt extern/jansson/CMakeLists.txt extern/libircclient/CMakeLists.txt lib/CMakeLists.txt plugins/CMakeLists.txt
diffstat 17 files changed, 98 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -51,6 +51,8 @@
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${irccd_SOURCE_DIR}/cmake/packages)
 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
 
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
 include(CMakeParseArguments)
 
 include(cmake/function/IrccdDefineExecutable.cmake)
--- a/cmake/IrccdPackage.cmake	Thu May 19 12:52:00 2016 +0200
+++ b/cmake/IrccdPackage.cmake	Thu May 19 13:00:00 2016 +0200
@@ -76,7 +76,7 @@
 	configure_file(cmake/installer/packages/docs.xml.in ${PKGDIR}/docs/meta/package.xml)
 
 	# Main dependencies.
-	set(dependencies irccd irccdctl docs)
+	set(dependencies irccd irccdctl all-docs)
 
 	# Build commands for plugins.
 	foreach (plugin ${IRCCD_PLUGINS})
--- a/cmake/IrccdSystem.cmake	Thu May 19 12:52:00 2016 +0200
+++ b/cmake/IrccdSystem.cmake	Thu May 19 13:00:00 2016 +0200
@@ -54,14 +54,15 @@
 	else ()
 		set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++14 ${CMAKE_CXX_FLAGS}")
 	endif ()
+elseif (MSVC14)
+	set(CMAKE_C_FLAGS "/DWIN32_LEAN_AND_MEAN /DNOMINMAX /wd4267 /wd48000 /D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS}")
+	set(CMAKE_CXX_FLAGS "/DWIN32_LEAN_AND_MEAN /DNOMINMAX /wd4267 /wd4800 /D_CRT_SECURE_NO_WARNINGS /EHsc ${CMAKE_CXX_FLAGS}")
 else ()
 	message(WARNING "Unsupported ${CMAKE_CXX_COMPILER_ID}, may not build correctly.")
 endif ()
 
 if (MINGW)
 	set(CMAKE_CXX_FLAGS "-D_WIN32_WINNT=0x0600 ${CMAKE_CXX_FLAGS}")
-elseif (MSVC)
-	set(CMAKE_CXX_FLAGS "/DWIN32_LEAN_AND_MEAN /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /EHsc")
 endif ()
 
 if (CMAKE_SIZEOF_VOID_P MATCHES "8")
--- a/cmake/function/IrccdDefineHtml.cmake	Thu May 19 12:52:00 2016 +0200
+++ b/cmake/function/IrccdDefineHtml.cmake	Thu May 19 13:00:00 2016 +0200
@@ -142,5 +142,5 @@
 		)
 	endif ()
 
-	add_dependencies(docs ${HTML_TARGET})
+	add_dependencies(all-docs ${HTML_TARGET})
 endfunction()
--- a/cmake/function/IrccdDefineTest.cmake	Thu May 19 12:52:00 2016 +0200
+++ b/cmake/function/IrccdDefineTest.cmake	Thu May 19 13:00:00 2016 +0200
@@ -81,6 +81,8 @@
 	set_target_properties(
 		test-${TEST_NAME}
 		PROPERTIES
+			PROJECT_LABEL ${TEST_NAME}
+			FOLDER test
 			RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
 			RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/tests
 			RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/tests
--- a/doc/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/doc/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -20,7 +20,7 @@
 
 # Meta targets `docs`
 add_custom_target(
-	docs ALL
+	all-docs ALL
 	COMMENT "Building irccd documentation"
 	SOURCES
 		${doc_SOURCE_DIR}/procs/README.md
@@ -31,7 +31,12 @@
 		${doc_SOURCE_DIR}/procs/60.new-command.md
 )
 
-# Needed for fakeroot
+set_target_properties(
+	all-docs
+	PROPERTIES
+		FOLDER meta
+)
+
 if (WITH_DOXYGEN)
 	add_subdirectory(doxygen)
 endif ()
--- a/doc/examples/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/doc/examples/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -41,7 +41,14 @@
 		${CMAKE_CURRENT_SOURCE_DIR}/irccdctl.conf
 )
 
-add_dependencies(docs docs-examples)
+set_target_properties(
+	docs-examples
+	PROPERTIES
+		PROJECT_LABEL examples
+		FOLDER docs
+)
+
+add_dependencies(all-docs docs-examples)
 
 install(
 	FILES irccdctl.conf
--- a/doc/html/api/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/doc/html/api/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -57,3 +57,10 @@
 	TARGET docs-api
 	ARGS -Vjs
 )
+
+set_target_properties(
+	docs-api
+	PROPERTIES
+		PROJECT_LABEL api
+		FOLDER docs
+)
\ No newline at end of file
--- a/doc/html/guide/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/doc/html/guide/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -43,3 +43,10 @@
 	SOURCES ${SOURCES}
 	ARGS --toc --toc-depth=2 -Vguide
 )
+
+set_target_properties(
+	docs-guide
+	PROPERTIES
+		PROJECT_LABEL guide
+		FOLDER docs
+)
\ No newline at end of file
--- a/doc/html/resources/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/doc/html/resources/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -62,4 +62,11 @@
 	DEPENDS ${OUTPUTS}
 )
 
-add_dependencies(docs docs-resources)
+set_target_properties(
+	docs-resources
+	PROPERTIES
+		PROJECT_LABEL resources
+		FOLDER docs
+)
+
+add_dependencies(all-docs docs-resources)
--- a/extern/cppformat/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/extern/cppformat/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -18,5 +18,11 @@
 
 cmake_minimum_required(VERSION 3.0)
 project(cppformat)
-add_library(cppformat STATIC format.cc format.h)
-target_include_directories(cppformat PUBLIC ${cppformat_SOURCE_DIR})
+add_library(extern-cppformat STATIC format.cc format.h)
+target_include_directories(extern-cppformat PUBLIC ${cppformat_SOURCE_DIR})
+set_target_properties(
+	extern-cppformat
+	PROPERTIES
+		PROJECT_LABEL cppformat
+		FOLDER extern
+)
\ No newline at end of file
--- a/extern/duktape/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/extern/duktape/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -27,3 +27,10 @@
 		duktape.h
 	PUBLIC_INCLUDES ${duktape_SOURCE_DIR}
 )
+
+set_target_properties(
+	extern-duktape
+	PROPERTIES
+		PROJECT_LABEL duktape
+		FOLDER extern
+)
\ No newline at end of file
--- a/extern/gtest/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/extern/gtest/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -28,3 +28,10 @@
 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
 	target_compile_options(extern-gtest PRIVATE -Wno-missing-field-initializers)
 endif ()
+
+set_target_properties(
+	extern-gtest
+	PROPERTIES
+		PROJECT_LABEL gtest
+		FOLDER extern
+)
\ No newline at end of file
--- a/extern/jansson/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/extern/jansson/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -275,3 +275,10 @@
 		"${jansson_SOURCE_DIR}/include"
 		"${jansson_BINARY_DIR}/include"
 )
+
+set_target_properties(
+	extern-jansson
+	PROPERTIES
+		PROJECT_LABEL jansson
+		FOLDER extern
+)
\ No newline at end of file
--- a/extern/libircclient/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/extern/libircclient/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -59,3 +59,10 @@
 	PUBLIC_INCLUDES "${extern-libircclient_SOURCE_DIR}/include"
 	LOCAL_INCLUDES ${INCLUDES}
 )
+
+set_target_properties(
+	extern-ircclient
+	PROPERTIES
+		PROJECT_LABEL libircclient
+		FOLDER extern
+)
\ No newline at end of file
--- a/lib/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/lib/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -42,7 +42,7 @@
 	list(APPEND LIBRARIES dl)
 endif ()
 
-target_link_libraries(libirccd extern-duktape extern-ircclient extern-jansson cppformat ${LIBRARIES})
+target_link_libraries(libirccd extern-duktape extern-ircclient extern-jansson extern-cppformat ${LIBRARIES})
 
 set_target_properties(
 	libirccd
--- a/plugins/CMakeLists.txt	Thu May 19 12:52:00 2016 +0200
+++ b/plugins/CMakeLists.txt	Thu May 19 13:00:00 2016 +0200
@@ -19,10 +19,16 @@
 project(plugins)
 
 add_custom_target(
-	plugins ALL
+	all-plugins ALL
 	COMMENT "Irccd plugins"
 )
 
+set_target_properties(
+	all-plugins
+	PROPERTIES
+		FOLDER meta
+)
+
 foreach (plugin ${IRCCD_PLUGINS})
 	string(TOUPPER ${plugin} optname)
 
@@ -61,6 +67,13 @@
 				${plugin}/${plugin}.md
 		)
 
-		add_dependencies(plugins plugin-${plugin})
+		set_target_properties(
+			plugin-${plugin}
+			PROPERTIES
+				PROJECT_LABEL ${plugin}
+				FOLDER plugins
+		)
+
+		add_dependencies(all-plugins plugin-${plugin})
 	endif ()
 endforeach ()