[CMake] Assembler handling in 2.8.5 vs 2.8.4

Florian Reinhard florian.reinhard at googlemail.com
Thu Jul 21 03:00:26 EDT 2011


Hi Alex,

Thank you for the quick response,

2011/7/20 Alexander Neundorf <a.neundorf-work at gmx.net>:
> Damn, I was so sure I updated the wiki, but apparently I didn't.
> So here are the old docs, but this changed quite a bit for 2.8.5:
> http://www.vtk.org/Wiki/CMake/Assembler
>
> What it does now:
> the language "ASM" is now for assembler files which can be processed by your C
> compiler. This actually seems to be the case for you.
> Is the compiler ID of your compiler recognized by cmake ?

I guess not, since i define the compiler and how it is being called my
self there is/was no need to have cmake detect the compiler ID.

> It seems like it isn't.
> If it was, the assembler support would not try to figure out the "compiler ID"
> for the assembler again, it would just use the compiler ID from C or CXX.
>
> Can you please post the complete cmake output from some basic C project ?

Sure, hope to get this done by Friday afternoon CEST.

> Basically, what we should do, add support for your compiler toolchain, i.e.
> add support for recognizing your compiler, and create files in
> Modules/Compiler/TMS-C|CXX|ASM.cmake.

Having cl6x support included in CMake would be really nice, besides
that knowing how to setup a toolchain easily would be good either ;)

> This doesn't require recompiling cmake, it is all in the modules files.
> Then it should all work much better.
>
> How do you compiler settings, toolchain file etc. look right now ?

I attached three files:
help-<command>.txt
    The Texas Instruments "<command> --help" output
CMakeLists_root.txt
    Thats where i setup the toolchain and define the project
CMakeLists_src.txt
    Thats where i add sources and binaries

The cl6x toolchain is available for linux and windows after registration at:
https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm


Kind Regards,

Florian
-------------- next part --------------
TMS320C6000 Archiver                    v7.2.4
Tools Copyright (c) 1996-2011           Texas Instruments Incorporated

 Syntax : ar6x [arxdt][quvsh][012] archive files ...
          ar6x @command_file

 Commands : (only one may be selected)
    a - Add file                   r - Replace file
    x - Extract file               d - Delete file
    t - Print table of contents

 Options :
    q - Quiet mode - Normal status messages suppressed
    u - Update with newer files (use with 'r' command)
    s - Print symbol table contents
    v - Verbose
    h - This help

 Output format options:
    0 - Original AR format
    1 - TI long-name format (obsolescent)
    2 - POSIX format (default for newly created files)

-------------- next part --------------
TMS320C6x C/C++ Compiler                v7.2.4
Tools Copyright (c) 1996-2011 Texas Instruments Incorporated

Usage: cl6x [-options] filename

Use 'cl6x -h <option>' for more information on a particular option.  Use
'cl6x -h <text>' to search options for information regarding <text>.

Option arguments surrounded by [] declare they are optional.  Option arguments
separated by commas specify that the option's argument must be chosen from
those arguments listed.

When shown, option arguments and defaults apply to the usage of both long and
short option forms.

Basic Options:
  -mv,--silicon_version=id     Target processor version (when not specified,
                                compiler defaults to --silicon_version=6200)
  -g,--symdebug:dwarf          Full symbolic debug
  --symdebug:coff              Full symbolic debug (COFF, deprecated)
  --symdebug:none              Suppress all symbolic debug generation
  --symdebug:profile_coff      Function profile debug (COFF, deprecated)
  --symdebug:skeletal          Symbolic debug for program analysis (default)
  -O,--opt_level[=0-3]         Optimization level (argument optional, defaults
                                to: 2)
  -ms,--opt_for_space[=0-3]    Optimize for code size (argument optional,
                                defaults to: 0)

Control Options:
  --compile_only,-c            Disable linking (overrides -z)
  --help,-h                    Show help screen
  --run_linker,-z[=arguments]  Perform link using options following
  --skip_assembler,-n          Compile only; do not assemble

Symbolic Debug Options:
  -g,--symdebug:dwarf          Full symbolic debug
  --symdebug:coff              Full symbolic debug (COFF, deprecated)
  --symdebug:none              Suppress all symbolic debug generation
  --symdebug:profile_coff      Function profile debug (COFF, deprecated)
  --symdebug:skeletal          Symbolic debug for program analysis (default)
  --machine_regs               Display reg operands as machine registers in asm
  --symdebug:dwarf_version=2,3 Specify DWARF version
  --symdebug:keep_all_types    Keep unreferenced type info (default for elf w/
                                debug)

Language Options:
  --check_misra[=RULE]         Enable checking of MISRA-C:2004 rules (argument
                                optional, defaults to: all)
  --cpp_default,-fg            Treat C files as C++ files
  --create_pch=filename        Create a precompiled header file as named
  --embedded_cpp,-pe           Embedded C++
  --exceptions                 Enable C++ exception handling
  --extern_c_can_throw         Allow extern C functions to propagate exceptions
  --fp_mode=strict,relaxed     Floating Point mode (when not specified,
                                compiler defaults to --fp_mode=strict)
  --gcc                        Enable support for GCC extensions
  --gen_acp_raw,-pl            Output raw listing to .rl file
  --gen_acp_xref,-px           Output xref listing to .crl file
  --keep_unneeded_statics      Do not delete unreferenced static variables
  --kr_compatible,-pk          K & R compatibility
  --misra_advisory=remark,error,suppress,warning
                               Set error category for MISRA advisory rules
  --misra_required=remark,error,suppress,warning
                               Set error category for MISRA required rules
  --multibyte_chars,-pc        Multibyte character support
  --no_inlining,-pi            Ignore inline keyword
  --no_intrinsics,-pn          Disable intrinsic functions
  --pch                        Automatically create/use precompiled headers
  --pch_dir=dir                Specify precompiled header path
  --pch_verbose                Info on considered & unused precompiled headers
  --program_level_compile,-pm  Program mode compilation
  --relaxed_ansi,-pr           Relaxed parsing (non-strict ANSI)
  --rtti,-rtti                 Support C++ run-time type information
  --static_template_instantiation
                               Do static early template instantiation
  --strict_ansi,-ps            Strict ANSI mode (errors)
  --use_pch=filename           Precompiled header file for compilation

Parser Preprocessing Options:
  --preproc_dependency,-ppd[=filename]
                               Generate include file dependency information
  --preproc_includes,-ppi[=filename]
                               Generate first-level include file list
  --preproc_macros,-ppm[=filename]
                               Generate list of pre- & user-defined macros
  --preproc_only,-ppo          Preprocess only
  --preproc_with_comment,-ppc  Preprocess only; maintain comments
  --preproc_with_compile,-ppa  Continue compilation after using -pp<X> options.
  --preproc_with_line,-ppl     Preprocess only; maintain line directives

Predefined Symbols Options:
  --define,-D=NAME[=value]     Pre-define NAME
  --undefine,-U=NAME           Undefine NAME

Include Options:
  --include_path,-I=dir        Add dir to #include search path
  --preinclude=filename        Specify a preinclude file

Diagnostic Options:
  --compiler_revision          Print compiler revision and exit
  --consultant                 Generate compiler consultant information
  --diag_error,-pdse=id        Treat diagnostic <id> as error
  --diag_remark,-pdsr=id       Treat diagnostic <id> as remark
  --diag_suppress,-pds=id      Suppress diagnostic <id>
  --diag_warning,-pdsw=id      Treat diagnostic <id> as warning
  --display_error_number,-pden Emit diagnostic identifier numbers
  --emit_warnings_as_errors,-pdew
                               Treat warnings as errors
  --issue_remarks,-pdr         Issue remarks
  --no_warnings,-pdw           Suppress warnings
  --quiet,-q                   Quiet Mode
  --set_error_limit,-pdel=count
                               Set error limit to <count>
  --super_quiet,-qq            Super Quiet Mode
  --tool_version,-version      Print version numbers for each tool
  --verbose                    Display banner and function progress information
  --verbose_diagnostics,-pdv   Verbose diagnostics
  --write_diagnostics_file,-pdf
                               Output diagnostic to .err file

Runtime Model Options:
  -mv,--silicon_version=id     Target processor version (when not specified,
                                compiler defaults to --silicon_version=6200)
  --abi=eabi,coffabi           Application binary interface (coffabi, eabi)
                                (when not specified, compiler defaults to
                                --abi=coffabi)
  --big_endian,-me             Generate big endian code
  --debug_software_pipeline,-mw
                               Generate verbose software pipelining information
  --disable_software_pipeline,-mu
                               Disable software pipelining
  --dprel                      Always use DP-relative addressing for data (ELF
                                only)
  --fp_not_associative,-mc     Do not reorder floating point operations
  --fp_reassoc=off,on          Allow reassociation of FP arithmetic (when not
                                specified, compiler defaults to
                                --fp_reassoc=on)
  --gen_func_subsections,-mo[=off,on]
                               Place each function in a separate subsection
                                (argument optional, defaults to: on)
  --interrupt_threshold,-mi[=#]
                               Specify maximum disabled interrupt cycles
  --mem_model:const=far_aggregates,far,data
                               Const access model (when not specified, compiler
                                defaults to --mem_model:const=data)
  --mem_model:data=far_aggregates,near,far
                               Data access model (when not specified, compiler
                                defaults to --mem_model:data=far_aggregates)
  --no_bad_aliases,-mt         Assume no irregular alias or loop behavior
  --no_compress                Disable compression for 6400+
  --no_reload_errors           Prevent loop buffer reload-related error
                                detection
  --optimize_with_debug,-mn    Optimize fully in the presence of debug
                                directives
  --profile:breakpt            Compile for breakpoint-based profiling
  --profile:power              Compile for power profiling
  --sat_reassoc=off,on         Allow reassociation of sat arithmetic (when not
                                specified, compiler defaults to
                                --sat_reassoc=off)
  --small_enum,--small-enum    Enums may be char/short, instead of int
  --speculate_loads,-mh[=#]    Specify speculative load byte count threshold
  --speculate_unknown_loads    Speculate loads with unbounded address ranges
  --target_compatibility_6200,-mb
                               Enable 62xx compatibility
  --use_const_for_alias_analysis,-ox
                               Use const to disambiguate pointers.

Optimizations Options:
  -O,--opt_level[=0-3]         Optimization level (argument optional, defaults
                                to: 2)
  -ms,--opt_for_space[=0-3]    Optimize for code size (argument optional,
                                defaults to: 0)
  --auto_inline,-oi[=size]     Specify threshold for automatic inlining
  --call_assumptions,-op=0-3   Specify call assumptions when optimizing
  --gen_opt_info,-on=0-2       Generate optimizer information file at level
                                [0-2]
  --opt_for_speed,-mf[=0-5]    Optimize for speed (argument optional, defaults
                                to: 4)
  --optimizer_interlist,-os    Generate optimized source interlisted assembly
  --remove_hooks_when_inlining Remove entry/exit hooks from inlined functions
  --single_inline              Inline functions only called once.
  --aliased_variables,-ma      Assume called funcs create hidden aliases (rare)

Entry/Exit Hook Options:
  --entry_hook[=hook_function_name]
                               Insert this call at entry to each function
                                (argument optional, defaults to: __entry_hook)
  --entry_parm=none,name,address
                               Pass caller's name or address to entry hook
  --exit_hook[=hook_function_name]
                               Insert this call at exit from each function
                                (argument optional, defaults to: __exit_hook)
  --exit_parm=none,name,address
                               Pass caller's name or address to exit hook

Feedback Options:
  --analyze=codecov,callgraph  Generate analysis info from profile data
  --analyze_only               Only generate analysis
  --gen_profile_info           Generate profile feedback data
  --use_profile_info[=filelist]
                               Use profile feedback file(s)

Library Function Assumptions Options:
  --printf_support=nofloat,full,minimal
                               Level of printf support required
  --std_lib_func_defined,-ol1  File contains an RTS library function.
  --std_lib_func_not_defined,-ol2
                               File does not define any RTS library func (def.)
  --std_lib_func_redefined,-ol0
                               File redefines an RTS library function.

Assembler Options:
  -k,--keep_asm                Keep the generated assembly language (.asm) file
  --asm_listing,-al            Generate listing file
  --c_src_interlist,-ss        Generate C source interlisted assembly file
  --src_interlist,-s           Generate interlisted assembly file
  --absolute_listing,-aa       Generate absolute listing file
  --asm_define,-ad=NAME[=value]
                               Pre-define assembly symbol NAME
  --asm_dependency,-apd        Generate assembly dependency information
  --asm_includes,-api          Generate first-level assembly include file list
  --asm_undefine,-au=NAME      Undefine assembly symbol NAME
  --copy_file,-ahc=filename    Simulate source '.copy filename'
  --cross_reference,-ax        Generate cross reference file
  --include_file,-ahi=filename Simulate source '.include filename'
  --no_const_clink             Do not generate .clink for .const sections
  --output_all_syms,-as        Keep local symbols in output file
  --strip_coff_underscore      Aid for transitioning hand-coded assembly from
                                COFF to ELF
  --syms_ignore_case,-ac       Symbol names are not case-significant

File Type Specifier Options:
  --ap_file,-fl=filename       File is a linear asm file (default for .sa)
  --asm_file,-fa=filename      File is an assembly file (default for .asm)
  --c_file,-fc=filename        File is a C file (default for .c/no ext)
  --cpp_file,-fp=filename      File is a C++ file (default for .C .cpp .cc)
  --obj_file,-fo=filename      File is an object file (default for .obj)

Directory Specifier Options:
  --abs_directory,-fb=dir      Absolute listing directory (default is .obj dir)
  --asm_directory,-fs=dir      Assembly file directory (default is .)
  --list_directory,-ff=dir     Listing/xref file directory (default is .obj
                                dir)
  --obj_directory,-fr=dir      Object file directory (default is .)
  --output_file,-fe=filename   Compilation output file name, can override
                                --obj_directory
  --pp_directory=dir           Preprocessor file directory (default is .)
  --temp_directory,-ft=dir     Temporary file directory (default is .)

Default File Extensions Options:
  --ap_extension,-el=.ext      Extension for linear asm files (default is .sa)
  --asm_extension,-ea=.ext     Extension for assembly files (default is .asm)
  --c_extension,-ec=.ext       Extension for C files (default is .c)
  --cpp_extension,-ep=.ext     Extension for C++ files (default is .cpp)
  --listing_extension,-es=.ext Extension for listing files (default is .lst)
  --obj_extension,-eo=.ext     Extension for object files (default is .obj)

Dynamic Linking Support Options:
  --dsbt                       Generate addressing via Dynamic Segment Base
                                Table
  --export_all_cpp_vtbl        Export C++ virtual tables by default
  --import_helper_functions    Treat compiler helper functions as imported refs
  --import_undef[=off,on]      Import all undefined symbols (argument optional,
                                defaults to: on)
  --inline_plt[=off,on]        Inline the import function call stub. (argument
                                optional, defaults to: on)
  --visibility=hidden,fhidden,default,protected
                               Specify visibility of global symbols.

Command Files Options:
  --cmd_file,-@=filename       Read options from specified file 

The following Linker options can be specified following the -z
option.  Linking is only enabled if -z is used and -c is not:

Basic Options:
  -o,--output_file=file        Specify output file name
  -m,--map_file=file           Input and output sections listed into <file>
  --heap_size,-heap,--heap=size
                               Heap size for C/C++ dynamic memory allocation
  --stack_size,-stack,--stack=size
                               Set C system stack size

Command File Preprocessing Options:
  --define=name=value          Pre-define preprocessor macro _name_ to _value_
  --undefine=name              Undefine preprocessor macro _name_
  --disable_pp                 Don't use C preprocessor for command files

Diagnostics Options:
  --diag_error=id              Treat diagnostic <id> as error
  --diag_remark=id             Treat diagnostic <id> as remark
  --diag_suppress=id           Suppress diagnostic <id>
  --diag_warning=id            Treat diagnostic <id> as warning
  --display_error_number       Emit diagnostic identifier numbers
  --emit_warnings_as_errors,-pdew
                               Treat warnings as errors
  --issue_remarks              Issue remarks
  --no_demangle                Don't demangle symbol names in diagnostics
  --no_warnings                Suppress warnings
  --set_error_limit=count      Set error limit to <count>
  --verbose_diagnostics        Verbose diagnostics
  --warn_sections,-w           Warn if an unspecified output section is created

File Search Path Options:
  -l,--library=file            Include library file or command file as input
  -i,--search_path=dir         Add <dir> to library search path
  --disable_auto_rts           Disable automatic RTS selection
  --priority,-priority         Search libraries in priority order
  --reread_libs,-x             Reread libraries; resolve backward references

Linker Output Options:
  -o,--output_file=file        Specify output file name
  -m,--map_file=file           Input and output sections listed into <file>
  --absolute_exe,-a            Produce absolute executable object file
                                (default)
  --mapfile_contents=attribute Display attribute settings in map file
  --relocatable,-r             Produce a relocatable output module
  --rom                        Create a ROM object
  --run_abs,-abs               Produce absolute listing file
  --xml_link_info,-xml_link_info=file
                               Detailed link information data-base into <file>

Symbol Management Options:
  --entry_point,-e=symbol      Specify program entry point for the output
                                module
  --globalize=pattern          Do not localize symbols matching pattern
  --hide=pattern               Hide symbols matching pattern
  --localize=pattern           Make the symbols matching pattern local
  --make_global,-g=symbol      Don't make global symbol static if -h is
                                specified
  --make_static,-h             Make all global symbols static
  --no_sym_merge,-b            No type merging in symbolic debugging
                                information
  --no_symtable,-s             Strip symbol table and line number entries
  --retain=sym_or_scn_spec     Specify symbols/sections to be retained by
                                linker
  --scan_libraries,-scanlibs   Scan libraries for duplicate symbol definitions
  --symbol_map=refname=defname Specify a symbol map, mapping refname to defname
  --undef_sym,-u=sym           Add <sym> to symbol table as an unresolved
                                symbol
  --unhide=pattern             Exclude symbols matching pattern from hiding

Runtime Environment Options:
  --heap_size,-heap,--heap=size
                               Heap size for C/C++ dynamic memory allocation
  --stack_size,-stack,--stack=size
                               Set C system stack size
  --arg_size,--args=size       Set C argc/argv memory size
  --fill_value,-f=value        Default fill value for holes in output sections
  --ram_model,-cr              Link using RAM autoinitialization model
  --rom_model,-c               Link using ROM autoinitialization model
  --trampolines[=off,on]       Generate far call trampolines (argument
                                optional, defaults to: on)

Linktime Optimization Options:
  --cinit_compression[=compression_kind]
                               Compress ELF C style auto initialization data
                                (argument optional, defaults to: rle)
  --compress_dwarf[=off,on]    Aggressively reduce size of the DWARF
                                information (argument optional, defaults to:
                                on)
  --copy_compression[=compression_kind]
                               Compress ELF sections copied using copy tables
                                (argument optional, defaults to: rle)
  --unused_section_elimination[=off,on]
                               Eliminate sections not needed in the executable
                                (argument optional, defaults to: on)

Miscellaneous Options:
  --disable_clink,-j           Disable conditional linking & ignore .clink
  --linker_help,-help,--help   Display usage information
  --minimize_trampolines[=off,postorder]
                               Select trampoline minimization algorithm
                                (argument optional, defaults to: postorder)
  --preferred_order=function   Add <function> to preferred placement order list
  --strict_compatibility[=off,on]
                               Strict compatibility checking (argument
                                optional, defaults to: on)
  --trampoline_min_spacing=size
                               Minimum space between non-adjacent trampolines
  --zero_init[=off,on]         Zero initialize ELF uninitialized sections
                                (argument optional, defaults to: on)

Dynamic Linking Support Options:
  --dsbt_index=index           The DSBT index of this component
  --dsbt_size=size             The size of Data Segment Base Table (DSBT) in
                                words
  --dynamic[=exe,lib]          Generate dynamic executable or a dynamic library
                                (argument optional, defaults to: exe)
  --export=sym                 Export specified symbol
  --fini=sym                   Specify the symbol name of the finalization code
  --forced_static_binding[=off,on]
                               Force all import references to bind during
                                static linking (argument optional, defaults to:
                                on)
  --import=sym                 Import specified symbol
  --init=sym                   Specify the symbol name of the initialization
                                code
  --rpath=dir                  Add directory to beginning of dynamic library
                                search path
  --runpath=dir                Add directory to end of dynamic library search
                                path
  --soname=soname              Specify ELF shared object file name

-------------- next part --------------
TMS320C6x Strip Utility                 v7.2.4
Tools Copyright (c) 1996-2011 Texas Instruments Incorporated

Usage: strip6x [-options] filename

Use 'strip6x -h <option>' for more information on a particular option.  Use
'strip6x -h <text>' to search options for information regarding <text>.

Option arguments surrounded by [] declare they are optional.  Option arguments
separated by commas specify that the option's argument must be chosen from
those arguments listed.

When shown, option arguments and defaults apply to the usage of both long and
short option forms.

Options:
  --emit_warnings_as_errors,-pdew
                               Treat warnings as errors
  --help,-h                    Display help
  --outfile,-o=file            Write stripped output to a new file
  --postlink,-p                Strip additional info from a linked object file.
  --rom                        Strip readonly sections and segments.

-------------- next part --------------
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# Inhibit compiler compatibility tests.
# Stop test to see if our compilers work.
# Stop auto GNU test.
SET (CMAKE_SKIP_COMPATIBILITY_TESTS 1)
SET (CMAKE_ASM_TI_COMPILER_WORKS 1)
SET (CMAKE_C_COMPILER_WORKS   1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
SET (CMAKE_COMPILER_IS_GNUCC_RUN  1)
SET (CMAKE_COMPILER_IS_GNUCXX_RUN 1)

#skip ABI checks
SET (CMAKE_DETERMINE_C_ABI_COMPILED   1)
SET (CMAKE_DETERMINE_CXX_ABI_COMPILED 1)
SET (CMAKE_DETERMINE_ASM_ABI_COMPILED 1)

# Define which compiler we use
SET (CMAKE_C_COMPILER "C:/tools/cgtools-7.2.4/bin/cl6x.exe")
SET (CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
SET (CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
SET (CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_COMPILER})
# don't know that the strip is for but... since we got it...
SET (CMAKE_STRIP "C:/tools/cgtools-7.2.4/bin/strip6x.exe")
# use a patched version of make to allow parallel builds on windows
SET (CMAKE_MAKE_PROGRAM "C:/tools/bin/make.exe")

# We do want to compile assembler files as well
ENABLE_LANGUAGE(ASM) 

# must be done after enabling ASM since it overwrites CMAKE_AR
SET (CMAKE_AR "C:/tools/cgtools-7.2.4/bin/ar6x.exe")

# Define compiler specific flags we need in any case
# -z enable linker
# -o Outputfilename
# -m Mapfile
set(CMAKE_C_LINK_EXECUTABLE  "<CMAKE_C_COMPILER> -z -o\"<TARGET>\" -m\"<TARGET>.map\" <LINK_LIBRARIES> <LINK_FLAGS>  <OBJECTS>")
# -fr object file output directory
# -eo object file extension
set(CMAKE_C_COMPILE_OBJECT   "<CMAKE_C_COMPILER> -fr=<OBJECT_DIR> -eo=.c.obj   <DEFINES> <FLAGS> <SOURCE>")
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_C_COMPILER> -fr=<OBJECT_DIR> -eo=.cpp.obj <DEFINES> <FLAGS> <SOURCE>")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> -fr=<OBJECT_DIR> -eo=.asm.obj <DEFINES> <FLAGS> <SOURCE>")

# Library archiver
# -r Replace file
SET (CMAKE_C_ARCHIVE_CREATE   "<CMAKE_AR> -r <TARGET> <OBJECTS>")
SET (CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})

PROJECT (myProject)

# Set the output extensions, basically the .obj don't matter.
# but since cmake expects the original filename AND the output extension
# appended to it, they are hardcoded in CMAKE_<LANG>_COMPILE_OBJECT because
# the compiler would normally strip the extension and append the output extension,
# which on Windows is .obj
SET (CMAKE_C_OUTPUT_EXTENSION   .obj)
SET (CMAKE_CXX_OUTPUT_EXTENSION .obj)
SET (CMAKE_ASM_OUTPUT_EXTENSION .obj)
SET (CMAKE_EXECUTABLE_SUFFIX    .out)
SET (CMAKE_LIBRARY_PATH_FLAG "-i=")
SET (CMAKE_INCLUDE_FLAG_C    "-I=")

# just to make some dev's happy...
SET (CMAKE_STATIC_LIBRARY_PREFIX "lib")
SET (CMAKE_STATIC_LIBRARY_SUFFIX ".lib")


add_subdirectory(src)
-------------- next part --------------
# vorlage:
set(CMAKE_C_FLAGS           "-q -mv6740 -pdse225 -pdse1116 -pden -pds179 -pds552")
set(CMAKE_CXX_FLAGS         ${CMAKE_C_FLAGS})
set(CMAKE_ASM_FLAGS         ${CMAKE_C_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS "-b -c -w -x" )


set(CMAKE_C_FLAGS_DEBUG     "${CMAKE_C_FLAGS} -g  -d\"_STLP_EXPOSE_GLOBALS_IMPLEMENTATION\" -d\"_DEBUG\" ")
set(CMAKE_C_FLAGS_RELEASE   "${CMAKE_C_FLAGS} -O3 -d\"_STLP_EXPOSE_GLOBALS_IMPLEMENTATION\" ")
set(CMAKE_ASM_FLAGS_DEBUG   ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_ASM_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG   ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})

LINK_DIRECTORIES (
"${PROJECT_SOURCE_DIR}/src/lib/")


INCLUDE_DIRECTORIES (
"C:/tools/cgtools-7.2.4/include/"
)

SET (My_SRCS
System/Boot.c
linker.cmd
System/Main.cpp
)

add_executable(my_firmware ${My_SRCS})
target_link_libraries(my_firmware libfoo)
SET_TARGET_PROPERTIES(my_firmware PROPERTIES LINKER_LANGUAGE C)


More information about the CMake mailing list