[CMake] Create prettier MSVC solution files

This commit is contained in:
Martijn van Beurden 2021-12-28 11:55:59 +01:00
parent 2013738622
commit f5efd956d9
4 changed files with 26 additions and 0 deletions

View File

@ -129,6 +129,29 @@ if(BUILD_TESTING)
add_subdirectory("test")
endif()
# The following folder layout is mostly for MSVC
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_target_properties(FLAC grabbag getopt replaygain_analysis replaygain_synthesis utf8 PROPERTIES FOLDER Libraries)
if(BUILD_CXXLIBS)
set_target_properties(FLAC++ PROPERTIES FOLDER Libraries)
endif()
if(BUILD_PROGRAMS)
set_target_properties(flacapp metaflac PROPERTIES FOLDER Programs)
endif()
if(BUILD_TESTING)
set_target_properties(test_libFLAC test_libs_common test_picture test_seeking test_streams test_cuesheet PROPERTIES FOLDER Tests)
if(BUILD_CXXLIBS)
set_target_properties(test_libFLAC++ PROPERTIES FOLDER Tests)
endif()
endif()
if(BUILD_EXAMPLES)
set_target_properties(decode_file decode_file_cxx encode_file encode_file_cxx PROPERTIES FOLDER Examples)
endif()
if(BUILD_UTILS)
set_target_properties(flacdiff flactimer PROPERTIES FOLDER Utils)
endif()
configure_file(config.cmake.h.in config.h)
if(INSTALL_CMAKE_CONFIG_MODULE)

View File

@ -13,6 +13,7 @@ add_executable(flacapp
$<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h>
$<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>)
set_property(TARGET flacapp PROPERTY RUNTIME_OUTPUT_NAME flac)
set_property(TARGET flacapp PROPERTY PROJECT_LABEL "flac")
target_link_libraries(flacapp
FLAC
getopt

View File

@ -16,6 +16,7 @@ add_library(FLAC++
metadata.cpp
stream_decoder.cpp
stream_encoder.cpp)
set_property(TARGET FLAC++ PROPERTY PROJECT_LABEL "libFLAC++")
target_compile_definitions(FLAC++
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLACPP_API_EXPORTS>
PUBLIC $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:FLAC__NO_DLL>)

View File

@ -80,6 +80,7 @@ add_library(FLAC
$<$<BOOL:${OGG_FOUND}>:ogg_encoder_aspect.c>
$<$<BOOL:${OGG_FOUND}>:ogg_helper.c>
$<$<BOOL:${OGG_FOUND}>:ogg_mapping.c>)
set_property(TARGET FLAC PROPERTY PROJECT_LABEL "libFLAC")
if(TARGET FLAC-asm)
target_sources(FLAC PRIVATE $<TARGET_OBJECTS:FLAC-asm>)
endif()