set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(HOST x86_64-unknown-linux-gnu CACHE STRING "")
set(CROSS /tools/toolchains/${HOST}/bin/${HOST}-)
set(INTEL_PATH /tools/ifort/2011u8/x86_64/bin/intel64)

set(ENV{LD_LIBRARY_PATH} "/tools/ifort/2011u8/x86_64/compiler/lib/intel64:$ENV{LD_LIBRARY_PATH}")
set(ENV{INTEL_LICENSE_FILE} "/tools/ifort/2011u8/bin/COM_L_CMP_FOR_FRB4-9PVG3MLB.lic")

set(CMAKE_C_COMPILER ${CROSS}gcc CACHE FILEPATH "")
set(CMAKE_ASM_COMPILER ${CROSS}gcc CACHE FILEPATH "")
set(CMAKE_CXX_COMPILER ${CROSS}g++ CACHE FILEPATH "")
set(CMAKE_Fortran_COMPILER ${INTEL_PATH}/ifort CACHE FILEPATH "")
set(CMAKE_RANLIB ${CROSS}ranlib CACHE FILEPATH "")
set(CMAKE_STRIP ${CROSS}strip CACHE FILEPATH "")
set(CMAKE_NM ${CROSS}gcc-nm CACHE FILEPATH "")
set(CMAKE_AR ${CROSS}gcc-ar CACHE FILEPATH "")
set(CMAKE_RANLIB ${CROSS}gcc-ranlib CACHE FILEPATH "")
set(CMAKE_OBJDUMP ${CROSS}objdump CACHE FILEPATH "")

set(LINKER_EXECUTABLE ld.gold CACHE FILEPATH "")
set(CMAKE_C_FLAGS "${VCPKG_C_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "")
set(CMAKE_CXX_FLAGS "${VCPKG_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static-libgcc ${VCPKG_LINKER_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} CACHE STRING "" FORCE)
set(CMAKE_SYSROOT /tools/toolchains/${HOST}/${HOST}/sysroot CACHE PATH "" FORCE)

# make sure the static openmp library is used
set(OpenMP_gomp_LIBRARY "/tools/toolchains/${HOST}/${HOST}/lib64/libgomp.a" CACHE STRING "")

set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)