shithub: cstory

Download patch

ref: 896b09f33624161319f13023ec1e5d2e68803e53
parent: ac465d29b4a5a057709f0b18f57299cd204f7622
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Apr 25 22:50:23 EDT 2019

Fixed some CMake problems that were preventing builds on Windows

FLTK kinda sucks

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,17 +15,6 @@
 
 project(CSE2 LANGUAGES C CXX)
 
-if(MSVC)
-	# Static-link the CRT, so we don't need to lug around 10 different DLLs
-	foreach(FLAG_VAR
-			CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
-			CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
-		if(${FLAG_VAR} MATCHES "/MD")
-			string(REGEX REPLACE "/MD" "/MT" ${FLAG_VAR} "${${FLAG_VAR}}")
-		endif()
-	endforeach()
-endif()
-
 ##
 # CSE2
 ##
@@ -365,9 +354,16 @@
 	target_link_libraries(DoConfig ${FLTK_LIBRARIES})
 else()
 	# Compile it ourselves
-	message(STATUS "Using system FLTK")
+	message(STATUS "Using local FLTK")
+	# Clear this or it will cause an error during FLTK's configuration.
+	# FLTK only appends to it, so the leftover junk gets fed into a bunch
+	# of important functions. THAT was no fun to debug.
+	set(FLTK_LIBRARIES)
 	set(OPTION_BUILD_EXAMPLES OFF)	# Needed to prevent a name collision
 	add_subdirectory(external/fltk EXCLUDE_FROM_ALL)
+	get_target_property(DIRS fltk INCLUDE_DIRECTORIES)	# FLTK doesn't mark its includes as PUBLIC or INTERFACE, so we have to do this stupidity
+	message(STATUS "DIRS is ${DIRS}")
+	target_include_directories(DoConfig PRIVATE ${DIRS})
 	target_link_libraries(DoConfig fltk)
 endif()