File: UseFolders.cmake

package info (click to toggle)
freespace2 25.0.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (37 lines) | stat: -rw-r--r-- 1,537 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# - Contains a function to sensibly and easily enable the "USE_FOLDERS" global property
# without burning people using old MSVC Express Editions.
#
#  use_folders([option_name]) - Creates an option (default name if you don't pass
#    one: BUILD_WITH_PROJECT_FOLDERS) that controls the USE_FOLDERS global property.
#    It has intelligently-set defaults that err on the side of caution (disabling)
#    on old MSVC versions, since solutions generated with USE_FOLDERS set to ON
#    cannot be used in some older MSVC Express Editions, so it's explicit opt-in there.
#
# Original Author:
# 2015 Rylie Pavlik <rylie@ryliepavlik.com>
# https://ryliepavlik.com/
#
# Copyright 2015, Sensics, Inc.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0

function(use_folders)
    set(_option_name BUILD_WITH_PROJECT_FOLDERS)
    if(ARGV0)
        set(_option_name ${ARGV0})
    endif()
    # Nitpicky TODO: This unnecessarily defaults to project folders off when using
    # an older toolset in a newer IDE...
    if(MSVC_IDE AND MSVC_VERSION LESS 1600)
        # VS 2012 Express and newer has folder support...
        option(${_option_name} "Enable project folders in the IDE. May only work in non-Express Editions!" OFF)
    else()
        option(${_option_name} "Enable project folders in the IDE." ON)
    endif()
    set_property(GLOBAL PROPERTY
        USE_FOLDERS ${${_option_name}})
endfunction()