<commit_before>cmake_minimum_required(VERSION 2.7)
project(RunAsUser)

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    message(FATAL_ERROR "In-source builds are not allowed. Please use the ./build.sh helper script.")
endif()

if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin/${CMAKE_BUILD_TYPE})
endif()

# TODO: add -fstack-protector
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fpermissive")

file(GLOB src "src/*.h" "src/*.cpp" )

add_executable(Microsoft.R.Host.RunAsUser ${src})

set_target_properties(Microsoft.R.Host.RunAsUser PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
if("${TARGET_ARCH}" STREQUAL "x86")
    set_target_properties(Microsoft.R.Host.RunAsUser PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif()

include_directories("${CMAKE_SOURCE_DIR}/../../Lib/picojson")

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.58.0 REQUIRED COMPONENTS filesystem system)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(Microsoft.R.Host.RunAsUser ${Boost_LIBRARIES})

target_link_libraries(Microsoft.R.Host.RunAsUser pthread pam explain)<commit_msg>Using find_library for pam and explain libs.<commit_after>cmake_minimum_required(VERSION 2.7)
project(RunAsUser)

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    message(FATAL_ERROR "In-source builds are not allowed. Please use the ./build.sh helper script.")
endif()

if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin/${CMAKE_BUILD_TYPE})
endif()

# TODO: add -fstack-protector
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fpermissive")

file(GLOB src "src/*.h" "src/*.cpp" )

add_executable(Microsoft.R.Host.RunAsUser ${src})

set_target_properties(Microsoft.R.Host.RunAsUser PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
if("${TARGET_ARCH}" STREQUAL "x86")
    set_target_properties(Microsoft.R.Host.RunAsUser PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
endif()

include_directories("${CMAKE_SOURCE_DIR}/../../Lib/picojson")

set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.58.0 REQUIRED COMPONENTS filesystem system)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(Microsoft.R.Host.RunAsUser ${Boost_LIBRARIES})

find_library(PAM_LIBRARY pam)
if(NOT PAM_LIBRARY)
    message(FATAL_ERROR "pam not found")
endif()

find_library(EXPLAIN_LIBRARY explain)
if(NOT EXPLAIN_LIBRARY)
    message(FATAL_ERROR "explain not found")
endif()

target_link_libraries(Microsoft.R.Host.RunAsUser pthread ${EXPLAIN_LIBRARY} ${PAM_LIBRARY})
{'fraction_non_alphanumeric': 0.12725874663590928, 'fraction_numerical': 0.010765090349865437, 'mean_word_length': 7.339743589743589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3617584', 'n_tokens_mistral': 1020, 'n_tokens_neox': 954, 'n_words': 159}