<commit_before>cmake_minimum_required(VERSION 3.4.0)

cmake_policy(SET CMP0011 NEW)
cmake_policy(SET CMP0025 NEW)

# Avoid source tree pollution
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

If(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
  message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles")
endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)

# if rawspeed is added as a submodule to another build,
# this CMakeLists.txt should be added via add_subdirectory().
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  set(RAWSPEED_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "" FORCE)
  set(RAWSPEED_STANDALONE_BUILD TRUE CACHE BOOL "" FORCE)
else()
  set(RAWSPEED_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "" FORCE)
  set(RAWSPEED_STANDALONE_BUILD FALSE CACHE BOOL "" FORCE)
endif()

include(GNUInstallDirs)
include(FeatureSummary)

project(rawspeed CXX)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(BINARY_PACKAGE_BUILD "Sets march optimization to generic" OFF)
option(WITH_SSE2 "If SSE2 support is available, do build SSE2 codepaths" ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  option(RAWSPEED_USE_LIBCXX "(Clang only) Build using libc++ as the standard library." OFF)

  # when OSX_DEPLOYMENT_TARGET is 10.9 and newer, the default is libc++,
  # but for no reason let's always specify/use libc++ for apple.
  if(APPLE)
    set(RAWSPEED_USE_LIBCXX ON)
  endif()
else()
  set(RAWSPEED_USE_LIBCXX OFF CACHE BOOL "(Clang only) Build using libc++ as the standard library." FORCE)
endif()
option(RAWSPEED_ENABLE_DEBUG_INFO "Whether to generate debug info or not." ON)
option(RAWSPEED_ENABLE_WERROR "Stop and fail the build, if a compiler warning is triggered." ON)

option(WITH_OPENMP "Enable OpenMP support." ON)
if(WITH_OPENMP)
  option(USE_BUNDLED_LLVMOPENMP "Build and use LLVM OpenMP runtime library in-tree" OFF)
else()
  set(USE_BUNDLED_LLVMOPENMP OFF CACHE BOOL "Build and use LLVM OpenMP runtime library in-tree" FORCE)
endif()
set(LLVMOPENMP_PATH "/usr/src/openmp" CACHE PATH "Path to the LLVM OpenMP runtime library root tree.")
if(WITH_OPENMP AND USE_BUNDLED_LLVMOPENMP)
  option(ALLOW_DOWNLOADING_LLVMOPENMP "If LLVM OpenMP runtime library src tree is not found in location specified by LLVMOPENMP_PATH, do fetch the archive from internet" OFF)
else()
  set(ALLOW_DOWNLOADING_LLVMOPENMP OFF CACHE BOOL "If LLVM OpenMP runtime library src tree is not found in location specified by LLVMOPENMP_PATH, do fetch the archive from internet" FORCE)
endif()
<commit_msg>CMake: don't enable debug info if "debug information for auto is not yet supported" (clang)<commit_after>cmake_minimum_required(VERSION 3.4.0)

cmake_policy(SET CMP0011 NEW)
cmake_policy(SET CMP0025 NEW)

# Avoid source tree pollution
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

If(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
  message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles")
endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)

# if rawspeed is added as a submodule to another build,
# this CMakeLists.txt should be added via add_subdirectory().
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  set(RAWSPEED_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "" FORCE)
  set(RAWSPEED_STANDALONE_BUILD TRUE CACHE BOOL "" FORCE)
else()
  set(RAWSPEED_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "" FORCE)
  set(RAWSPEED_STANDALONE_BUILD FALSE CACHE BOOL "" FORCE)
endif()

include(GNUInstallDirs)
include(FeatureSummary)
include(CheckCXXCompilerFlag)

project(rawspeed CXX)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

option(BINARY_PACKAGE_BUILD "Sets march optimization to generic" OFF)
option(WITH_SSE2 "If SSE2 support is available, do build SSE2 codepaths" ON)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  option(RAWSPEED_USE_LIBCXX "(Clang only) Build using libc++ as the standard library." OFF)

  # when OSX_DEPLOYMENT_TARGET is 10.9 and newer, the default is libc++,
  # but for no reason let's always specify/use libc++ for apple.
  if(APPLE)
    set(RAWSPEED_USE_LIBCXX ON)
  endif()
else()
  set(RAWSPEED_USE_LIBCXX OFF CACHE BOOL "(Clang only) Build using libc++ as the standard library." FORCE)
endif()

set(CMAKE_REQUIRED_FLAGS_ORIG "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "-c -std=c++14 -g")
# see https://bugs.llvm.org/show_bug.cgi?id=16091
# see https://reviews.llvm.org/rL221704
CHECK_CXX_SOURCE_COMPILES(
"struct foo {
  static auto func();
};

foo f;

auto foo::func() {
  return 1;
}"
  RAWSPEED_CXX_DEBUG_INFO_FOR_AUTO_IS_SUPPORTED
)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_ORIG}")

option(RAWSPEED_ENABLE_DEBUG_INFO "Whether to generate debug info or not." ${RAWSPEED_CXX_DEBUG_INFO_FOR_AUTO_IS_SUPPORTED})

option(RAWSPEED_ENABLE_WERROR "Stop and fail the build, if a compiler warning is triggered." ON)

option(WITH_OPENMP "Enable OpenMP support." ON)
if(WITH_OPENMP)
  option(USE_BUNDLED_LLVMOPENMP "Build and use LLVM OpenMP runtime library in-tree" OFF)
else()
  set(USE_BUNDLED_LLVMOPENMP OFF CACHE BOOL "Build and use LLVM OpenMP runtime library in-tree" FORCE)
endif()
set(LLVMOPENMP_PATH "/usr/src/openmp" CACHE PATH "Path to the LLVM OpenMP runtime library root tree.")
if(WITH_OPENMP AND USE_BUNDLED_LLVMOPENMP)
  option(ALLOW_DOWNLOADING_LLVMOPENMP "If LLVM OpenMP runtime library src tree is not found in location specified by LLVMOPENMP_PATH, do fetch the archive from internet" OFF)
else()
  set(ALLOW_DOWNLOADING_LLVMOPENMP OFF CACHE BOOL "If LLVM OpenMP runtime library src tree is not found in location specified by LLVMOPENMP_PATH, do fetch the archive from internet" FORCE)
endif()

{'fraction_non_alphanumeric': 0.08396827865028766, 'fraction_numerical': 0.007463846991136682, 'mean_word_length': 6.593860684769775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1622597', 'n_tokens_mistral': 2362, 'n_tokens_neox': 2252, 'n_words': 640}