-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start adding toolchain for cross-compiling for FreeBSD
- Loading branch information
Showing
3 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Toolchain file for building for FreeBSD from Linux | ||
|
||
# Set the system name to reflect the target environment | ||
set(CMAKE_SYSTEM_NAME FreeBSD) | ||
|
||
# Specify the target architecture | ||
set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
|
||
# Specify the cross-compiler locations. These paths might need to be adjusted | ||
# based on where the cross-compilers are installed on your system. | ||
set(CMAKE_C_COMPILER /usr/bin/clang) | ||
set(CMAKE_CXX_COMPILER /usr/bin/clang++) | ||
|
||
# You might need to specify the sysroot if you have a FreeBSD sysroot available on your Linux machine. | ||
# This is especially necessary for finding the target system's libraries and headers. | ||
# set(CMAKE_SYSROOT /path/to/freebsd-sysroot) | ||
|
||
# Ensure that the compiler can find includes and link against libraries for the target environment | ||
# This might include specifying the path to the target's libc and other essential libraries. | ||
# Example: | ||
# set(CMAKE_FIND_ROOT_PATH /path/to/freebsd-sysroot) | ||
|
||
# Tell CMake to look for programs in the native build host first. | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
|
||
# For libraries and headers, since we are cross-compiling, we don't want to use the host's libraries/headers. | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
|
||
# Optionally, you can set compiler flags specific to your project's needs or to optimize for the target architecture | ||
# set(CMAKE_C_FLAGS "-target x86_64-unknown-freebsd11 --sysroot=${CMAKE_SYSROOT}" CACHE STRING "") | ||
# set(CMAKE_CXX_FLAGS "-target x86_64-unknown-freebsd11 --sysroot=${CMAKE_SYSROOT}" CACHE STRING "") | ||
|