- check IF WIN32 AND NOT UNIX (for cygwin)
[blender.git] / build_files / cmake / macros.cmake
index 42aa9d1f8b51ff025a60ba406af839fadd2a8139..0da1d6c37dcf77be774a01ed4c5236f3fb2fdedb 100644 (file)
@@ -14,17 +14,15 @@ MACRO(BLENDERLIB_NOLIST
        ADD_LIBRARY(${name} ${INC_ALL} ${sources})
 
        # Group by location on disk
-       SOURCE_GROUP(Files FILES CMakeLists.txt)
+       SOURCE_GROUP("Source Files" FILES CMakeLists.txt)
        SET(ALL_FILES ${sources} ${INC_ALL})
        FOREACH(SRC ${ALL_FILES})
-               STRING(REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "Files" REL_DIR "${SRC}")
-               STRING(REGEX REPLACE "[\\\\/][^\\\\/]*$" "" REL_DIR "${REL_DIR}")
-               STRING(REGEX REPLACE "^[\\\\/]" "" REL_DIR "${REL_DIR}")
-               IF(REL_DIR)
-                       SOURCE_GROUP(${REL_DIR} FILES ${SRC})
-               ELSE(REL_DIR)
-                       SOURCE_GROUP(Files FILES ${SRC})
-               ENDIF(REL_DIR)
+               GET_FILENAME_COMPONENT(SRC_EXT ${SRC} EXT)
+               IF(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp") 
+                       SOURCE_GROUP("Header Files" FILES ${SRC})
+               ELSE()
+                       SOURCE_GROUP("Source Files" FILES ${SRC})
+               ENDIF()
        ENDFOREACH(SRC)
 ENDMACRO(BLENDERLIB_NOLIST)
 
@@ -102,9 +100,9 @@ MACRO(SETUP_LIBDIRS)
                LINK_DIRECTORIES(${EXPAT_LIBPATH})
        ENDIF(WITH_OPENCOLLADA)
 
-       IF(WIN32)
+       IF(WIN32 AND NOT UNIX)
                LINK_DIRECTORIES(${PTHREADS_LIBPATH})
-       ENDIF(WIN32)
+       ENDIF(WIN32 AND NOT UNIX)
 ENDMACRO(SETUP_LIBDIRS)
 
 MACRO(SETUP_LIBLINKS
@@ -117,12 +115,12 @@ MACRO(SETUP_LIBLINKS
        IF(WITH_PYTHON)
                TARGET_LINK_LIBRARIES(${target} ${PYTHON_LINKFLAGS})
 
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
                        TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
-               ELSE(WIN32)
+               ELSE(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_PYTHON)
 
        TARGET_LINK_LIBRARIES(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB})
@@ -131,9 +129,9 @@ MACRO(SETUP_LIBLINKS
        IF(WITH_INTERNATIONAL)
                TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
 
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${ICONV_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_INTERNATIONAL)
 
        IF(WITH_OPENAL)
@@ -158,14 +156,14 @@ MACRO(SETUP_LIBLINKS
                TARGET_LINK_LIBRARIES(${target} ${TIFF_LIBRARY})
        ENDIF(WITH_IMAGE_TIFF)
        IF(WITH_IMAGE_OPENEXR)
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        FOREACH(loop_var ${OPENEXR_LIB})
                                TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
                                TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
                        ENDFOREACH(loop_var)
-               ELSE(WIN32)
+               ELSE(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${OPENEXR_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_IMAGE_OPENEXR)
        IF(WITH_LCMS)
                TARGET_LINK_LIBRARIES(${target} ${LCMS_LIBRARY})
@@ -174,7 +172,7 @@ MACRO(SETUP_LIBLINKS
                TARGET_LINK_LIBRARIES(${target} ${FFMPEG_LIB})
        ENDIF(WITH_FFMPEG)
        IF(WITH_OPENCOLLADA)
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        FOREACH(loop_var ${OPENCOLLADA_LIB})
                                TARGET_LINK_LIBRARIES(${target} debug ${loop_var}_d)
                                TARGET_LINK_LIBRARIES(${target} optimized ${loop_var})
@@ -185,21 +183,21 @@ MACRO(SETUP_LIBLINKS
                                TARGET_LINK_LIBRARIES(${target} debug ${EXPAT_LIB}_d)
                                TARGET_LINK_LIBRARIES(${target} optimized ${EXPAT_LIB})
                        ENDIF(EXPAT_LIB)
-               ELSE(WIN32)
+               ELSE(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} ${OPENCOLLADA_LIB})
                        TARGET_LINK_LIBRARIES(${target} ${PCRE_LIB})
                        TARGET_LINK_LIBRARIES(${target} ${EXPAT_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_OPENCOLLADA)
        IF(WITH_LCMS)
-               IF(WIN32)
+               IF(WIN32 AND NOT UNIX)
                        TARGET_LINK_LIBRARIES(${target} debug ${LCMS_LIB}_d)
                        TARGET_LINK_LIBRARIES(${target} optimized ${LCMS_LIB})
-               ENDIF(WIN32)
+               ENDIF(WIN32 AND NOT UNIX)
        ENDIF(WITH_LCMS)
-       IF(WIN32)
+       IF(WIN32 AND NOT UNIX)
                TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
-       ENDIF(WIN32)
+       ENDIF(WIN32 AND NOT UNIX)
 ENDMACRO(SETUP_LIBLINKS)
 
 MACRO(TEST_SSE_SUPPORT)