[Cmake] Added directory tree to VS solution.
This recreates structure from premake almost 1:1
This commit is contained in:
@@ -94,6 +94,27 @@ function(xe_target_defaults target)
|
|||||||
)
|
)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${target} PRIVATE /WX)
|
target_compile_options(${target} PRIVATE /WX)
|
||||||
|
# Recreate directory structure in Visual Studio filters
|
||||||
|
get_target_property(_srcs ${target} SOURCES)
|
||||||
|
if(_srcs)
|
||||||
|
set(_local_srcs)
|
||||||
|
set(_external_srcs)
|
||||||
|
foreach(_s IN LISTS _srcs)
|
||||||
|
get_filename_component(_abs "${_s}" ABSOLUTE)
|
||||||
|
string(FIND "${_abs}" "${CMAKE_CURRENT_SOURCE_DIR}" _pos)
|
||||||
|
if(_pos EQUAL 0)
|
||||||
|
list(APPEND _local_srcs "${_s}")
|
||||||
|
else()
|
||||||
|
list(APPEND _external_srcs "${_s}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(_local_srcs)
|
||||||
|
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${_local_srcs})
|
||||||
|
endif()
|
||||||
|
if(_external_srcs)
|
||||||
|
source_group(TREE ${PROJECT_SOURCE_DIR} PREFIX "External" FILES ${_external_srcs})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
elseif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
elseif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# GCC is too noisy for -Werror; only apply to Clang
|
# GCC is too noisy for -Werror; only apply to Clang
|
||||||
target_compile_options(${target} PRIVATE -Werror)
|
target_compile_options(${target} PRIVATE -Werror)
|
||||||
@@ -242,6 +263,7 @@ function(xe_test_suite name base_path)
|
|||||||
target_link_libraries(${name} PRIVATE ${ARG_LINKS})
|
target_link_libraries(${name} PRIVATE ${ARG_LINKS})
|
||||||
endif()
|
endif()
|
||||||
xe_target_defaults(${name})
|
xe_target_defaults(${name})
|
||||||
|
set_target_properties(${name} PROPERTIES FOLDER "tests")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Disable Edit and Continue - breaks Catch2 __LINE__ usage
|
# Disable Edit and Continue - breaks Catch2 __LINE__ usage
|
||||||
|
|||||||
Reference in New Issue
Block a user