mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	cmake: fix USE_SYSTEM_BOOST behavior ... (#6837)
This commit is contained in:
		
							parent
							
								
									6f7612f73d
								
							
						
					
					
						commit
						7e6a761f07
					
				
					 2 changed files with 32 additions and 31 deletions
				
			
		|  | @ -341,13 +341,6 @@ function(get_timestamp _var) | |||
|     set(${_var} "${timestamp}" PARENT_SCOPE) | ||||
| endfunction() | ||||
| 
 | ||||
| # Prevent boost from linking against libs when building | ||||
| add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY | ||||
|     -DBOOST_SYSTEM_NO_LIB | ||||
|     -DBOOST_DATE_TIME_NO_LIB | ||||
|     -DBOOST_REGEX_NO_LIB | ||||
| ) | ||||
| 
 | ||||
| # generate git/build information | ||||
| include(GetGitRevisionDescription) | ||||
| get_git_head_revision(GIT_REF_SPEC GIT_REV) | ||||
|  | @ -355,17 +348,23 @@ git_describe(GIT_DESC --always --long --dirty) | |||
| git_branch_name(GIT_BRANCH) | ||||
| get_timestamp(BUILD_DATE) | ||||
| 
 | ||||
| if (NOT USE_SYSTEM_BOOST) | ||||
|     add_definitions( -DBOOST_ALL_NO_LIB ) | ||||
| # Boost | ||||
| # Prevent boost from linking against libs when building | ||||
| add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY | ||||
|     -DBOOST_SYSTEM_NO_LIB | ||||
|     -DBOOST_DATE_TIME_NO_LIB | ||||
|     -DBOOST_REGEX_NO_LIB | ||||
| ) | ||||
| if (USE_SYSTEM_BOOST) | ||||
|     find_package(Boost 1.70.0 COMPONENTS container locale serialization iostreams REQUIRED) | ||||
| endif() | ||||
| 
 | ||||
| enable_testing() | ||||
| add_subdirectory(externals) | ||||
| 
 | ||||
| # Boost | ||||
| if (USE_SYSTEM_BOOST) | ||||
|     find_package(Boost 1.70.0 COMPONENTS serialization iostreams REQUIRED) | ||||
| else() | ||||
| # Boost (bundled) | ||||
| if (NOT USE_SYSTEM_BOOST) | ||||
|     add_definitions( -DBOOST_ALL_NO_LIB ) | ||||
|     add_library(Boost::boost ALIAS boost) | ||||
|     add_library(Boost::serialization ALIAS boost_serialization) | ||||
|     add_library(Boost::iostreams ALIAS boost_iostreams) | ||||
|  |  | |||
							
								
								
									
										38
									
								
								externals/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								externals/CMakeLists.txt
									
										
									
									
										vendored
									
									
								
							|  | @ -12,27 +12,29 @@ include(DownloadExternals) | |||
| include(ExternalProject) | ||||
| 
 | ||||
| # Boost | ||||
| set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "") | ||||
| set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "") | ||||
| set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "") | ||||
| add_library(boost INTERFACE) | ||||
| target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR}) | ||||
| if (NOT USE_SYSTEM_BOOST) | ||||
|     message(STATUS "Including vendored Boost library") | ||||
|     set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "") | ||||
|     set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "") | ||||
|     set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "") | ||||
|     add_library(boost INTERFACE) | ||||
|     target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR}) | ||||
| 
 | ||||
| # Boost::serialization | ||||
| file(GLOB boost_serialization_SRC "${CMAKE_SOURCE_DIR}/externals/boost/libs/serialization/src/*.cpp") | ||||
| add_library(boost_serialization STATIC ${boost_serialization_SRC}) | ||||
| target_link_libraries(boost_serialization PUBLIC boost) | ||||
| 
 | ||||
| # Boost::iostreams | ||||
| add_library( | ||||
|     boost_iostreams | ||||
|     STATIC | ||||
|     ${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/file_descriptor.cpp | ||||
|     ${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/mapped_file.cpp | ||||
| ) | ||||
| target_link_libraries(boost_iostreams PUBLIC boost) | ||||
|     # Boost::serialization | ||||
|     file(GLOB boost_serialization_SRC "${CMAKE_SOURCE_DIR}/externals/boost/libs/serialization/src/*.cpp") | ||||
|     add_library(boost_serialization STATIC ${boost_serialization_SRC}) | ||||
|     target_link_libraries(boost_serialization PUBLIC boost) | ||||
| 
 | ||||
|     # Boost::iostreams | ||||
|     add_library( | ||||
|         boost_iostreams | ||||
|         STATIC | ||||
|         ${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/file_descriptor.cpp | ||||
|         ${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/mapped_file.cpp | ||||
|     ) | ||||
|     target_link_libraries(boost_iostreams PUBLIC boost) | ||||
| # Add additional boost libs here; remember to ALIAS them in the root CMakeLists! | ||||
| endif() | ||||
| 
 | ||||
| # Catch2 | ||||
| set(CATCH_INSTALL_DOCS OFF CACHE BOOL "") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue