Revision: 40490
http://brlcad.svn.sourceforge.net/brlcad/?rev=40490&view=rev
Author: starseeker
Date: 2010-09-07 18:42:01 +0000 (Tue, 07 Sep 2010)
Log Message:
-----------
OK, here we go - build shared and static libraries by default thanks to some
macro fun. Naturally, Windows immediately makes me eat my words - we do need a
lib prefix in all cases on Windows for static libs, so only in that case always
set the prefix to 'lib' regardless of target name.
Modified Paths:
--------------
brlcad/branches/cmake/CMakeLists.txt
brlcad/branches/cmake/misc/CMake/BRLCAD_Util.cmake
Modified: brlcad/branches/cmake/CMakeLists.txt
===================================================================
--- brlcad/branches/cmake/CMakeLists.txt 2010-09-07 18:23:37 UTC (rev
40489)
+++ brlcad/branches/cmake/CMakeLists.txt 2010-09-07 18:42:01 UTC (rev
40490)
@@ -99,6 +99,9 @@
# build shared libs by default
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
+# build static libs by default
+OPTION(BUILD_STATIC_LIBS "Build static libraries" ON)
+
# Will need our own add_executable and add_library
# versions in order to keep track of targets and
# define rules for all products.
Modified: brlcad/branches/cmake/misc/CMake/BRLCAD_Util.cmake
===================================================================
--- brlcad/branches/cmake/misc/CMake/BRLCAD_Util.cmake 2010-09-07 18:23:37 UTC
(rev 40489)
+++ brlcad/branches/cmake/misc/CMake/BRLCAD_Util.cmake 2010-09-07 18:42:01 UTC
(rev 40490)
@@ -9,9 +9,25 @@
MACRO(BRLCAD_ADDLIB libname srcs libs)
STRING(REGEX REPLACE " " ";" srcslist "${srcs}")
STRING(REGEX REPLACE " " ";" libslist "${libs}")
- add_library(${libname} ${srcslist})
- if(NOT ${libs} MATCHES "NONE")
- target_link_libraries(${libname} ${libslist})
- endif(NOT ${libs} MATCHES "NONE")
- INSTALL(TARGETS ${libname} DESTINATION ${BRLCAD_INSTALL_LIB_DIR})
+ IF(BUILD_SHARED_LIBS)
+ add_library(${libname} SHARED ${srcslist})
+ if(NOT ${libs} MATCHES "NONE")
+ target_link_libraries(${libname} ${libslist})
+ endif(NOT ${libs} MATCHES "NONE")
+ INSTALL(TARGETS ${libname} DESTINATION ${BRLCAD_INSTALL_LIB_DIR})
+ ENDIF(BUILD_SHARED_LIBS)
+ IF(BUILD_STATIC_LIBS)
+ add_library(${libname}-static STATIC ${srcslist})
+ if(NOT ${libs} MATCHES "NONE")
+ target_link_libraries(${libname}-static ${libslist})
+ endif(NOT ${libs} MATCHES "NONE")
+ SET_TARGET_PROPERTIES(${libname}-static PROPERTIES OUTPUT_NAME
"${libname}")
+ IF(WIN32)
+ # We need the lib prefix on win32, so add it even if our
add_library
+ # wrapper function has removed it due to the target name - see
+ #
http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
+ SET_TARGET_PROPERTIES(${libname}-static PROPERTIES PREFIX
"lib")
+ ENDIF(WIN32)
+ INSTALL(TARGETS ${libname} DESTINATION ${BRLCAD_INSTALL_LIB_DIR})
+ ENDIF(BUILD_STATIC_LIBS)
ENDMACRO(BRLCAD_ADDLIB libname srcs libs)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits