cmake_minimum_required (VERSION 3.8)
project(libtommath)

# Suppress extra stuff from generated solution
set(CMAKE_SUPPRESS_REGENERATION true)

if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
 add_compile_definitions(
 _CRT_SECURE_NO_WARNINGS
 _CRT_NONSTDC_NO_DEPRECATE
 )
endif()

file (GLOB HEADERS
 "${CXBXR_ROOT_DIR}/import/libtommath/tommath.h"
 "${CXBXR_ROOT_DIR}/import/libtommath/tommath_class.h"
 "${CXBXR_ROOT_DIR}/import/libtommath/tommath_private.h"
 "${CXBXR_ROOT_DIR}/import/libtommath/tommath_superclass.h"
)

file (GLOB SOURCES
 "${CXBXR_ROOT_DIR}/import/libtommath/bncore.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_error.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_fast_mp_invmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_fast_mp_montgomery_reduce.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_fast_s_mp_mul_digs.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_fast_s_mp_mul_high_digs.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_fast_s_mp_sqr.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_2expt.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_abs.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_add.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_addmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_add_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_and.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_clamp.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_clear.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_clear_multi.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_cmp.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_cmp_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_cmp_mag.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_cnt_lsb.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_complement.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_copy.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_count_bits.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_div.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_div_2.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_div_2d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_div_3.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_div_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_dr_is_modulus.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_dr_reduce.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_dr_setup.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_exch.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_export.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_exptmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_exptmod_fast.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_expt_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_expt_d_ex.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_exteuclid.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_fread.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_fwrite.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_gcd.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_get_bit.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_get_double.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_get_int.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_get_long.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_get_long_long.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_grow.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_import.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_init.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_init_copy.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_init_multi.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_init_set.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_init_set_int.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_init_size.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_invmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_invmod_slow.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_is_square.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_jacobi.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_karatsuba_mul.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_karatsuba_sqr.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_kronecker.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_lcm.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_lshd.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mod_2d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mod_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_montgomery_calc_normalization.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_montgomery_reduce.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_montgomery_setup.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mul.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mulmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mul_2.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mul_2d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_mul_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_neg.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_n_root.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_n_root_ex.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_or.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_fermat.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_frobenius_underwood.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_is_divisible.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_is_prime.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_miller_rabin.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_next_prime.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_rabin_miller_trials.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_random_ex.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_prime_strong_lucas_selfridge.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_radix_size.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_radix_smap.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_rand.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_read_radix.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_read_signed_bin.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_read_unsigned_bin.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_2k.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_2k_l.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_2k_setup.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_2k_setup_l.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_is_2k.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_is_2k_l.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_reduce_setup.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_rshd.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_set.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_set_double.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_set_int.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_set_long.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_set_long_long.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_shrink.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_signed_bin_size.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_sqr.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_sqrmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_sqrt.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_sqrtmod_prime.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_sub.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_submod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_sub_d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_tc_and.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_tc_div_2d.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_tc_or.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_tc_xor.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_toom_mul.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_toom_sqr.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_toradix.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_toradix_n.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_to_signed_bin.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_to_signed_bin_n.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_to_unsigned_bin.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_to_unsigned_bin_n.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_unsigned_bin_size.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_xor.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_mp_zero.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_prime_tab.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_reverse.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_s_mp_add.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_s_mp_exptmod.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_s_mp_mul_digs.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_s_mp_mul_high_digs.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_s_mp_sqr.c"
 "${CXBXR_ROOT_DIR}/import/libtommath/bn_s_mp_sub.c"
)

source_group(TREE ${CXBXR_ROOT_DIR}/import/libtommath PREFIX header FILES ${HEADERS})

source_group(TREE ${CXBXR_ROOT_DIR}/import/libtommath PREFIX source FILES ${SOURCES})

add_library(libtommath ${HEADERS} ${SOURCES})

target_include_directories(libtommath
 PUBLIC "${CXBXR_ROOT_DIR}/import/libtommath"
)
