c++ - How to tell CMake when using add_library to not include a specific object file -


i trying make static library, example my_lib.a. library depending gsoap code - file2.cpp.o, generated because of cmake instruction (and 2 custom commands):

add_library(${target_name} ${src_files}     ${generated_src_files} ${generated_h_files} ${generated_res_files}) 

file2.cpp present in generated_src_files. runs fine until moment of linking.

/usr/bin/ar cr ../lib/my_lib.a cmakefiles/my_lib.dir/src/file1.cpp.o cmakefiles/my_lib.dir/src/file2.cpp.o

if let make use command, library my_lib.a contain file1.cpp.o , file2.cpp.o. in fact not need file2.cpp.o in *.a library.

does know how have manage case in way obtain my_lib.a contains file1.cpp.o?

i think found solution. idea compile *.o files different target not official one. in official target can put these files consider important ones. in case have 1 file not want include in *.a file.. :

the first target is:

add_library(gsoap_files object ${generated_src_files} ... )

and official 1 is:

add_library(${target_name} ${src_files})

i inspired myself page:

http://www.cmake.org/wiki/cmake/tutorials/object_library


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -