-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MCU specific libc #7
Comments
Try setting your system search path(s) within the find_package() command. See http://www.cmake.org/cmake/help/v3.0/command/find_package.html as reference. |
In general, there are many options. You may create a symbolic link or just adapt the main CMakeLists.txt in your project. If you look at the sample file (or the examples) you get some entries like: if(DEFINED ENV{AVR_FIND_ROOT_PATH})
set(CMAKE_FIND_ROOT_PATH $ENV{AVR_FIND_ROOT_PATH})
else(DEFINED ENV{AVR_FIND_ROOT_PATH})
if(EXISTS "/opt/local/avr")
set(CMAKE_FIND_ROOT_PATH "/opt/local/avr")
elseif(EXISTS "/usr/avr")
set(CMAKE_FIND_ROOT_PATH "/usr/avr")
elseif(EXISTS "/usr/lib/avr")
set(CMAKE_FIND_ROOT_PATH "/usr/lib/avr")
else(EXISTS "/opt/local/avr")
message(FATAL_ERROR "Please set AVR_FIND_ROOT_PATH in your environment.")
endif(EXISTS "/opt/local/avr")
endif(DEFINED ENV{AVR_FIND_ROOT_PATH})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# not added automatically, since CMAKE_SYSTEM_NAME is "generic"
set(CMAKE_SYSTEM_INCLUDE_PATH "${CMAKE_FIND_ROOT_PATH}/include")
set(CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_FIND_ROOT_PATH}/lib") Just change your root path in the environment or directly in your main CMakeLists.txt. The first option can be achieved by simply add I hope that helps. |
Just doing:
Adds an -lc in the appropriate places, and gcc automagically selects the right variant for whatever AVR MCU is set by the AVR_MCU parameter. No need to do anything else (e.g., |
As far as I remembered, this didn't work for the Windows variant - almost two years ago. If someone could check this as I don't use this OS anymore, this part of the examples can be removed. The same goes with OSX. :-) |
When I use
find_package(C_LIB c)
for my (atmega128) project, I get the wrong/usr/lib/avr/lib/libc.a
when I require/usr/lib/avr/lib/avr51/libc.a
. Is there a way to indicate this architecture specific setting to cmake?The text was updated successfully, but these errors were encountered: