File: UseFolders.cmake

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (34 lines) | stat: -rw-r--r-- 1,522 bytes parent folder | download | duplicates (7)
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
# - 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 Ryan Pavlik <ryan@sensics.com> <abiryan@ryand.net>
# http://academic.cleardefinition.com
#
# Copyright Sensics, Inc. 2015.
# 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)

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()